From d916342f1cc4d8a88e9f1f0dc46c897e03705148 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Oct 2022 19:54:12 +0200 Subject: [PATCH 001/336] Program_SecretChats timerstamp name for saved media --- .github/dev.yml | 2 +- Examples/Program_SecretChats.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index adf45c2..04417b8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.0.1-dev.$(Rev:r) +name: 3.0.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 14412f3..c204af8 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -92,7 +92,7 @@ Type a command, or a message to send to the active secret chat:"); if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) { int slash = msg.Media.MimeType?.IndexOf('/') ?? 0; // quick & dirty conversion from MIME type to file extension - var filename = slash > 0 ? $"media.{msg.Media.MimeType[(slash + 1)..]}" : "media.bin"; + var filename = $"{DateTime.Now:yyyy-MM-dd_HH-mm-ss}.{(slash > 0 ? msg.Media.MimeType[(slash + 1)..] : "bin")}"; Console.WriteLine($"{unem.message.ChatId}> {msg.Message} [attached file downloaded to {filename}]"); using var output = File.Create(filename); await Secrets.DownloadFile(ef, msg.Media, output); From 7e9d010392170d8f6ae4e1b21204673004d7442d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 24 Oct 2022 11:51:33 +0200 Subject: [PATCH 002/336] documentation --- EXAMPLES.md | 18 +++++++++++++++--- FAQ.md | 19 +++++++++++-------- 2 files changed, 26 insertions(+), 11 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 65dd40d..841f5c5 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -28,7 +28,7 @@ var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // username await client.SendMessageAsync(resolved, "/start"); ``` *Note: This also works if the @username points to a channel/group, but you must already have joined that channel before sending a message to it. -If the username is invalid/unused, the API call raises an exception.* +If the username is invalid/unused, the API call raises an RpcException.* ### Send a message to someone by phone number @@ -134,7 +134,7 @@ but the old `Chat` will be marked with flag [deactivated] and should not be used ### List all dialogs (chats/groups/channels/user chat) we are currently in ```csharp var dialogs = await client.Messages_GetAllDialogs(); -foreach (var dialog in dialogs.dialogs) +foreach (Dialog dialog in dialogs.dialogs) switch (dialogs.UserOrChat(dialog)) { case User user when user.IsActive: Console.WriteLine("User " + user); break; @@ -218,6 +218,18 @@ var channel = (Channel)chats.chats[1234567890]; // the channel we want var participants = await client.Channels_GetAllParticipants(channel); ``` +If you only need to list the channel owner/admins, you can use specific filter: +```csharp +var participants = await client.Channels_GetParticipants(channel, filter: new ChannelParticipantsAdmins()); +foreach (var participant in participants.participants) // This is the correct way to enumerate the result +{ + var user = participants.users[participant.UserID]; + if (participant is ChannelParticipantCreator cpc) Console.WriteLine($"{user} is the owner '{cpc.rank}'"); + else if (participant is ChannelParticipantAdmin cpa) Console.WriteLine($"{user} is admin '{cpa.rank}'"); +} +``` +*Note: It is not possible to list only the Deleted Accounts. Those will be automatically removed by Telegram from your group after a while* + ### Join a channel/group by their public name or invite link * For a public channel/group `@channelname` @@ -286,7 +298,7 @@ for (int offset_id = 0; ;) offset_id = messages.Messages[^1].ID; } ``` - +*Note: If you want to stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id`* ### Monitor all Telegram events happening for the user diff --git a/FAQ.md b/FAQ.md index f9b762c..a22152a 100644 --- a/FAQ.md +++ b/FAQ.md @@ -140,12 +140,13 @@ Some additional advices from me: 5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdate` events. 6. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban) -7. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient. -8. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history. +7. Don't buy fake users/session accounts from Internet and don't extract api_id/hash/authkey/sessions from official clients, this is [specifically forbidden by API TOS](https://core.telegram.org/api/terms#2-transparency). +8. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient. +9. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history. In particular, DON'T create an API ID/Hash for every phone numbers you will control. One API ID/Hash represents your application, which can be used to control several user accounts. -9. If you actually do use the library to spam, scam, or other stuff annoying to everybody, GTFO and don't cry that you got banned using WTelegramClient. Some people don't seem to realize by themselves that what they plan to do with the library is actually negative for the community and are surprised that they got caught. +10. If you actually do use the library to spam, scam, or other stuff annoying to everybody, GTFO and don't cry that you got banned using WTelegramClient. Some people don't seem to realize by themselves that what they plan to do with the library is actually negative for the community and are surprised that they got caught. We don't support such use of the library, and will not help people asking for support if we suspect them of mass-user manipulation. -10. If your client displays Telegram channels to your users, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). +11. If your client displays Telegram channels to your users, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). #### 9. Why the error `CHAT_ID_INVALID`? @@ -154,7 +155,7 @@ Most chat groups you see are likely of type `Channel`, not `Chat`. This difference is important to understand. Please [read about the Terminology in ReadMe](README.md#terminology). You typically get the error `CHAT_ID_INVALID` when you try to call API methods designed specifically for a `Chat`, with the ID of a `Channel`. -All API methods taking a `long api_id` as a direct method parameter are for Chats and cannot be used with Channels. +All API methods taking a `long chat_id` as a direct method parameter are for Chats and cannot be used with Channels. There is probably another method achieving the same result but specifically designed for Channels, and it will have a similar name, but beginning with `Channels_` ... @@ -164,12 +165,12 @@ That object must be created with both fields `channel_id` and `access_hash` corr #### 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat id. -There can be several reasons why `chats.chats[id]` raise an error: -- The user account you're currently logged-in as has not joined this particular chat. +There can be several reasons why `chats.chats` doesn't contain the chat you expect: +- The currently logged-in user account has not joined this particular chat. API method [Messages_GetAllChats](https://corefork.telegram.org/method/messages.getAllChats) will only return those chat groups/channels the user is in, not all Telegram chat groups. - You're trying to use a Bot API (or TDLib) numerical ID, like -1001234567890 Telegram Client API don't use these kind of IDs for chats. Remove the -100 prefix and try again with the rest (1234567890). -- You're trying to use a user ID instead of a chat ID. +- You're searching for a user instead of a chat ID. Private messages with a user are not called "chats". See [Terminology in ReadMe](README.md#terminology). To obtain the list of users (as well as chats and channels) the logged-in user is currenly engaged in a discussion with, you should [use the API method Messages_GetAllDialogs](EXAMPLES.md#list-dialogs) - the `chats.chats` dictionary is empty. @@ -203,6 +204,8 @@ In this case, the recommended action would be to dispose the client and recreate you might also get Connection shutdown because your client couldn't send Pings to Telegram in the allotted time. In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. +5) If you're using an MTProxy, some of them are known to be quite unstable. You may want to try switching to another MTProxy that is more stable. + #### 12. How to migrate from TLSharp? How to sign-in/sign-up/register account properly? From 517fab89bb247a25494b717bd5aad05f44596e3d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Oct 2022 10:34:53 +0200 Subject: [PATCH 003/336] ReadHistory helper --- EXAMPLES.md | 4 +++- FAQ.md | 33 +++++++++++++++++++++++++++++++++ README.md | 3 ++- src/Client.Helpers.cs | 9 +++++++++ src/TL.Schema.cs | 2 +- src/TL.SchemaFuncs.cs | 2 +- 6 files changed, 49 insertions(+), 4 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 841f5c5..eb91e4b 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -298,7 +298,9 @@ for (int offset_id = 0; ;) offset_id = messages.Messages[^1].ID; } ``` -*Note: If you want to stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id`* +Notes: +- To stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id` +- To mark the message history as read, use: `await client.ReadHistory(peer);` ### Monitor all Telegram events happening for the user diff --git a/FAQ.md b/FAQ.md index a22152a..5e3dea8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -163,6 +163,7 @@ However, note that those Channel-compatible methods will require an `InputChanne That object must be created with both fields `channel_id` and `access_hash` correctly filled. You can read more about this in [FAQ #4](#access-hash). + #### 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat id. There can be several reasons why `chats.chats` doesn't contain the chat you expect: @@ -259,6 +260,38 @@ If those missing messages are never obtained during the session, incoming messag - As recommended, new encryption keys are negotiated every 100 sent/received messages or after one week. If remote client doesn't complete this negotiation before reaching 200 messages, the Secret Chat is aborted. + +#### 15. The example codes don't compile on my machine + +The snippets of example codes found in the [ReadMe](README.md) or [Examples](EXAMPLES.md) pages were written for .NET 5 / C# 9 minimum. +If you're having compiler problem on code constructs such as `using`, `foreach`, `[^1]` or about "Deconstruct", +that typically means you're still using an obsolete version of .NET (Framework 4.x or Core) + +Here are the recommended actions to fix your problem: +- Create a new project for .NET 6+ (in Visual Studio 2019 or more recent): + - Select File > New > Project + - Search for "C# Console" + - Select the **Console App**, but NOT Console App (.NET Framework) ! + - On the framework selection page, choose .NET 6.0 or more recent + - Now you can start developing for WTelegramClient 🙂 +- If you don't want to target a recent version of .NET, you can upgrade your existing project to use the latest version of the C# language: + - Close Visual Studio + - Edit your *.csproj file **with Notepad** + - Within the first ``, add the following line: + `latest` + - Save, close Notepad and reopen your project in Visual Studio + - If you still have issues on some `foreach` constructs, add this class somewhere in your project: + ```csharp + static class Extensions + { + public static void Deconstruct(this KeyValuePair tuple, out T1 key, out T2 value) + { + key = tuple.Key; + value = tuple.Value; + } + } + ``` + ## Troubleshooting guide diff --git a/README.md b/README.md index e25529a..e8a0773 100644 --- a/README.md +++ b/README.md @@ -151,7 +151,8 @@ await client.SendMessageAsync(target, "Hello, World"); ``` ➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) -and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). +and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). +➡️ Check [the FAQ](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#compile) if example codes doesn't compile correctly on your machine, or other troubleshooting. # Terminology in Telegram Client API diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index db97629..980d9f1 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -657,6 +657,15 @@ namespace WTelegram public Task DeleteMessages(InputPeer peer, params int[] id) => peer is InputPeerChannel channel ? this.Channels_DeleteMessages(channel, id) : this.Messages_DeleteMessages(id); + + /// Marks message history as read. See
and
Possible codes: 400 (details)
+ /// Target user, channel or group + /// If a positive value is passed, only messages with identifiers less or equal than the given one will be marked read + public async Task ReadHistory(InputPeer peer, int max_id = default) => peer switch + { + InputPeerChannel channel => await this.Channels_ReadHistory(channel, max_id), + _ => (await this.Messages_ReadHistory(peer, max_id)) != null + }; #endregion } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index cc61da5..d012742 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -6560,7 +6560,7 @@ namespace TL /// Message entity representing a spoiler See [TLDef(0x32CA960F)] public class MessageEntitySpoiler : MessageEntity { } - /// Represents a custom emoji See + /// Represents a custom emoji.
Note that this entity must wrap exactly one regular emoji (the one contained in .alt) in the related text, otherwise the server will ignore it. See
[TLDef(0xC8CF05F8, inheritBefore = true)] public class MessageEntityCustomEmoji : MessageEntity { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index af4a1a7..5fca2b0 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3056,7 +3056,7 @@ namespace TL /// React to message See Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown - /// Add this reaction to the recent reactions list + /// Add this reaction to the recent reactions list ». /// Peer /// Message ID to react to /// Reaction (a UTF8 emoji) From cc9cf16f8adc08e18ea6d9718945258fec6b1de7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Oct 2022 20:07:43 +0200 Subject: [PATCH 004/336] ToInputChatPhoto helper --- FAQ.md | 2 ++ src/SecretChats.cs | 8 ++------ src/TL.Helpers.cs | 9 +++++++++ 3 files changed, 13 insertions(+), 6 deletions(-) diff --git a/FAQ.md b/FAQ.md index 5e3dea8..0b4d1c5 100644 --- a/FAQ.md +++ b/FAQ.md @@ -292,6 +292,8 @@ Here are the recommended actions to fix your problem: } ``` +Also, remember to add a `using TL;` at the top of your files to have access to all the Telegram API methods. + ## Troubleshooting guide diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 701619f..8065b5f 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -588,12 +588,8 @@ namespace WTelegram fingerprint ^= fingerprint >> 32; using var ige = new AES_IGE_Stream(stream, aes_key, aes_iv, true); - return await client.UploadFileAsync(ige, null, progress) switch - { - InputFile ifl => new InputEncryptedFileUploaded { id = ifl.id, parts = ifl.parts, md5_checksum = ifl.md5_checksum, key_fingerprint = (int)fingerprint }, - InputFileBig ifb => new InputEncryptedFileBigUploaded { id = ifb.id, parts = ifb.parts, key_fingerprint = (int)fingerprint }, - _ => null - }; + var inputFile = await client.UploadFileAsync(ige, null, progress); + return inputFile.ToInputEncryptedFile((int)fingerprint); } /// Download and decrypt an encrypted file from Telegram Secret Chat into the outputStream diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index aad124b..529ec5d 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Globalization; +using System.IO; using System.Linq; using System.Text; using System.Web; @@ -57,6 +58,14 @@ namespace TL { public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint); public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret); + /// for a profile photo. for auto-detection
for a profile video. The video MUST be square and 10 seconds max + public InputChatUploadedPhoto ToInputChatPhoto(bool? isSquareVideo10s = null) + { + if (isSquareVideo10s ?? Path.GetExtension(Name)?.ToLowerInvariant() is ".mp4") + return new InputChatUploadedPhoto { video = this, flags = InputChatUploadedPhoto.Flags.has_video }; + else + return new InputChatUploadedPhoto { file = this, flags = InputChatUploadedPhoto.Flags.has_file }; + } } partial class InputFile { From 1a3cde42417f441b72d6680314d44be33fe05223 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 26 Oct 2022 14:26:22 +0200 Subject: [PATCH 005/336] Replaced *Default & *None structures with null --- FAQ.md | 19 ++++++++++--------- src/TL.Helpers.cs | 2 +- src/TL.Schema.cs | 44 +++++++++++++++---------------------------- src/TL.SchemaFuncs.cs | 11 +++++++---- src/TL.Table.cs | 18 ++++++++++++------ 5 files changed, 45 insertions(+), 49 deletions(-) diff --git a/FAQ.md b/FAQ.md index 0b4d1c5..6e4e747 100644 --- a/FAQ.md +++ b/FAQ.md @@ -139,8 +139,8 @@ Here are some advices from [another similar library](https://github.com/gotd/td/ Some additional advices from me: 5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdate` events. -6. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban) -7. Don't buy fake users/session accounts from Internet and don't extract api_id/hash/authkey/sessions from official clients, this is [specifically forbidden by API TOS](https://core.telegram.org/api/terms#2-transparency). +6. Don't buy fake user accounts/sessions and don't extract api_id/hash/authkey/sessions from official clients, this is [specifically forbidden by API TOS](https://core.telegram.org/api/terms#2-transparency). You must use your own api_id and create your own sessions associated with it. +7. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban) 8. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient. 9. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history. In particular, DON'T create an API ID/Hash for every phone numbers you will control. One API ID/Hash represents your application, which can be used to control several user accounts. @@ -164,23 +164,24 @@ That object must be created with both fields `channel_id` and `access_hash` corr -#### 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat id. +#### 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat I'm looking for. There can be several reasons why `chats.chats` doesn't contain the chat you expect: -- The currently logged-in user account has not joined this particular chat. -API method [Messages_GetAllChats](https://corefork.telegram.org/method/messages.getAllChats) will only return those chat groups/channels the user is in, not all Telegram chat groups. -- You're trying to use a Bot API (or TDLib) numerical ID, like -1001234567890 -Telegram Client API don't use these kind of IDs for chats. Remove the -100 prefix and try again with the rest (1234567890). - You're searching for a user instead of a chat ID. Private messages with a user are not called "chats". See [Terminology in ReadMe](README.md#terminology). -To obtain the list of users (as well as chats and channels) the logged-in user is currenly engaged in a discussion with, you should [use the API method Messages_GetAllDialogs](EXAMPLES.md#list-dialogs) +To obtain the list of users (as well as chats and channels) the logged-in user is currenly engaged in a discussion with, you should [use the API method `Messages_GetAllDialogs`](EXAMPLES.md#list-dialogs) +- The currently logged-in user account has not joined this particular chat. +API method [`Messages_GetAllChats`](https://corefork.telegram.org/method/messages.getAllChats) will only return those chat groups/channels the user is in, not all Telegram chat groups. +If you're looking for other Telegram groups/channels/users, try API methods [`Contacts_ResolveUsername`](EXAMPLES.md#msg-by-name) or `Contacts_Search` +- You're trying to use a Bot API (or TDLib) numerical ID, like -1001234567890 +Telegram Client API don't use these kind of IDs for chats. Remove the -100 prefix and try again with the rest (1234567890). - the `chats.chats` dictionary is empty. This is the case if you are logged-in as a brand new user account (that hasn't join any chat groups/channels) or if you are connected to a Test DC (a Telegram datacenter server for tests) instead of Production DC ([read FAQ #6](#wrong-server) for more) To help determine if `chats.chats` is empty or does not contain a certain chat, you should [dump the chat list to the screen](EXAMPLES.md#list-chats) -or simply use a debugger: Place a breakpoint after the Messages_GetAllChats call, run the program up to there, and use a Watch pane to display the content of the chats.chats dictionary. +or simply use a debugger: Place a breakpoint after the `Messages_GetAllChats` call, run the program up to there, and use a Watch pane to display the content of the chats.chats dictionary. #### 11. I get "Connection shut down" errors in my logs diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 529ec5d..0e8f82e 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -58,7 +58,7 @@ namespace TL { public abstract InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint); public abstract InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret); - /// for a profile photo. for auto-detection
for a profile video. The video MUST be square and 10 seconds max + /// for a profile photo. for auto-detection
for a profile video. The video MUST be square, 10 seconds max, larger than 160x160 public InputChatUploadedPhoto ToInputChatPhoto(bool? isSquareVideo10s = null) { if (isSquareVideo10s ?? Path.GetExtension(Name)?.ToLowerInvariant() is ".mp4") diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index d012742..95f1d61 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3870,7 +3870,7 @@ namespace TL /// Folder ID public int id; /// Folder info - [IfFlag(0)] public DialogFilterBase filter; + [IfFlag(0)] public DialogFilter filter; [Flags] public enum Flags : uint { @@ -6306,7 +6306,7 @@ namespace TL public class KeyboardButtonBuy : KeyboardButton { } - /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, messages.requestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call messages.acceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See + /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, messages.requestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call messages.acceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See [TLDef(0x10B78D29)] public class KeyboardButtonUrlAuth : KeyboardButtonBase { @@ -11332,7 +11332,8 @@ namespace TL } } - /// URL authorization result Derived classes: , , See + /// URL authorization result Derived classes: , See + /// a null value means urlAuthResultDefault public abstract class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] @@ -11358,9 +11359,6 @@ namespace TL /// The URL name of the website on which the user has logged in. public string url; } - /// Details about an accepted authorization request, for more info click here » See - [TLDef(0xA9D6DB1F)] - public class UrlAuthResultDefault : UrlAuthResult { } /// Geographical location of supergroup (geogroups) See /// a null value means channelLocationEmpty @@ -11742,11 +11740,10 @@ namespace TL public BankCardOpenUrl[] open_urls; } - /// Dialog filter (folder ») Derived classes: , See - public abstract class DialogFilterBase : IObject { } /// Dialog filter AKA folder See + /// a null value means dialogFilterDefault [TLDef(0x7438F7E8)] - public class DialogFilter : DialogFilterBase + public class DialogFilter : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -11785,16 +11782,13 @@ namespace TL has_emoticon = 0x2000000, } } - /// Used only when reordering folders to indicate the default (all chats) folder. See - [TLDef(0x363293AE)] - public class DialogFilterDefault : DialogFilterBase { } /// Suggested folders See [TLDef(0x77744D4A)] public class DialogFilterSuggested : IObject { /// Folder info - public DialogFilterBase filter; + public DialogFilter filter; /// Folder description public string description; } @@ -12705,11 +12699,9 @@ namespace TL public string short_name; } - /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. Derived classes: , , , , , , See + /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. Derived classes: , , , , , See + /// a null value means botCommandScopeDefault public abstract class BotCommandScope : IObject { } - /// The commands will be valid in all dialogs See - [TLDef(0x2F6CB2AB)] - public class BotCommandScopeDefault : BotCommandScope { } /// The specified bot commands will only be valid in all private chats with users. See [TLDef(0x3C4F04D8)] public class BotCommandScopeUsers : BotCommandScope { } @@ -13234,11 +13226,9 @@ namespace TL } } - /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , , See + /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , See + /// a null value means botMenuButtonDefault public abstract class BotMenuButtonBase : IObject { } - /// Placeholder bot menu button never returned to users: see the docs for more info. See - [TLDef(0x7533A588)] - public class BotMenuButtonDefault : BotMenuButtonBase { } /// Bot menu button that opens the bot command list when clicked. See [TLDef(0x4258C205)] public class BotMenuButtonCommands : BotMenuButtonBase { } @@ -13263,11 +13253,9 @@ namespace TL public DocumentBase[] ringtones; } - /// Represents a notification sound Derived classes: , , , See + /// Represents a notification sound Derived classes: , , See + /// a null value means notificationSoundDefault public abstract class NotificationSound : IObject { } - /// Indicates the default notification sound should be used See - [TLDef(0x97E8BEBE)] - public class NotificationSoundDefault : NotificationSound { } /// No notification sound should be used See [TLDef(0x6F0C34DF)] public class NotificationSoundNone : NotificationSound { } @@ -13483,11 +13471,9 @@ namespace TL public long document_id; } - /// Available chat reactions Derived classes: , , See + /// Available chat reactions Derived classes: , See + /// a null value means chatReactionsNone public abstract class ChatReactions : IObject { } - /// No reactions are allowed See - [TLDef(0xEAFC32BC)] - public class ChatReactionsNone : ChatReactions { } /// All reactions or all non-custom reactions are allowed See [TLDef(0x52928BCA)] public class ChatReactionsAll : ChatReactions diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5fca2b0..c0b70d1 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2587,6 +2587,7 @@ namespace TL /// The message /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » + /// a null value means urlAuthResultDefault public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) => client.Invoke(new Messages_RequestUrlAuth { @@ -2603,6 +2604,7 @@ namespace TL /// Message ID of the message with the login button /// ID of the login button /// URL used for link URL authorization, click here for more info » + /// a null value means urlAuthResultDefault public static Task Messages_AcceptUrlAuth(this Client client, bool write_allowed = false, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) => client.Invoke(new Messages_AcceptUrlAuth { @@ -2691,7 +2693,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 { }); @@ -2705,7 +2707,7 @@ namespace TL /// Update folder See Possible codes: 400 (details) /// Folder ID /// Folder info - public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilterBase filter = null) + public static Task Messages_UpdateDialogFilter(this Client client, int id, DialogFilter filter = null) => client.Invoke(new Messages_UpdateDialogFilter { flags = (Messages_UpdateDialogFilter.Flags)(filter != null ? 0x1 : 0), @@ -4229,6 +4231,7 @@ namespace TL /// Gets the menu button action for a given user or for all users, previously set using bots.setBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details) /// User ID or empty for the default menu button. + /// a null value means botMenuButtonDefault public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) => client.Invoke(new Bots_GetBotMenuButton { @@ -7106,7 +7109,7 @@ namespace TL.Methods } [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } + public class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] public class Messages_GetSuggestedDialogFilters : IMethod { } @@ -7116,7 +7119,7 @@ namespace TL.Methods { public Flags flags; public int id; - [IfFlag(0)] public DialogFilterBase filter; + [IfFlag(0)] public DialogFilter filter; [Flags] public enum Flags : uint { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 27ecbc9..0ae1e3c 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -865,7 +865,7 @@ namespace TL [0xE844EBFF] = typeof(Messages_SearchCounter), [0x92D33A0E] = typeof(UrlAuthResultRequest), [0x8F8C0E4E] = typeof(UrlAuthResultAccepted), - [0xA9D6DB1F] = typeof(UrlAuthResultDefault), + [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty [0x209B82DB] = typeof(ChannelLocation), [0xCA461B5D] = typeof(PeerLocated), @@ -891,7 +891,7 @@ namespace TL [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), [0x7438F7E8] = typeof(DialogFilter), - [0x363293AE] = typeof(DialogFilterDefault), + [0x363293AE] = null,//DialogFilterDefault [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -942,7 +942,7 @@ namespace TL [0xDCB118B7] = typeof(GroupCallParticipantVideoSourceGroup), [0x67753AC8] = typeof(GroupCallParticipantVideo), [0x85FEA03F] = typeof(Stickers_SuggestedShortName), - [0x2F6CB2AB] = typeof(BotCommandScopeDefault), + [0x2F6CB2AB] = null,//BotCommandScopeDefault [0x3C4F04D8] = typeof(BotCommandScopeUsers), [0x6FE1A881] = typeof(BotCommandScopeChats), [0xB9AA606A] = typeof(BotCommandScopeChatAdmins), @@ -983,12 +983,12 @@ namespace TL [0x0C14557C] = typeof(WebViewResultUrl), [0x882F76BB] = typeof(SimpleWebViewResultUrl), [0x0C94511C] = typeof(WebViewMessageSent), - [0x7533A588] = typeof(BotMenuButtonDefault), + [0x7533A588] = null,//BotMenuButtonDefault [0x4258C205] = typeof(BotMenuButtonCommands), [0xC7B57CE6] = typeof(BotMenuButton), [0xFBF6E8B1] = null,//Account_SavedRingtonesNotModified [0xC1E92CC5] = typeof(Account_SavedRingtones), - [0x97E8BEBE] = typeof(NotificationSoundDefault), + [0x97E8BEBE] = null,//NotificationSoundDefault [0x6F0C34DF] = typeof(NotificationSoundNone), [0x830B9AE4] = typeof(NotificationSoundLocal), [0xFF6C8049] = typeof(NotificationSoundRingtone), @@ -1011,7 +1011,7 @@ namespace TL [0x79F5D419] = null,//ReactionEmpty [0x1B2286B8] = typeof(ReactionEmoji), [0x8935FC73] = typeof(ReactionCustomEmoji), - [0xEAFC32BC] = typeof(ChatReactionsNone), + [0xEAFC32BC] = null,//ChatReactionsNone [0x52928BCA] = typeof(ChatReactionsAll), [0x661D4037] = typeof(ChatReactionsSome), [0xB06FDBDF] = null,//Messages_ReactionsNotModified @@ -1125,15 +1125,21 @@ namespace TL [typeof(Help_PassportConfig)] = 0xBFB9F457, //help.passportConfigNotModified [typeof(Help_UserInfo)] = 0xF3AE2EED, //help.userInfoEmpty [typeof(Account_WallPapers)] = 0x1C199183, //account.wallPapersNotModified + [typeof(UrlAuthResult)] = 0xA9D6DB1F, //urlAuthResultDefault [typeof(ChannelLocation)] = 0xBFB5AD8B, //channelLocationEmpty [typeof(Account_Themes)] = 0xF41EB622, //account.themesNotModified + [typeof(DialogFilter)] = 0x363293AE, //dialogFilterDefault [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified + [typeof(BotCommandScope)] = 0x2F6CB2AB, //botCommandScopeDefault [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified [typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified + [typeof(BotMenuButtonBase)] = 0x7533A588, //botMenuButtonDefault [typeof(Account_SavedRingtones)] = 0xFBF6E8B1, //account.savedRingtonesNotModified + [typeof(NotificationSound)] = 0x97E8BEBE, //notificationSoundDefault [typeof(EmojiStatus)] = 0x2DE11AAE, //emojiStatusEmpty [typeof(Account_EmojiStatuses)] = 0xD08CE645, //account.emojiStatusesNotModified [typeof(Reaction)] = 0x79F5D419, //reactionEmpty + [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty From 49969e46cf5ec4e37cd1b8683723386ea19be399 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 26 Oct 2022 15:14:29 +0200 Subject: [PATCH 006/336] xmldoc --- src/TL.Schema.cs | 344 +++++++++++++++++++++++------------------------ src/TL.Secret.cs | 2 +- src/TL.Table.cs | 2 - 3 files changed, 173 insertions(+), 175 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 95f1d61..df0ec23 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -27,12 +27,12 @@ namespace TL } /// Corresponds to an arbitrary empty object. See - /// a null value means null + /// a value means null [TLDef(0x56730BCC)] public class Null : IObject { } - /// Peer Derived classes: , , , , , See - /// a null value means inputPeerEmpty + /// Peer See Derived classes: , , , , , + /// a value means inputPeerEmpty public abstract partial class InputPeer : IObject { } /// Defines the current user. See [TLDef(0x7DA07EC9)] @@ -85,8 +85,8 @@ namespace TL public long channel_id; } - /// Defines a user for subsequent interaction. Derived classes: , , See - /// a null value means inputUserEmpty + /// Defines a user for subsequent interaction. See Derived classes: , , + /// a value means inputUserEmpty public abstract partial class InputUserBase : IObject { } /// Defines the current user. See [TLDef(0xF7C1B13F)] @@ -112,7 +112,7 @@ namespace TL public long user_id; } - /// Object defines a contact from the user's phone book. Derived classes: See + /// Object defines a contact from the user's phone book. See Derived classes: public abstract class InputContact : IObject { } /// Phone contact. The client_id is just an arbitrary contact ID: it should be set, for example, to an incremental number when using contacts.importContacts, in order to retry importing only the contacts that weren't imported successfully. See [TLDef(0xF392B7F4)] @@ -128,7 +128,7 @@ namespace TL public string last_name; } - /// Defines a file uploaded by the client. Derived classes: , See + /// Defines a file uploaded by the client. See Derived classes: , public abstract partial class InputFileBase : IObject { /// Random file identifier created by the client @@ -177,8 +177,8 @@ namespace TL public override string Name => name; } - /// Defines media content of a message. Derived classes: , , , , , , , , , , , , , See - /// a null value means inputMediaEmpty + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , + /// a value means inputMediaEmpty public abstract class InputMedia : IObject { } /// Photo See [TLDef(0x1E287D04)] @@ -442,8 +442,8 @@ namespace TL public string emoticon; } - /// Defines a new group profile photo. Derived classes: , See - /// a null value means inputChatPhotoEmpty + /// Defines a new group profile photo. See Derived classes: , + /// a value means inputChatPhotoEmpty public abstract class InputChatPhotoBase : IObject { } /// New photo to be set as group profile photo. See [TLDef(0xC642724E)] @@ -477,7 +477,7 @@ namespace TL } /// Defines a GeoPoint by its coordinates. See - /// a null value means inputGeoPointEmpty + /// a value means inputGeoPointEmpty [TLDef(0x48222FAF)] public class InputGeoPoint : IObject { @@ -498,7 +498,7 @@ namespace TL } /// Defines a photo for further interaction. See - /// a null value means inputPhotoEmpty + /// a value means inputPhotoEmpty [TLDef(0x3BB3B94A)] public partial class InputPhoto : IObject { @@ -510,7 +510,7 @@ namespace TL public byte[] file_reference; } - /// Defines the location of a file for download. Derived classes: , , , , , , , , , See + /// Defines the location of a file for download. See Derived classes: , , , , , , , , , public abstract class InputFileLocationBase : IObject { } /// DEPRECATED location of a photo See [TLDef(0xDFDAABE1)] @@ -639,7 +639,7 @@ namespace TL } } - /// Chat partner or group. Derived classes: , , See + /// Chat partner or group. See Derived classes: , , public abstract partial class Peer : IObject { } /// Chat partner See [TLDef(0x59511722)] @@ -688,7 +688,7 @@ namespace TL webp = 0x1081464C, } - /// Object defines a user. Derived classes: , See + /// Object defines a user. See Derived classes: , public abstract partial class UserBase : IObject { } /// Empty constructor, non-existent user. See [TLDef(0xD3BC4B7A)] @@ -792,7 +792,7 @@ namespace TL } /// User profile photo. See - /// a null value means userProfilePhotoEmpty + /// a value means userProfilePhotoEmpty [TLDef(0x82D1F706)] public class UserProfilePhoto : IObject { @@ -814,8 +814,8 @@ namespace TL } } - /// User online status Derived classes: , , , , See - /// a null value means userStatusEmpty + /// User online status See Derived classes: , , , , + /// a value means userStatusEmpty public abstract partial class UserStatus : IObject { } /// Online status of the user. See [TLDef(0xEDB93949)] @@ -841,7 +841,7 @@ namespace TL [TLDef(0x77EBC742)] public partial class UserStatusLastMonth : UserStatus { } - /// Object defines a group. Derived classes: , , , , See + /// Object defines a group. See Derived classes: , , , , public abstract partial class ChatBase : IObject { /// ID of the group @@ -1044,7 +1044,7 @@ namespace TL public override string Title => title; } - /// Full info about a channel, supergroup, gigagroup or basic group. Derived classes: , See + /// Full info about a channel, supergroup, gigagroup or basic group. See Derived classes: , public abstract partial class ChatFullBase : IObject { /// ID of the chat @@ -1361,7 +1361,7 @@ namespace TL public override ChatReactions AvailableReactions => available_reactions; } - /// Details of a group member. Derived classes: , , See + /// Details of a group member. See Derived classes: , , public abstract partial class ChatParticipantBase : IObject { /// Member user ID @@ -1397,7 +1397,7 @@ namespace TL { } - /// Object contains info on group members. Derived classes: , See + /// Object contains info on group members. See Derived classes: , public abstract partial class ChatParticipantsBase : IObject { /// Group ID @@ -1439,7 +1439,7 @@ namespace TL } /// Group profile photo. See - /// a null value means chatPhotoEmpty + /// a value means chatPhotoEmpty [TLDef(0x1C6E1C11)] public class ChatPhoto : IObject { @@ -1461,7 +1461,7 @@ namespace TL } } - /// Object describing a message. Derived classes: , , See + /// Object describing a message. See Derived classes: , , public abstract class MessageBase : IObject { /// ID of the message @@ -1670,8 +1670,8 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media Derived classes: , , , , , , , , , , , See - /// a null value means messageMediaEmpty + /// Media See Derived classes: , , , , , , , , , , , + /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See [TLDef(0x695150D7)] @@ -1847,8 +1847,8 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See - /// a null value means messageActionEmpty + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// a value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See [TLDef(0xBD47CBAD)] @@ -2137,7 +2137,7 @@ namespace TL public int months; } - /// Chat info. Derived classes: , See + /// Chat info. See Derived classes: , public abstract class DialogBase : IObject { /// The chat @@ -2226,7 +2226,7 @@ namespace TL public override int TopMessage => top_message; } - /// Object describes a photo. Derived classes: , See + /// Object describes a photo. See Derived classes: , public abstract partial class PhotoBase : IObject { } /// Empty constructor, non-existent photo See [TLDef(0x2331B22D)] @@ -2265,7 +2265,7 @@ namespace TL } } - /// Location of a certain size of a picture Derived classes: , , , , , See + /// Location of a certain size of a picture See Derived classes: , , , , , public abstract partial class PhotoSizeBase : IObject { /// Thumbnail type (see. ) @@ -2355,7 +2355,7 @@ namespace TL } /// GeoPoint. See - /// a null value means geoPointEmpty + /// a value means geoPointEmpty [TLDef(0xB2A2F663)] public partial class GeoPoint : IObject { @@ -2401,7 +2401,7 @@ namespace TL } } - /// Object contains info on user authorization. Derived classes: , See + /// Object contains info on user authorization. See Derived classes: , public abstract class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See [TLDef(0x33FB7BB8)] @@ -2450,7 +2450,7 @@ namespace TL public byte[] bytes; } - /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See + /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , public abstract class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] @@ -2573,7 +2573,7 @@ namespace TL } } - /// Object contains info on a wallpaper. Derived classes: , See + /// Object contains info on a wallpaper. See Derived classes: , public abstract class WallPaperBase : IObject { /// Identifier @@ -2778,7 +2778,7 @@ namespace TL } /// The current user's contact list and info on users. See - /// a null value means contacts.contactsNotModified + /// a value means contacts.contactsNotModified [TLDef(0xEAE87E42)] public class Contacts_Contacts : IObject { @@ -2825,7 +2825,7 @@ namespace TL public int count; } - /// Object contains a list of chats with messages and auxiliary data. Derived classes: , , See + /// Object contains a list of chats with messages and auxiliary data. See Derived classes: , , public abstract partial class Messages_DialogsBase : IObject, IPeerResolver { /// List of chats @@ -2872,7 +2872,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - /// Object contains information on list of messages with auxiliary data. Derived classes: , , , See + /// Object contains information on list of messages with auxiliary data. See Derived classes: , , , public abstract partial class Messages_MessagesBase : IObject, IPeerResolver { /// List of messages @@ -3002,8 +3002,8 @@ namespace TL public int offset; } - /// Object describes message filter. Derived classes: , , , , , , , , , , , , , , , See - /// a null value means inputMessagesFilterEmpty + /// Object describes message filter. See Derived classes: , , , , , , , , , , , , , , , + /// a value means inputMessagesFilterEmpty public abstract class MessagesFilter : IObject { } /// Filter for messages containing photos. See [TLDef(0x9609A51C)] @@ -3064,7 +3064,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -4303,7 +4303,7 @@ namespace TL public int unread_count; } - /// Occurred changes. Derived classes: , , , See + /// Occurred changes. See Derived classes: , , , public abstract partial class Updates_DifferenceBase : IObject, IPeerResolver { /// List of new messages @@ -4392,7 +4392,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => null; } - /// Object which is perceived by the client without a call on its part when an event occurs. Derived classes: , , , , , , See + /// Object which is perceived by the client without a call on its part when an event occurs. See Derived classes: , , , , , , public abstract partial class UpdatesBase : IObject, IPeerResolver { /// date @@ -4643,7 +4643,7 @@ namespace TL public Dictionary users; } - /// Contains info on file. Derived classes: , See + /// Contains info on file. See Derived classes: , public abstract class Upload_FileBase : IObject { } /// File content. See [TLDef(0x096A18D5)] @@ -4853,7 +4853,7 @@ namespace TL } /// An update is available for the application. See - /// a null value means help.noAppUpdate + /// a value means help.noAppUpdate [TLDef(0xCCBBCE30)] public class Help_AppUpdate : IObject { @@ -4895,7 +4895,7 @@ namespace TL public string message; } - /// Object contains info on an encrypted chat. Derived classes: , , , , See + /// Object contains info on an encrypted chat. See Derived classes: , , , , public abstract class EncryptedChatBase : IObject { /// Chat ID @@ -5011,7 +5011,7 @@ namespace TL } /// Encrypted file. See - /// a null value means encryptedFileEmpty + /// a value means encryptedFileEmpty [TLDef(0xA8008CD8)] public partial class EncryptedFile : IObject { @@ -5027,8 +5027,8 @@ namespace TL public int key_fingerprint; } - /// Object sets encrypted file for attachment Derived classes: , , See - /// a null value means inputEncryptedFileEmpty + /// Object sets encrypted file for attachment See Derived classes: , , + /// a value means inputEncryptedFileEmpty public abstract class InputEncryptedFileBase : IObject { /// Random file ID created by client @@ -5077,7 +5077,7 @@ namespace TL public override long ID => id; } - /// Object contains encrypted message. Derived classes: , See + /// Object contains encrypted message. See Derived classes: , public abstract class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message @@ -5136,7 +5136,7 @@ namespace TL public override byte[] Bytes => bytes; } - /// Contains Diffie-Hellman key generation protocol parameters. Derived classes: , See + /// Contains Diffie-Hellman key generation protocol parameters. See Derived classes: , public abstract class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] @@ -5175,7 +5175,7 @@ namespace TL } /// Defines a document for subsequent interaction. See - /// a null value means inputDocumentEmpty + /// a value means inputDocumentEmpty [TLDef(0x1ABFB575)] public partial class InputDocument : IObject { @@ -5187,7 +5187,7 @@ namespace TL public byte[] file_reference; } - /// A document. Derived classes: , See + /// A document. See Derived classes: , public abstract partial class DocumentBase : IObject { } /// Empty constructor, document doesn't exist. See [TLDef(0x36F8C871)] @@ -5242,7 +5242,7 @@ namespace TL public UserBase user; } - /// Object defines the set of users and/or groups that generate notifications. Derived classes: , , , See + /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , public abstract class NotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] @@ -5261,7 +5261,7 @@ namespace TL [TLDef(0xD612E8EF)] public class NotifyBroadcasts : NotifyPeerBase { } - /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. Derived classes: , , , , , , , , , , , , , , , , , See + /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -5416,7 +5416,7 @@ namespace TL VoiceMessages = 0x0697F414, } - /// Privacy rule Derived classes: , , , , , , , See + /// Privacy rule See Derived classes: , , , , , , , public abstract class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] @@ -5459,7 +5459,7 @@ namespace TL public long[] chats; } - /// Privacy rule Derived classes: , , , , , , , See + /// Privacy rule See Derived classes: , , , , , , , public abstract class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -5524,7 +5524,7 @@ namespace TL public int days; } - /// Various possible attributes of a document (used to define if it's a sticker, a GIF, a video, a mask sticker, an image, an audio, and so on) Derived classes: , , , , , , , See + /// Various possible attributes of a document (used to define if it's a sticker, a GIF, a video, a mask sticker, an image, an audio, and so on) See Derived classes: , , , , , , , public abstract class DocumentAttribute : IObject { } /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] @@ -5636,7 +5636,7 @@ namespace TL } /// Found stickers See - /// a null value means messages.stickersNotModified + /// a value means messages.stickersNotModified [TLDef(0x30A6EC7E)] public class Messages_Stickers : IObject { @@ -5657,7 +5657,7 @@ namespace TL } /// Info about all installed stickers See - /// a null value means messages.allStickersNotModified + /// a value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] public class Messages_AllStickers : IObject { @@ -5677,7 +5677,7 @@ namespace TL public int pts_count; } - /// Instant View webpage preview Derived classes: , , , See + /// Instant View webpage preview See Derived classes: , , , public abstract class WebPageBase : IObject { /// Preview ID @@ -5963,7 +5963,7 @@ namespace TL public int flags; } - /// Exported chat invite Derived classes: , See + /// Exported chat invite See Derived classes: , public abstract class ExportedChatInvite : IObject { } /// Exported chat invite See [TLDef(0x0AB4A819)] @@ -6016,7 +6016,7 @@ namespace TL [TLDef(0xED107AB7)] public class ChatInvitePublicJoinRequests : ExportedChatInvite { } - /// Chat invite Derived classes: , , See + /// Chat invite See Derived classes: , , public abstract class ChatInviteBase : IObject { } /// The user has already joined this chat See [TLDef(0x5A686D7C)] @@ -6070,8 +6070,8 @@ namespace TL public DateTime expires; } - /// Represents a stickerset Derived classes: , , , , , , , See - /// a null value means inputStickerSetEmpty + /// Represents a stickerset See Derived classes: , , , , , , , + /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See [TLDef(0x9DE7A269)] @@ -6165,7 +6165,7 @@ namespace TL } /// Stickerset and stickers inside it See - /// a null value means messages.stickerSetNotModified + /// a value means messages.stickerSetNotModified [TLDef(0xB60A24A6)] public class Messages_StickerSet : IObject { @@ -6223,7 +6223,7 @@ namespace TL } } - /// Bot or inline keyboard buttons Derived classes: , , , , , , , , , , , , , , See + /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , public abstract class KeyboardButtonBase : IObject { /// Button text @@ -6411,7 +6411,7 @@ namespace TL public KeyboardButtonBase[] buttons; } - /// Reply markup for bot and inline keyboards Derived classes: , , , See + /// Reply markup for bot and inline keyboards See Derived classes: , , , public abstract class ReplyMarkup : IObject { } /// Hide sent bot keyboard See [TLDef(0xA03E5B85)] @@ -6476,7 +6476,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message Derived classes: , , , , , , , , , , , , , , , , , , , , See + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , public abstract class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -6568,8 +6568,8 @@ namespace TL public long document_id; } - /// Represents a channel Derived classes: , See - /// a null value means inputChannelEmpty + /// Represents a channel See Derived classes: , + /// a value means inputChannelEmpty public abstract class InputChannelBase : IObject { /// Channel ID @@ -6626,7 +6626,7 @@ namespace TL public int max_id; } - /// Contains the difference (new messages) between our local channel state and the remote state Derived classes: , , See + /// Contains the difference (new messages) between our local channel state and the remote state See Derived classes: , , public abstract partial class Updates_ChannelDifferenceBase : IObject, IPeerResolver { /// returns a or for the given Peer @@ -6711,7 +6711,7 @@ namespace TL } /// Filter for getting only certain types of channel messages See - /// a null value means channelMessagesFilterEmpty + /// a value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] public class ChannelMessagesFilter : IObject { @@ -6727,7 +6727,7 @@ namespace TL } } - /// Channel participant Derived classes: , , , , , See + /// Channel participant See Derived classes: , , , , , public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] @@ -6834,7 +6834,7 @@ namespace TL public Peer peer; } - /// Filter for fetching channel participants Derived classes: , , , , , , , See + /// Filter for fetching channel participants See Derived classes: , , , , , , , public abstract class ChannelParticipantsFilter : IObject { } /// Fetch only recent participants See [TLDef(0xDE3F3C79)] @@ -6894,7 +6894,7 @@ namespace TL } /// Represents multiple channel participants See - /// a null value means channels.channelParticipantsNotModified + /// a value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] public class Channels_ChannelParticipants : IObject, IPeerResolver { @@ -6949,7 +6949,7 @@ namespace TL } /// Saved gifs See - /// a null value means messages.savedGifsNotModified + /// a value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] public class Messages_SavedGifs : IObject { @@ -6959,7 +6959,7 @@ namespace TL public DocumentBase[] gifs; } - /// Represents a sent inline message from the perspective of a bot Derived classes: , , , , , , See + /// Represents a sent inline message from the perspective of a bot See Derived classes: , , , , , , public abstract class InputBotInlineMessage : IObject { } /// A media See [TLDef(0x3380C786)] @@ -7131,7 +7131,7 @@ namespace TL } } - /// Inline bot result Derived classes: , , , See + /// Inline bot result See Derived classes: , , , public abstract class InputBotInlineResultBase : IObject { /// ID of result @@ -7248,7 +7248,7 @@ namespace TL public override InputBotInlineMessage SendMessage => send_message; } - /// Inline message Derived classes: , , , , , See + /// Inline message See Derived classes: , , , , , public abstract class BotInlineMessage : IObject { } /// Send whatever media is attached to the See [TLDef(0x764CF810)] @@ -7405,7 +7405,7 @@ namespace TL } } - /// Results of an inline query Derived classes: , See + /// Results of an inline query See Derived classes: , public abstract class BotInlineResultBase : IObject { /// Result ID @@ -7607,7 +7607,7 @@ namespace TL MissedCall = 0xD61AD6EE, } - /// Type of the verification code that was sent Derived classes: , , , , , , See + /// Type of the verification code that was sent See Derived classes: , , , , , , public abstract class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] @@ -7725,7 +7725,7 @@ namespace TL } } - /// Represents a sent inline message from the perspective of a bot Derived classes: , See + /// Represents a sent inline message from the perspective of a bot See Derived classes: , public abstract class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message @@ -7839,8 +7839,8 @@ namespace TL public TopPeer[] peers; } - /// Top peers Derived classes: , See - /// a null value means contacts.topPeersNotModified + /// Top peers See Derived classes: , + /// a value means contacts.topPeersNotModified public abstract class Contacts_TopPeersBase : IObject { } /// Top peers See [TLDef(0x70B772A8)] @@ -7859,7 +7859,7 @@ namespace TL [TLDef(0xB52C939D)] public class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } - /// Represents a message draft. Derived classes: , See + /// Represents a message draft. See Derived classes: , public abstract class DraftMessageBase : IObject { } /// Empty draft See [TLDef(0x1B0C841A)] @@ -7902,7 +7902,7 @@ namespace TL } } - /// Featured stickers Derived classes: , See + /// Featured stickers See Derived classes: , public abstract class Messages_FeaturedStickersBase : IObject { } /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] @@ -7934,7 +7934,7 @@ namespace TL } /// Recently used stickers See - /// a null value means messages.recentStickersNotModified + /// a value means messages.recentStickersNotModified [TLDef(0x88D37C56)] public class Messages_RecentStickers : IObject { @@ -7958,7 +7958,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Result of stickerset installation process Derived classes: , See + /// Result of stickerset installation process See Derived classes: , public abstract class Messages_StickerSetInstallResult : IObject { } /// The stickerset was installed successfully See [TLDef(0x38641628)] @@ -7971,7 +7971,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Stickerset preview Derived classes: , , See + /// Stickerset preview See Derived classes: , , public abstract class StickerSetCoveredBase : IObject { /// Stickerset @@ -8030,7 +8030,7 @@ namespace TL public double zoom; } - /// Represents a media with attached stickers Derived classes: , See + /// Represents a media with attached stickers See Derived classes: , public abstract class InputStickeredMedia : IObject { } /// A photo with stickers attached See [TLDef(0x4A992157)] @@ -8075,7 +8075,7 @@ namespace TL } } - /// A game to send Derived classes: , See + /// A game to send See Derived classes: , public abstract class InputGame : IObject { } /// Indicates an already sent game See [TLDef(0x032C3E77)] @@ -8118,8 +8118,8 @@ namespace TL public Dictionary users; } - /// Rich text Derived classes: , , , , , , , , , , , , , , See - /// a null value means textEmpty + /// Rich text See Derived classes: , , , , , , , , , , , , , , + /// a value means textEmpty public abstract class RichText : IObject { } /// Plain text See [TLDef(0x744694E0)] @@ -8241,7 +8241,7 @@ namespace TL public string name; } - /// Represents an instant view page element Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Represents an instant view page element See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class PageBlock : IObject { } /// Unsupported IV element See [TLDef(0x13567E8A)] @@ -8680,7 +8680,7 @@ namespace TL } } - /// Saved payment credentials Derived classes: See + /// Saved payment credentials See Derived classes: public abstract class PaymentSavedCredentials : IObject { } /// Saved credit card See [TLDef(0xCDC27A1F)] @@ -8692,7 +8692,7 @@ namespace TL public string title; } - /// Remote document Derived classes: , See + /// Remote document See Derived classes: , public abstract class WebDocumentBase : IObject { /// Document URL @@ -8765,7 +8765,7 @@ namespace TL public DocumentAttribute[] attributes; } - /// Location of remote file Derived classes: , , See + /// Location of remote file See Derived classes: , , public abstract class InputWebFileLocationBase : IObject { } /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] @@ -8907,7 +8907,7 @@ namespace TL } } - /// Payment result Derived classes: , See + /// Payment result See Derived classes: , public abstract class Payments_PaymentResultBase : IObject { } /// Payment result See [TLDef(0x4E5F810D)] @@ -8990,7 +8990,7 @@ namespace TL } } - /// Payment credentials Derived classes: , , , See + /// Payment credentials See Derived classes: , , , public abstract class InputPaymentCredentialsBase : IObject { } /// Saved payment credentials See [TLDef(0xC10EB2CF)] @@ -9083,7 +9083,7 @@ namespace TL public long access_hash; } - /// Phone call Derived classes: , , , , , See + /// Phone call See Derived classes: , , , , , public abstract class PhoneCallBase : IObject { /// Call ID @@ -9260,7 +9260,7 @@ namespace TL public override long ID => id; } - /// Phone call connection Derived classes: , See + /// Phone call connection See Derived classes: , public abstract class PhoneConnectionBase : IObject { /// Endpoint ID @@ -9373,7 +9373,7 @@ namespace TL public Dictionary users; } - /// Represents the download status of a CDN file Derived classes: , See + /// Represents the download status of a CDN file See Derived classes: , public abstract class Upload_CdnFileBase : IObject { } /// The file was cleared from the temporary RAM cache of the CDN and has to be re-uploaded. See [TLDef(0xEEA8E46E)] @@ -9408,7 +9408,7 @@ namespace TL public CdnPublicKey[] public_keys; } - /// Language pack string Derived classes: , , See + /// Language pack string See Derived classes: , , public abstract class LangPackStringBase : IObject { /// Language key @@ -9525,7 +9525,7 @@ namespace TL } } - /// Channel admin log event Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , See + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -9889,7 +9889,7 @@ namespace TL } /// Favorited stickers See - /// a null value means messages.favedStickersNotModified + /// a value means messages.favedStickersNotModified [TLDef(0x2CB51097)] public class Messages_FavedStickers : IObject { @@ -9901,7 +9901,7 @@ namespace TL public DocumentBase[] stickers; } - /// Recent t.me urls Derived classes: , , , , See + /// Recent t.me urls See Derived classes: , , , , public abstract class RecentMeUrl : IObject { /// URL @@ -10009,7 +10009,7 @@ namespace TL public Dictionary users; } - /// A message Derived classes: , , , See + /// A message See Derived classes: , , , public abstract partial class InputMessage : IObject { } /// Message by ID See [TLDef(0xA676A322)] @@ -10038,7 +10038,7 @@ namespace TL public long query_id; } - /// Peer, or all peers in a certain folder Derived classes: , See + /// Peer, or all peers in a certain folder See Derived classes: , public abstract partial class InputDialogPeerBase : IObject { } /// A peer See [TLDef(0xFCAAFEB7)] @@ -10055,7 +10055,7 @@ namespace TL public int folder_id; } - /// Peer, or all peers in a folder Derived classes: , See + /// Peer, or all peers in a folder See Derived classes: , public abstract class DialogPeerBase : IObject { } /// Peer See [TLDef(0xE56DBF05)] @@ -10073,7 +10073,7 @@ namespace TL } /// Found stickersets See - /// a null value means messages.foundStickerSetsNotModified + /// a value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] public class Messages_FoundStickerSets : IObject { @@ -10105,7 +10105,7 @@ namespace TL public int port; } - /// Update of Telegram's terms of service Derived classes: , See + /// Update of Telegram's terms of service See Derived classes: , public abstract class Help_TermsOfServiceUpdateBase : IObject { } /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] @@ -10124,7 +10124,7 @@ namespace TL public Help_TermsOfService terms_of_service; } - /// Secure passport file, for more info see the passport docs » Derived classes: , See + /// Secure passport file, for more info see the passport docs » See Derived classes: , public abstract class InputSecureFileBase : IObject { /// Secure file ID @@ -10162,7 +10162,7 @@ namespace TL } /// Secure passport file, for more info see the passport docs » See - /// a null value means secureFileEmpty + /// a value means secureFileEmpty [TLDef(0x7D09C27E)] public partial class SecureFile : IObject { @@ -10194,7 +10194,7 @@ namespace TL public byte[] secret; } - /// Plaintext verified passport data. Derived classes: , See + /// Plaintext verified passport data. See Derived classes: , public abstract class SecurePlainData : IObject { } /// Phone number to use in telegram passport: it must be verified, first ». See [TLDef(0x7D6099DD)] @@ -10338,7 +10338,7 @@ namespace TL public byte[] hash; } - /// Secure value error Derived classes: , , , , , , , , See + /// Secure value error See Derived classes: , , , , , , , , public abstract class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , @@ -10518,7 +10518,7 @@ namespace TL } /// Deep link info, see the here for more details See - /// a null value means help.deepLinkInfoEmpty + /// a value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] public class Help_DeepLinkInfo : IObject { @@ -10538,7 +10538,7 @@ namespace TL } } - /// Saved contact Derived classes: See + /// Saved contact See Derived classes: public abstract class SavedContact : IObject { } /// Saved contact See [TLDef(0x1142BD56)] @@ -10562,8 +10562,8 @@ namespace TL public long id; } - /// Key derivation function to use when generating the password hash for SRP two-factor authorization Derived classes: See - /// a null value means passwordKdfAlgoUnknown + /// Key derivation function to use when generating the password hash for SRP two-factor authorization See Derived classes: + /// a value means passwordKdfAlgoUnknown public abstract class PasswordKdfAlgo : IObject { } /// This key derivation algorithm defines that SRP 2FA login must be used See [TLDef(0x3A912D4A)] @@ -10579,8 +10579,8 @@ namespace TL public byte[] p; } - /// KDF algorithm to use for computing telegram passport hash Derived classes: , See - /// a null value means securePasswordKdfAlgoUnknown + /// KDF algorithm to use for computing telegram passport hash See Derived classes: , + /// a value means securePasswordKdfAlgoUnknown public abstract class SecurePasswordKdfAlgo : IObject { /// Salt @@ -10606,7 +10606,7 @@ namespace TL } /// Constructor for checking the validity of a 2FA SRP password (see SRP) See - /// a null value means inputCheckPasswordEmpty + /// a value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] public class InputCheckPasswordSRP : IObject { @@ -10618,7 +10618,7 @@ namespace TL public byte[] M1; } - /// Required secure file type Derived classes: , See + /// Required secure file type See Derived classes: , public abstract class SecureRequiredTypeBase : IObject { } /// Required type See [TLDef(0x829D99DA)] @@ -10648,7 +10648,7 @@ namespace TL } /// Telegram passport configuration See - /// a null value means help.passportConfigNotModified + /// a value means help.passportConfigNotModified [TLDef(0xA098D6AF)] public class Help_PassportConfig : IObject { @@ -10682,7 +10682,7 @@ namespace TL public JSONValue value; } - /// JSON value Derived classes: , , , , , See + /// JSON value See Derived classes: , , , , , public abstract partial class JSONValue : IObject { } /// null JSON value See [TLDef(0x3F6D7B68)] @@ -10775,7 +10775,7 @@ namespace TL public RichText credit; } - /// Item in block list Derived classes: , See + /// Item in block list See Derived classes: , public abstract class PageListItem : IObject { } /// List item See [TLDef(0xB92FB6CD)] @@ -10792,7 +10792,7 @@ namespace TL public PageBlock[] blocks; } - /// Represents an instant view ordered list Derived classes: , See + /// Represents an instant view ordered list See Derived classes: , public abstract class PageListOrderedItem : IObject { /// Number of element within ordered list @@ -10888,7 +10888,7 @@ namespace TL } /// Internal use See - /// a null value means help.userInfoEmpty + /// a value means help.userInfoEmpty [TLDef(0x01EB3758)] public class Help_UserInfo : IObject { @@ -11086,7 +11086,7 @@ namespace TL } } - /// Wallpaper Derived classes: , , See + /// Wallpaper See Derived classes: , , public abstract class InputWallPaperBase : IObject { } /// Wallpaper See [TLDef(0xE630B979)] @@ -11113,7 +11113,7 @@ namespace TL } /// Installed wallpapers See - /// a null value means account.wallPapersNotModified + /// a value means account.wallPapersNotModified [TLDef(0xCDC3858C)] public class Account_WallPapers : IObject { @@ -11332,8 +11332,8 @@ namespace TL } } - /// URL authorization result Derived classes: , See - /// a null value means urlAuthResultDefault + /// URL authorization result See Derived classes: , + /// a value means urlAuthResultDefault public abstract class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] @@ -11361,7 +11361,7 @@ namespace TL } /// Geographical location of supergroup (geogroups) See - /// a null value means channelLocationEmpty + /// a value means channelLocationEmpty [TLDef(0x209B82DB)] public class ChannelLocation : IObject { @@ -11371,7 +11371,7 @@ namespace TL public string address; } - /// Geolocated peer Derived classes: , See + /// Geolocated peer See Derived classes: , public abstract class PeerLocatedBase : IObject { /// Validity period of current data @@ -11414,7 +11414,7 @@ namespace TL public string text; } - /// Cloud theme Derived classes: , See + /// Cloud theme See Derived classes: , public abstract class InputThemeBase : IObject { } /// Theme See [TLDef(0x3C5693E9)] @@ -11476,7 +11476,7 @@ namespace TL } /// Installed themes See - /// a null value means account.themesNotModified + /// a value means account.themesNotModified [TLDef(0x9A3D8C6D)] public class Account_Themes : IObject { @@ -11486,7 +11486,7 @@ namespace TL public Theme[] themes; } - /// Login token (for QR code login) Derived classes: , , See + /// Login token (for QR code login) See Derived classes: , , public abstract class Auth_LoginTokenBase : IObject { } /// Login token (for QR code login) See [TLDef(0x629F1980)] @@ -11621,7 +11621,7 @@ namespace TL } } - /// Webpage attributes Derived classes: See + /// Webpage attributes See Derived classes: public abstract class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -11643,7 +11643,7 @@ namespace TL } } - /// How a user voted in a poll Derived classes: , , See + /// How a user voted in a poll See Derived classes: , , public abstract class MessageUserVoteBase : IObject { /// User ID @@ -11741,7 +11741,7 @@ namespace TL } /// Dialog filter AKA folder See - /// a null value means dialogFilterDefault + /// a value means dialogFilterDefault [TLDef(0x7438F7E8)] public class DialogFilter : IObject { @@ -11823,7 +11823,7 @@ namespace TL public double total; } - /// Channel statistics graph Derived classes: , , See + /// Channel statistics graph See Derived classes: , , public abstract class StatsGraphBase : IObject { } /// This channel statistics graph must be generated asynchronously using stats.loadAsyncGraph to reduce server load See [TLDef(0x4A27EB2D)] @@ -11905,7 +11905,7 @@ namespace TL public MessageInteractionCounters[] recent_message_interactions; } - /// Info about pinned MTProxy or Public Service Announcement peers. Derived classes: , See + /// Info about pinned MTProxy or Public Service Announcement peers. See Derived classes: , public abstract class Help_PromoDataBase : IObject { } /// No PSA/MTProxy info is available See [TLDef(0x98F6AC75)] @@ -12109,7 +12109,7 @@ namespace TL } /// Name, ISO code, localized name and phone codes/patterns of all available countries See - /// a null value means help.countriesListNotModified + /// a value means help.countriesListNotModified [TLDef(0x87D0759E)] public class Help_CountriesList : IObject { @@ -12264,7 +12264,7 @@ namespace TL public StatsGraphBase views_graph; } - /// A group call Derived classes: , See + /// A group call See Derived classes: , public abstract class GroupCallBase : IObject { /// Group call ID @@ -12556,7 +12556,7 @@ namespace TL public Dictionary users; } - /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. Derived classes: , See + /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. See Derived classes: , public abstract class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite @@ -12699,8 +12699,8 @@ namespace TL public string short_name; } - /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. Derived classes: , , , , , See - /// a null value means botCommandScopeDefault + /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. See Derived classes: , , , , , + /// a value means botCommandScopeDefault public abstract class BotCommandScope : IObject { } /// The specified bot commands will only be valid in all private chats with users. See [TLDef(0x3C4F04D8)] @@ -12729,7 +12729,7 @@ namespace TL public InputUserBase user_id; } - /// Result of an account.resetPassword request. Derived classes: , , See + /// Result of an account.resetPassword request. See Derived classes: , , public abstract class Account_ResetPasswordResult : IObject { } /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset. See [TLDef(0xE3779861)] @@ -12851,7 +12851,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Information about a message in a specific position Derived classes: See + /// Information about a message in a specific position See Derived classes: public abstract class SearchResultsPosition : IObject { } /// Information about a message in a specific position See [TLDef(0x7F648B67)] @@ -13038,7 +13038,7 @@ namespace TL } /// Animations and metadata associated with message reactions » See - /// a null value means messages.availableReactionsNotModified + /// a value means messages.availableReactionsNotModified [TLDef(0x768E3AAD)] public class Messages_AvailableReactions : IObject { @@ -13048,7 +13048,7 @@ namespace TL public AvailableReaction[] reactions; } - /// Translated text, or no result Derived classes: , See + /// Translated text, or no result See Derived classes: , public abstract class Messages_TranslatedText : IObject { } /// No translation is available See [TLDef(0x67CA4737)] @@ -13166,7 +13166,7 @@ namespace TL } /// Represents a list of bot web apps that can be launched from the attachment menu » See - /// a null value means attachMenuBotsNotModified + /// a value means attachMenuBotsNotModified [TLDef(0x3C4301C0)] public class AttachMenuBots : IObject { @@ -13188,7 +13188,7 @@ namespace TL public Dictionary users; } - /// Contains the webview URL with appropriate theme and user info parameters added Derived classes: See + /// Contains the webview URL with appropriate theme and user info parameters added See Derived classes: public abstract class WebViewResult : IObject { } /// Contains the webview URL with appropriate theme and user info parameters added See [TLDef(0x0C14557C)] @@ -13200,7 +13200,7 @@ namespace TL public string url; } - /// Contains the webview URL with appropriate theme parameters added Derived classes: See + /// Contains the webview URL with appropriate theme parameters added See Derived classes: public abstract class SimpleWebViewResult : IObject { } /// Contains the webview URL with appropriate theme parameters added See [TLDef(0x882F76BB)] @@ -13226,8 +13226,8 @@ namespace TL } } - /// Indicates the action to execute when pressing the in-UI menu button for bots Derived classes: , See - /// a null value means botMenuButtonDefault + /// Indicates the action to execute when pressing the in-UI menu button for bots See Derived classes: , + /// a value means botMenuButtonDefault public abstract class BotMenuButtonBase : IObject { } /// Bot menu button that opens the bot command list when clicked. See [TLDef(0x4258C205)] @@ -13243,7 +13243,7 @@ namespace TL } /// A list of saved notification sounds See - /// a null value means account.savedRingtonesNotModified + /// a value means account.savedRingtonesNotModified [TLDef(0xC1E92CC5)] public class Account_SavedRingtones : IObject { @@ -13253,8 +13253,8 @@ namespace TL public DocumentBase[] ringtones; } - /// Represents a notification sound Derived classes: , , See - /// a null value means notificationSoundDefault + /// Represents a notification sound See Derived classes: , , + /// a value means notificationSoundDefault public abstract class NotificationSound : IObject { } /// No notification sound should be used See [TLDef(0x6F0C34DF)] @@ -13302,7 +13302,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice Derived classes: , See + /// An invoice See Derived classes: , public abstract class InputInvoice : IObject { } /// An invoice contained in a message. See [TLDef(0xC5B56859)] @@ -13365,7 +13365,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase Derived classes: , See + /// Info about a Telegram Premium purchase See Derived classes: , public abstract class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -13427,7 +13427,7 @@ namespace TL } /// An emoji status See - /// a null value means emojiStatusEmpty + /// a value means emojiStatusEmpty [TLDef(0x929B619D)] public class EmojiStatus : IObject { @@ -13443,7 +13443,7 @@ namespace TL } /// A list of emoji statuses See - /// a null value means account.emojiStatusesNotModified + /// a value means account.emojiStatusesNotModified [TLDef(0x90C467D1)] public class Account_EmojiStatuses : IObject { @@ -13453,8 +13453,8 @@ namespace TL public EmojiStatus[] statuses; } - /// Message reaction Derived classes: , See - /// a null value means reactionEmpty + /// Message reaction See Derived classes: , + /// a value means reactionEmpty public abstract class Reaction : IObject { } /// Normal emoji message reaction See [TLDef(0x1B2286B8)] @@ -13471,8 +13471,8 @@ namespace TL public long document_id; } - /// Available chat reactions Derived classes: , See - /// a null value means chatReactionsNone + /// Available chat reactions See Derived classes: , + /// a value means chatReactionsNone public abstract class ChatReactions : IObject { } /// All reactions or all non-custom reactions are allowed See [TLDef(0x52928BCA)] @@ -13496,7 +13496,7 @@ namespace TL } /// List of message reactions See - /// a null value means messages.reactionsNotModified + /// a value means messages.reactionsNotModified [TLDef(0xEAFDF716)] public class Messages_Reactions : IObject { @@ -13506,7 +13506,7 @@ namespace TL public Reaction[] reactions; } - /// Email verification purpose Derived classes: , , See + /// Email verification purpose See Derived classes: , , public abstract class EmailVerifyPurpose : IObject { } /// Email verification purpose: setup login email See [TLDef(0x4345BE73)] @@ -13524,7 +13524,7 @@ namespace TL [TLDef(0xBBF51685)] public class EmailVerifyPurposePassport : EmailVerifyPurpose { } - /// Email verification code or token Derived classes: , , See + /// Email verification code or token See Derived classes: , , public abstract class EmailVerification : IObject { } /// Email verification code See [TLDef(0x922E55A9)] diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 125f06b..8c810c8 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -28,7 +28,7 @@ namespace TL } /// Object describes media contents of an encrypted message. See - /// a null value means decryptedMessageMediaEmpty + /// a value means decryptedMessageMediaEmpty public abstract class DecryptedMessageMedia : IObject { public virtual string MimeType { get; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 0ae1e3c..3682f20 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -1078,7 +1078,6 @@ namespace TL [0x36B091DE] = typeof(Layer45.DecryptedMessage), [0x204D3878] = typeof(Layer17.DecryptedMessage), [0x1F814F1F] = typeof(Layer8.DecryptedMessage), - // The End }; internal readonly static Dictionary Nullables = new() @@ -1143,7 +1142,6 @@ namespace TL [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty - // The End }; } } From d64c5c0c1e57e57a03149e3af3cd092489e9387f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 26 Oct 2022 17:33:06 +0200 Subject: [PATCH 007/336] closes #103: files incorrectly padded to nearest 16 bytes --- EXAMPLES.md | 2 +- src/Client.Helpers.cs | 2 +- src/Encryption.cs | 5 +++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index eb91e4b..e57d7fb 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -177,7 +177,7 @@ var uploadedFile = await client.UploadFileAsync(@"C:\Pictures\flower.jpg"); // Photo 3 specified by external url: const string photoUrl = "https://picsum.photos/310/200.jpg"; -var inputMedias = new InputMedia[] +var inputMedias = new List { photoFromTelegram, // PhotoBase has implicit conversion to InputMediaPhoto new InputMediaUploadedPhoto { file = uploadedFile }, diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 980d9f1..b809f94 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -86,7 +86,7 @@ namespace WTelegram bool abort = false; for (long bytesLeft = length; !abort && bytesLeft != 0; file_part++) { - var bytes = new byte[(Math.Min(FilePartSize, bytesLeft) + 15) & ~15]; + var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; read = await stream.FullReadAsync(bytes, bytes.Length, default); await _parallelTransfers.WaitAsync(); bytesLeft -= read; diff --git a/src/Encryption.cs b/src/Encryption.cs index 72bf6fe..450e35f 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -539,6 +539,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB else { prevBytes = new byte[32]; Array.Copy(iv, 0, prevBytes, 16, 16); Array.Copy(iv, 16, prevBytes, 0, 16); } } + public override long Length => base.Length + 15 & ~15; public override bool CanSeek => false; public override long Seek(long offset, SeekOrigin origin) => throw new NotSupportedException(); @@ -549,7 +550,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB Process(buffer, offset, count); if (ContentLength.HasValue && _innerStream.Position == _innerStream.Length) return count - (int)(_innerStream.Position - ContentLength.Value); - return count; + return count + 15 & ~15; } public override void Write(byte[] buffer, int offset, int count) @@ -562,7 +563,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB public void Process(byte[] buffer, int offset, int count) { - count = (count + 15) & ~15; + count = count + 15 & ~15; var span = MemoryMarshal.Cast(buffer.AsSpan(offset, count)); var prev = MemoryMarshal.Cast(prevBytes); for (offset = 0, count /= 8; offset < count;) From b902b33558228f90a7b2cb2db1feeca2903b0b1c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 1 Nov 2022 18:44:01 +0100 Subject: [PATCH 008/336] updated docs (and reordered Examples.md) --- EXAMPLES.md | 484 +++++++++++++++++++++--------------------- README.md | 2 +- src/Client.cs | 37 ++-- src/TL.Schema.cs | 22 +- src/TL.SchemaFuncs.cs | 4 +- src/TL.Secret.cs | 4 +- 6 files changed, 277 insertions(+), 276 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index e57d7fb..59bf859 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -21,6 +21,29 @@ and avoid calling the same methods (like `Messages_GetAllChats`) repetitively. ℹ️ WTelegramClient covers 100% of Telegram Client API, much more than the examples below: check the [full API methods list](https://corefork.telegram.org/methods)! More examples can also be found in the [Examples folder](Examples) and in answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). + +### Change logging settings +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 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}"); + +// • 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) => { }; +``` + +The `lvl` argument correspond to standard [LogLevel values](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel#fields) + ### Send a message to someone by @username ```csharp @@ -30,15 +53,6 @@ await client.SendMessageAsync(resolved, "/start"); *Note: This also works if the @username points to a channel/group, but you must already have joined that channel before sending a message to it. If the username is invalid/unused, the API call raises an RpcException.* - -### Send a message to someone by phone number -```csharp -var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); -if (contacts.imported.Length > 0) - await client.SendMessageAsync(contacts.users[contacts.imported[0].user_id], "Hello!"); -``` -*Note: To prevent spam, Telegram may restrict your ability to add new phone numbers.* - ### Convert message to/from HTML or Markdown, and send it to ourself (Saved Messages) @@ -63,6 +77,196 @@ text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities); See [HTML formatting style](https://core.telegram.org/bots/api/#html-style) and [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. *Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))* + +### List all dialogs (chats/groups/channels/user chat) we are currently in +```csharp +var dialogs = await client.Messages_GetAllDialogs(); +foreach (Dialog dialog in dialogs.dialogs) +{ + switch (dialogs.UserOrChat(dialog)) + { + case User user when user.IsActive: Console.WriteLine("User " + user); break; + case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; + } + //var latestMsg = dialogs.messages.FirstOrDefault(m => m.Peer.ID == dialog.Peer.ID && m.ID == dialog.TopMessage); +} +``` + +*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.* +See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + + +### List all chats (groups/channels NOT users) that we joined and send a message to one +```csharp +var chats = await client.Messages_GetAllChats(); +foreach (var (id, chat) in chats.chats) + if (chat.IsActive) + Console.WriteLine($"{id} : {chat}"); +Console.Write("Choose a chat ID to send a message to: "); +long chatId = long.Parse(Console.ReadLine()); +await client.SendMessageAsync(chats.chats[chatId], "Hello, World"); +``` +Notes: +- This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs). +- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this. +- If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, +but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). +- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) + + +### List the members from a chat +For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))* +```csharp +var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want +foreach (var (id, user) in chatFull.users) + Console.WriteLine(user); +``` + +For a Channel/Group: +```csharp +var chats = await client.Messages_GetAllChats(); +var channel = (Channel)chats.chats[1234567890]; // the channel we want +for (int offset = 0; ;) +{ + var participants = await client.Channels_GetParticipants(channel, null, offset); + foreach (var (id, user) in participants.users) + Console.WriteLine(user); + offset += participants.participants.Length; + if (offset >= participants.count || participants.participants.Length == 0) break; +} +``` + +For big Channel/Group, Telegram servers might limit the number of members you can obtain with the normal above method. +In this case, you can use the following helper method, but it can take several minutes to complete: +```csharp +var chats = await client.Messages_GetAllChats(); +var channel = (Channel)chats.chats[1234567890]; // the channel we want +var participants = await client.Channels_GetAllParticipants(channel); +``` + +You can use specific filters, for example to list only the channel owner/admins: +```csharp +var participants = await client.Channels_GetParticipants(channel, filter: new ChannelParticipantsAdmins()); +foreach (var participant in participants.participants) // This is the correct way to enumerate the result +{ + var user = participants.users[participant.UserID]; + if (participant is ChannelParticipantCreator cpc) Console.WriteLine($"{user} is the owner '{cpc.rank}'"); + else if (participant is ChannelParticipantAdmin cpa) Console.WriteLine($"{user} is admin '{cpa.rank}'"); +} +``` +*Note: It is not possible to list only the Deleted Accounts. Those will be automatically removed by Telegram from your group after a while* + + +### Fetch all messages (history) from a chat +```csharp +var chats = await client.Messages_GetAllChats(); +InputPeer peer = chats.chats[1234567890]; // the chat we want +for (int offset_id = 0; ;) +{ + var messages = await client.Messages_GetHistory(peer, offset_id); + if (messages.Messages.Length == 0) break; + foreach (var msgBase in messages.Messages) + { + var from = messages.UserOrChat(msgBase.From ?? msgBase.Peer); // from can be User/Chat/Channel + if (msgBase is Message msg) + Console.WriteLine($"{from}> {msg.message} {msg.media}"); + else if (msgBase is MessageService ms) + Console.WriteLine($"{from} [{ms.action.GetType().Name[13..]}]"); + } + offset_id = messages.Messages[^1].ID; +} +``` +Notes: +- To stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id` +- To mark the message history as read, use: `await client.ReadHistory(peer);` + + +### Monitor all Telegram events happening for the user + +This is done through the `client.OnUpdate` callback event. +Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. + +See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + + +### Monitor new messages being posted in chats in real-time + +You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. + +See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). + +You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. + + +### Downloading photos, medias, files + +This is done using the helper method `client.DownloadFileAsync(file, outputStream)` +that simplifies the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. + +See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs) that download all media files you forward to yourself (Saved Messages) + + +### Upload a media file and post it with caption to a chat +```csharp +const int ChatId = 1234567890; // the chat we want +const string Filepath = @"C:\...\photo.jpg"; + +var chats = await client.Messages_GetAllChats(); +InputPeer peer = chats.chats[ChatId]; +var inputFile = await client.UploadFileAsync(Filepath); +await client.SendMediaAsync(peer, "Here is the photo", inputFile); +``` + + +### Send a grouped media album using photos from various sources +```csharp +// Photo 1 already on Telegram: latest photo found in the user's Saved Messages +var history = await client.Messages_GetHistory(InputPeer.Self); +PhotoBase photoFromTelegram = history.Messages.OfType().Select(m => m.media).OfType().First().photo; +// Photo 2 uploaded now from our computer: +var uploadedFile = await client.UploadFileAsync(@"C:\Pictures\flower.jpg"); +// Photo 3 specified by external url: +const string photoUrl = "https://picsum.photos/310/200.jpg"; + +var inputMedias = new List +{ + photoFromTelegram, // PhotoBase has implicit conversion to InputMediaPhoto + new InputMediaUploadedPhoto { file = uploadedFile }, + new InputMediaPhotoExternal() { url = photoUrl }, +}; +await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); +``` +*Note: Don't mix Photos and file Documents in your album, it doesn't work well* + + +### Forward or copy a message to another chat +```csharp +// Determine which chats and message to forward/copy +var chats = await client.Messages_GetAllChats(); +var from_chat = chats.chats[1234567890]; // source chat +var to_chat = chats.chats[1234567891]; // destination chat +var history = await client.Messages_GetHistory(from_chat, limit: 1); +var msg = history.Messages[0] as Message; // last message of source chat + +// • Forward the message (only the source message id is necessary) +await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat); + +// • Copy the message without the "Forwarded" header (only the source message id is necessary) +await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat, drop_author: true); + +// • Alternative solution to copy the message (the full message is needed) +await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), entities: msg.entities); +``` + + +### Schedule a message to be sent to a chat +```csharp +var chats = await client.Messages_GetAllChats(); +InputPeer peer = chats.chats[1234567890]; // the chat we want +DateTime when = DateTime.UtcNow.AddMinutes(3); +await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule_date: when); +``` + ### Fun with stickers, GIFs, dice, and animated emojies ```csharp @@ -112,123 +316,41 @@ var typing = await client.Messages_SetTyping(InputPeer.Self, new SendMessageEmoj await Task.Delay(5000); ``` - -### List all chats (groups/channels NOT users) that we joined and send a message to one + +### Fun with custom emojies and reactions on pinned messages ```csharp -var chats = await client.Messages_GetAllChats(); -foreach (var (id, chat) in chats.chats) - if (chat.IsActive) - Console.WriteLine($"{id} : {chat}"); -Console.Write("Choose a chat ID to send a message to: "); -long chatId = long.Parse(Console.ReadLine()); -await client.SendMessageAsync(chats.chats[chatId], "Hello, World"); -``` -Notes: -- This list does not include discussions with other users. For this, you need to use [Messages_GetAllDialogs](#list-dialogs). -- The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this. -- If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, -but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). -- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) +// • Sending a message with custom emojies in Markdown to ourself: +var text = "Vicksy says Hi! [👋](emoji?id=5190875290439525089)"; +var entities = client.MarkdownToEntities(ref text, premium: true); +await client.SendMessageAsync(InputPeer.Self, text, entities: entities); +// also available in HTML: 👋 - -### List all dialogs (chats/groups/channels/user chat) we are currently in -```csharp -var dialogs = await client.Messages_GetAllDialogs(); -foreach (Dialog dialog in dialogs.dialogs) - switch (dialogs.UserOrChat(dialog)) - { - case User user when user.IsActive: Console.WriteLine("User " + user); break; - case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; - } -``` - -*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.* -See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). - - -### Schedule a message to be sent to a chat -```csharp -var chats = await client.Messages_GetAllChats(); -InputPeer peer = chats.chats[1234567890]; // the chat we want -DateTime when = DateTime.UtcNow.AddMinutes(3); -await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule_date: when); -``` - - -### Upload a media file and post it with caption to a chat -```csharp -const int ChatId = 1234567890; // the chat we want -const string Filepath = @"C:\...\photo.jpg"; +// • Fetch all available standard emoji reactions +var all_emoji = await client.Messages_GetAvailableReactions(); var chats = await client.Messages_GetAllChats(); -InputPeer peer = chats.chats[ChatId]; -var inputFile = await client.UploadFileAsync(Filepath); -await client.SendMediaAsync(peer, "Here is the photo", inputFile); -``` +var chat = chats.chats[1234567890]; // the chat we want - -### Send a grouped media album using photos from various sources -```csharp -// Photo 1 already on Telegram: latest photo found in the user's Saved Messages -var history = await client.Messages_GetHistory(InputPeer.Self); -PhotoBase photoFromTelegram = history.Messages.OfType().Select(m => m.media).OfType().First().photo; -// Photo 2 uploaded now from our computer: -var uploadedFile = await client.UploadFileAsync(@"C:\Pictures\flower.jpg"); -// Photo 3 specified by external url: -const string photoUrl = "https://picsum.photos/310/200.jpg"; - -var inputMedias = new List +// • Check reactions available in this chat +var full = await client.GetFullChat(chat); +Reaction reaction = full.full_chat.AvailableReactions switch { - photoFromTelegram, // PhotoBase has implicit conversion to InputMediaPhoto - new InputMediaUploadedPhoto { file = uploadedFile }, - new InputMediaPhotoExternal() { url = photoUrl }, + ChatReactionsSome some => some.reactions[0], // only some reactions are allowed => pick the first + ChatReactionsAll all => // all reactions are allowed in this chat + all.flags.HasFlag(ChatReactionsAll.Flags.allow_custom) && client.User.flags.HasFlag(TL.User.Flags.premium) + ? new ReactionCustomEmoji { document_id = 5190875290439525089 } // we can use custom emoji reactions here + : new ReactionEmoji { emoticon = all_emoji.reactions[0].reaction }, // else, pick the first standard emoji reaction + _ => null // reactions are not allowed in this chat }; -await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); -``` -*Note: Don't mix Photos and file Documents in your album, it doesn't work well* +if (reaction == null) return; - -### Get all members from a chat -For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))* -```csharp -var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want -foreach (var (id, user) in chatFull.users) - Console.WriteLine(user); +// • Send the selected reaction on the last 2 pinned messages +var messages = await client.Messages_Search(chat, limit: 2); +foreach (var msg in messages.Messages) + await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); ``` +*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers) or inspecting incoming messages. Access hash is not required* -For a Channel/Group: -```csharp -var chats = await client.Messages_GetAllChats(); -var channel = (Channel)chats.chats[1234567890]; // the channel we want -for (int offset = 0; ;) -{ - var participants = await client.Channels_GetParticipants(channel, null, offset); - foreach (var (id, user) in participants.users) - Console.WriteLine(user); - offset += participants.participants.Length; - if (offset >= participants.count || participants.participants.Length == 0) break; -} -``` - -For big Channel/Group, Telegram servers might limit the number of members you can obtain with the normal above method. -In this case, you can use the following helper method, but it can take several minutes to complete: -```csharp -var chats = await client.Messages_GetAllChats(); -var channel = (Channel)chats.chats[1234567890]; // the channel we want -var participants = await client.Channels_GetAllParticipants(channel); -``` - -If you only need to list the channel owner/admins, you can use specific filter: -```csharp -var participants = await client.Channels_GetParticipants(channel, filter: new ChannelParticipantsAdmins()); -foreach (var participant in participants.participants) // This is the correct way to enumerate the result -{ - var user = participants.users[participant.UserID]; - if (participant is ChannelParticipantCreator cpc) Console.WriteLine($"{user} is the owner '{cpc.rank}'"); - else if (participant is ChannelParticipantAdmin cpa) Console.WriteLine($"{user} is admin '{cpa.rank}'"); -} -``` -*Note: It is not possible to list only the Deleted Accounts. Those will be automatically removed by Telegram from your group after a while* ### Join a channel/group by their public name or invite link @@ -278,46 +400,14 @@ await client.Messages_DeleteExportedChatInvite(chat, invite.link); await client.DeleteChatUser(chat, user); ``` - -### Get all messages (history) from a chat + +### Send a message to someone by phone number ```csharp -var chats = await client.Messages_GetAllChats(); -InputPeer peer = chats.chats[1234567890]; // the chat we want -for (int offset_id = 0; ;) -{ - var messages = await client.Messages_GetHistory(peer, offset_id); - if (messages.Messages.Length == 0) break; - foreach (var msgBase in messages.Messages) - { - var from = messages.UserOrChat(msgBase.From ?? msgBase.Peer); // from can be User/Chat/Channel - if (msgBase is Message msg) - Console.WriteLine($"{from}> {msg.message} {msg.media}"); - else if (msgBase is MessageService ms) - Console.WriteLine($"{from} [{ms.action.GetType().Name[13..]}]"); - } - offset_id = messages.Messages[^1].ID; -} +var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); +if (contacts.imported.Length > 0) + await client.SendMessageAsync(contacts.users[contacts.imported[0].user_id], "Hello!"); ``` -Notes: -- To stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id` -- To mark the message history as read, use: `await client.ReadHistory(peer);` - - -### Monitor all Telegram events happening for the user - -This is done through the `client.OnUpdate` callback event. -Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. - -See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). - - -### Monitor new messages being posted in chats in real-time - -You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. - -See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). - -You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. +*Note: Don't use this method too much. To prevent spam, Telegram may restrict your ability to add new phone numbers.* ### Retrieve the current user's contacts list @@ -348,14 +438,6 @@ finally } ``` - -### Downloading photos, medias, files - -This is done using the helper method `client.DownloadFileAsync(file, outputStream)` -that simplify the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. - -See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs) that download all media files you forward to yourself (Saved Messages) - ### Collect Access Hash and save them for later use @@ -397,29 +479,6 @@ If your Telegram client is already connected to such MTPROTO proxy, you can also *Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* - -### Change logging settings -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 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}"); - -// • 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) => { }; -``` - -The `lvl` argument correspond to standard [LogLevel values](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel#fields) - ### Change 2FA password ```csharp @@ -449,61 +508,6 @@ Use it to pass a custom Stream-derived class that will **read** (first initial c You can find an example for such custom session store in [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs#L61) - -### Fun with custom emojies and reactions on pinned messages -```csharp -// • Sending a message with custom emojies in Markdown to ourself: -var text = "Vicksy says Hi! [👋](emoji?id=5190875290439525089)"; -var entities = client.MarkdownToEntities(ref text, premium: true); -await client.SendMessageAsync(InputPeer.Self, text, entities: entities); -// also available in HTML: 👋 - -// • Fetch all available standard emoji reactions -var all_emoji = await client.Messages_GetAvailableReactions(); - -var chats = await client.Messages_GetAllChats(); -var chat = chats.chats[1234567890]; // the chat we want - -// • Check reactions available in this chat -var full = await client.GetFullChat(chat); -Reaction reaction = full.full_chat.AvailableReactions switch -{ - ChatReactionsSome some => some.reactions[0], // only some reactions are allowed => pick the first - ChatReactionsAll all => // all reactions are allowed in this chat - all.flags.HasFlag(ChatReactionsAll.Flags.allow_custom) && client.User.flags.HasFlag(TL.User.Flags.premium) - ? new ReactionCustomEmoji { document_id = 5190875290439525089 } // we can use custom emoji reactions here - : new ReactionEmoji { emoticon = all_emoji.reactions[0].reaction }, // else, pick the first standard emoji reaction - _ => null // reactions are not allowed in this chat -}; -if (reaction == null) return; - -// • Send the selected reaction on the last 2 pinned messages -var messages = await client.Messages_Search(chat, limit: 2); -foreach (var msg in messages.Messages) - await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); -``` -*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers) or inspecting incoming messages. Access hash is not required* - - -### Forward or copy a message to another chat -```csharp -// Determine which chats and message to forward/copy -var chats = await client.Messages_GetAllChats(); -var from_chat = chats.chats[1234567890]; // source chat -var to_chat = chats.chats[1234567891]; // destination chat -var history = await client.Messages_GetHistory(from_chat, limit: 1); -var msg = history.Messages[0] as Message; // last message of source chat - -// • Forward the message (only the source message id is necessary) -await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat); - -// • Copy the message without the "Forwarded" header (only the source message id is necessary) -await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat, drop_author: true); - -// • Alternative solution to copy the message (the full message is needed) -await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), entities: msg.entities); -``` - ### Send/receive end-to-end encrypted messages & files in Secret Chats diff --git a/README.md b/README.md index e8a0773..439e09d 100644 --- a/README.md +++ b/README.md @@ -163,7 +163,7 @@ or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (th - `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members (it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but will be `deactivated`) **⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!** -- chats : In plural or general meaning, it means either `Chat` or `Channel` +- chats : In plural or general meaning, it means either `Chat` or `Channel` *(therefore, no private user discussions)* - `Peer` : Either a `Chat`, a `Channel` or a `User` - Dialog : Status of chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. - Access Hash : Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them. diff --git a/src/Client.cs b/src/Client.cs index de73394..7386ae7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -322,27 +322,24 @@ namespace WTelegram if (!IsMainDC && _pendingRpcs.Count <= 1 && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }) if (_pendingRpcs.Values.FirstOrDefault() is not Rpc rpc || rpc.type == typeof(Pong)) _reactorReconnects = 0; - if (_reactorReconnects != 0) - { - await Task.Delay(5000); - if (_networkStream == null) return; // Dispose has been called in-between - await ConnectAsync(); // start a new reactor after 5 secs - lock (_pendingRpcs) // retry all pending requests - { - foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method) - _pendingRpcs.Clear(); - _bareRpc = null; - } - // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates - if (IsMainDC) - { - var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates - RaiseUpdate(updatesState); - } - } - else + if (_reactorReconnects == 0) throw; + await Task.Delay(5000); + if (_networkStream == null) return; // Dispose has been called in-between + await ConnectAsync(); // start a new reactor after 5 secs + lock (_pendingRpcs) // retry all pending requests + { + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method) + _pendingRpcs.Clear(); + _bareRpc = null; + } + // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates + if (IsMainDC) + { + var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates + RaiseUpdate(updatesState); + } } catch { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index df0ec23..a827e48 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2268,24 +2268,24 @@ namespace TL /// Location of a certain size of a picture See Derived classes: , , , , , public abstract partial class PhotoSizeBase : IObject { - /// Thumbnail type (see. ) + /// Thumbnail type » public virtual string Type { get; } } /// Empty constructor. Image with this thumbnail is unavailable. See [TLDef(0x0E17E23C)] public partial class PhotoSizeEmpty : PhotoSizeBase { - /// Thumbnail type (see. ) + /// Thumbnail type » public string type; - /// Thumbnail type (see. ) + /// Thumbnail type » public override string Type => type; } /// Image description. See [TLDef(0x75C78E60)] public partial class PhotoSize : PhotoSizeBase { - /// Thumbnail type + /// Thumbnail type » public string type; /// Image width public int w; @@ -2294,7 +2294,7 @@ namespace TL /// File size public int size; - /// Thumbnail type + /// Thumbnail type » public override string Type => type; } /// Description of an image and its content. See @@ -2329,7 +2329,7 @@ namespace TL [TLDef(0xFA3EFB95)] public partial class PhotoSizeProgressive : PhotoSizeBase { - /// Photosize type + /// Photosize type » public string type; /// Photo width public int w; @@ -2338,7 +2338,7 @@ namespace TL /// Sizes of progressive JPEG file prefixes, which can be used to preliminarily show the image. public int[] sizes; - /// Photosize type + /// Photosize type » public override string Type => type; } /// Messages with animated stickers can have a compressed svg (< 300 bytes) to show the outline of the sticker before fetching the actual lottie animation. See @@ -13151,9 +13151,9 @@ namespace TL public long bot_id; /// Attachment menu item name public string short_name; - /// List of peer types where this attachment should be shown + /// List of dialog types where this attachment menu entry should be shown public AttachMenuPeerType[] peer_types; - /// Attachment menu icon + /// List of platform-specific static icons and animations to use for the attachment menu button public AttachMenuBotIcon[] icons; [Flags] public enum Flags : uint @@ -13292,9 +13292,9 @@ namespace TL { ///The bot attachment menu entry is available in the chat with the bot that offers it SameBotPM = 0x7D6BE90E, - ///The bot attachment menu entry is available in private chats with other bots + ///The bot attachment menu entry is available in private chats with other bots (excluding the bot that offers the current attachment menu) BotPM = 0xC32BFA1A, - ///The bot attachment menu entry is available in private chats with other users + ///The bot attachment menu entry is available in private chats with other users (not bots) PM = 0xF146D31F, ///The bot attachment menu entry is available in groups and supergroups Chat = 0x0509113F, diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c0b70d1..43f7f50 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3214,7 +3214,7 @@ namespace TL /// Bot that owns the web app /// Web app URL /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. - /// Theme parameters for the web app + /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. @@ -3253,7 +3253,7 @@ namespace TL /// Open a bot web app. See /// Bot that owns the webapp /// Web app URL - /// Theme parameters + /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null) => client.Invoke(new Messages_RequestSimpleWebView diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 8c810c8..1cf43a6 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -672,7 +672,7 @@ namespace TL [TLDef(0x77BFB61B)] public partial class PhotoSize : PhotoSizeBase { - /// Thumbnail type + /// Thumbnail type » public string type; public FileLocationBase location; /// Image width @@ -682,7 +682,7 @@ namespace TL /// File size public int size; - /// Thumbnail type + /// Thumbnail type » public override string Type => type; } /// Description of an image and its content. See From fd42d3e6df61cdea1cb920b048bb92b813f02ba4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 1 Nov 2022 19:26:40 +0100 Subject: [PATCH 009/336] Upgrade to layer 148: Topics, Usernames, Sticker keywords... + support for flags2 has_fields --- Examples/Program_ListenUpdates.cs | 2 +- README.md | 2 +- src/TL.Schema.cs | 275 ++++++++++++++++++++- src/TL.SchemaFuncs.cs | 385 ++++++++++++++++++++++++++---- src/TL.Table.cs | 39 ++- src/TL.cs | 16 +- 6 files changed, 648 insertions(+), 71 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index fd25eb6..920dfd1 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -50,7 +50,7 @@ namespace WTelegramClientTest case UpdateChannelUserTyping ucut2: Console.WriteLine($"{Peer(ucut2.from_id)} is {ucut2.action} in {Chat(ucut2.channel_id)}"); break; case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {Chat(cp.chat_id)}"); break; case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; - case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: @{uun.username} {uun.first_name} {uun.last_name}"); break; + case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break; default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases } diff --git a/README.md b/README.md index 439e09d..16da3f6 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-146-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-148-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://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a827e48..b785fb9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -698,11 +698,12 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0x5D99ADEE)] + [TLDef(0x8F97C628)] public partial class User : UserBase { /// Flags, see TL conditional fields public Flags flags; + public Flags2 flags2; /// ID of the user public long id; /// Access hash of the user @@ -729,6 +730,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; + [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint { @@ -789,6 +791,12 @@ namespace TL /// Field has a value has_emoji_status = 0x40000000, } + + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_usernames = 0x1, + } } /// User profile photo. See @@ -926,11 +934,12 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x8261AC61)] + [TLDef(0x83259464)] public partial class Channel : ChatBase { /// Flags, see TL conditional fields public Flags flags; + public Flags2 flags2; /// ID of the channel public long id; /// Access hash @@ -953,6 +962,7 @@ namespace TL [IfFlag(18)] public ChatBannedRights default_banned_rights; /// Participant count [IfFlag(17)] public int participants_count; + [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint { @@ -1006,6 +1016,13 @@ namespace TL join_to_send = 0x10000000, /// Whether a user's join request will have to be approved by administrators, toggle using channels.toggleJoinToSend join_request = 0x20000000, + forum = 0x40000000, + } + + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_usernames = 0x1, } /// ID of the channel @@ -2136,6 +2153,36 @@ namespace TL /// Duration of the gifted Telegram Premium subscription public int months; } + /// See + [TLDef(0x0D999256)] + public class MessageActionTopicCreate : MessageAction + { + public Flags flags; + public string title; + public int icon_color; + [IfFlag(0)] public long icon_emoji_id; + + [Flags] public enum Flags : uint + { + has_icon_emoji_id = 0x1, + } + } + /// See + [TLDef(0xB18A431C)] + public class MessageActionTopicEdit : MessageAction + { + public Flags flags; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + } + } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2468,6 +2515,13 @@ namespace TL /// All channels See [TLDef(0xB1DB7C7E)] public class InputNotifyBroadcasts : InputNotifyPeerBase { } + /// See + [TLDef(0x5C467992)] + public class InputNotifyForumTopic : InputNotifyPeerBase + { + public InputPeer peer; + public int top_msg_id; + } /// Notification settings. See [TLDef(0xDF1F002B)] @@ -3132,7 +3186,7 @@ namespace TL public UserStatus status; } /// Changes the user's first name, last name and username. See - [TLDef(0xC3F202E0)] + [TLDef(0xA7848924)] public class UpdateUserName : Update { /// User identifier @@ -3141,8 +3195,7 @@ namespace TL public string first_name; /// New last name. Corresponds to the new value of real_last_name field of the . public string last_name; - /// New username. - public string username; + public Username[] usernames; } /// Change of contact's profile photo. See [TLDef(0xF227868C)] @@ -3575,13 +3628,21 @@ namespace TL public int max_id; } /// Notifies a change of a message draft. See - [TLDef(0xEE2BB969)] + [TLDef(0x1B49EC6D)] public class UpdateDraftMessage : Update { + public Flags flags; /// The peer to which the draft is associated public Peer peer; + [IfFlag(0)] public int top_msg_id; /// The draft public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// Some featured stickers were marked as read See [TLDef(0x571D2742)] @@ -3725,11 +3786,21 @@ namespace TL [TLDef(0xE511996D)] public class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See - [TLDef(0x44BDD535, inheritBefore = true)] - public class UpdateChannelReadMessagesContents : UpdateChannel + [TLDef(0xEA29055D)] + public class UpdateChannelReadMessagesContents : Update { + public Flags flags; + /// Channel/supergroup ID + public long channel_id; + [IfFlag(0)] public int top_msg_id; /// IDs of messages that were read public int[] messages; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// All contacts were deleted See [TLDef(0x7084A7BE)] @@ -4190,15 +4261,23 @@ namespace TL public int qts; } /// New message reactions » are available See - [TLDef(0x154798C3)] + [TLDef(0x5E1B3CB8)] public class UpdateMessageReactions : Update { + public Flags flags; /// Peer public Peer peer; /// Message ID public int msg_id; + [IfFlag(0)] public int top_msg_id; /// Reactions public MessageReactions reactions; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// The list of installed attachment menu entries » has changed, use messages.getAttachMenuBots to fetch the updated list. See [TLDef(0x17B7A20B)] @@ -4286,6 +4365,19 @@ namespace TL public int msg_id; public MessageExtendedMediaBase extended_media; } + /// See + [TLDef(0xF694B0AE)] + public class UpdateChannelPinnedTopic : Update + { + public Flags flags; + public long channel_id; + [IfFlag(0)] public int topic_id; + + [Flags] public enum Flags : uint + { + has_topic_id = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5260,6 +5352,13 @@ namespace TL /// Channel notification settings See [TLDef(0xD612E8EF)] public class NotifyBroadcasts : NotifyPeerBase { } + /// See + [TLDef(0x226E6308)] + public class NotifyForumTopic : NotifyPeerBase + { + public Peer peer; + public int top_msg_id; + } /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } @@ -6111,6 +6210,9 @@ namespace TL /// Default custom emoji status stickerset See [TLDef(0x29D0F5EE)] public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } + /// See + [TLDef(0x44C1F8E9)] + public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -6166,13 +6268,14 @@ namespace TL /// Stickerset and stickers inside it See /// a value means messages.stickerSetNotModified - [TLDef(0xB60A24A6)] + [TLDef(0x6E153F16)] public class Messages_StickerSet : IObject { /// The stickerset public StickerSet set; /// Emoji info for stickers public StickerPack[] packs; + public StickerKeyword[] keywords; /// Stickers in stickerset public DocumentBase[] documents; } @@ -8002,13 +8105,14 @@ namespace TL public override StickerSet Set => set; } /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
- [TLDef(0x1AED5EE5)] + [TLDef(0x40D13C0E)] public class StickerSetFullCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; /// Emoji information about every sticker in the stickerset public StickerPack[] packs; + public StickerKeyword[] keywords; /// Stickers public DocumentBase[] documents; @@ -9803,6 +9907,52 @@ namespace TL /// New allowed reaction emojis public ChatReactions new_value; } + /// See + [TLDef(0xF04FB3A9)] + public class ChannelAdminLogEventActionChangeUsernames : ChannelAdminLogEventAction + { + public string[] prev_value; + public string[] new_value; + } + /// See + [TLDef(0x02CC6383)] + public class ChannelAdminLogEventActionToggleForum : ChannelAdminLogEventAction + { + public bool new_value; + } + /// See + [TLDef(0x58707D28)] + public class ChannelAdminLogEventActionCreateTopic : ChannelAdminLogEventAction + { + public ForumTopicBase topic; + } + /// See + [TLDef(0xF06FE208)] + public class ChannelAdminLogEventActionEditTopic : ChannelAdminLogEventAction + { + public ForumTopicBase prev_topic; + public ForumTopicBase new_topic; + } + /// See + [TLDef(0xAE168909)] + public class ChannelAdminLogEventActionDeleteTopic : ChannelAdminLogEventAction + { + public ForumTopicBase topic; + } + /// See + [TLDef(0x5D8D353B)] + public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction + { + public Flags flags; + [IfFlag(0)] public ForumTopicBase prev_topic; + [IfFlag(1)] public ForumTopicBase new_topic; + + [Flags] public enum Flags : uint + { + has_prev_topic = 0x1, + has_new_topic = 0x2, + } + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -9875,6 +10025,7 @@ namespace TL invites = 0x8000, /// A message was posted in a channel send = 0x10000, + forums = 0x20000, } } @@ -11045,6 +11196,7 @@ namespace TL manage_call = 0x800, /// Set this flag if none of the other flags are set, but you still want the user to be an admin: if this or any of the other flags are set, the admin can get the chat admin log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. other = 0x1000, + manage_topics = 0x2000, } } @@ -11083,6 +11235,7 @@ namespace TL invite_users = 0x8000, /// If set, does not allow any user to pin messages in a supergroup/chat pin_messages = 0x20000, + manage_topics = 0x40000, } } @@ -12211,6 +12364,7 @@ namespace TL /// Field has a value has_reply_to_top_id = 0x2, reply_to_scheduled = 0x4, + forum_topic = 0x8, } } @@ -12786,19 +12940,29 @@ namespace TL has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, + show_peer_photo = 0x40, } } /// A set of sponsored messages associated to a channel See - [TLDef(0x65A4C7D5)] + /// a value means messages.sponsoredMessagesEmpty + [TLDef(0xC9EE1D87)] public class Messages_SponsoredMessages : IObject, IPeerResolver { + public Flags flags; + [IfFlag(0)] public int posts_between; /// Sponsored messages public SponsoredMessage[] messages; /// Chats mentioned in the sponsored messages public Dictionary chats; /// Users mentioned in the sponsored messages public Dictionary users; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_posts_between = 0x1, + } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -13630,4 +13794,91 @@ namespace TL { public MessageMedia media; } + + /// See + [TLDef(0xFCFEB29C)] + public class StickerKeyword : IObject + { + public long document_id; + public string[] keyword; + } + + /// See + [TLDef(0xB4073647)] + public class Username : IObject + { + public Flags flags; + public string username; + + [Flags] public enum Flags : uint + { + editable = 0x1, + active = 0x2, + } + } + + /// See + public abstract class ForumTopicBase : IObject + { + public virtual int ID { get; } + } + /// See + [TLDef(0x023F109B)] + public class ForumTopicDeleted : ForumTopicBase + { + public int id; + + public override int ID => id; + } + /// See + [TLDef(0x71701DA9)] + public class ForumTopic : ForumTopicBase + { + public Flags flags; + public int id; + public DateTime date; + public string title; + public int icon_color; + [IfFlag(0)] public long icon_emoji_id; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_mentions_count; + public int unread_reactions_count; + public Peer from_id; + public PeerNotifySettings notify_settings; + [IfFlag(4)] public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + has_icon_emoji_id = 0x1, + my = 0x2, + closed = 0x4, + pinned = 0x8, + has_draft = 0x10, + } + + public override int ID => id; + } + + /// See + [TLDef(0x367617D3)] + public class Messages_ForumTopics : IObject, IPeerResolver + { + public Flags flags; + public int count; + public ForumTopicBase[] topics; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + public int pts; + + [Flags] public enum Flags : uint + { + order_by_create_date = 0x1, + } + /// 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 43f7f50..081d365 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -869,13 +869,11 @@ namespace TL /// Get theme information See Possible codes: 400 (details) /// Theme format, a string that identifies the theming engines supported by the client /// Theme - /// Deprecated: should always be 0 - public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme, long document_id) + public static Task Account_GetTheme(this Client client, string format, InputThemeBase theme) => client.Invoke(new Account_GetTheme { format = format, theme = theme, - document_id = document_id, }); /// Get installed themes See @@ -1044,6 +1042,21 @@ namespace TL { }); + /// See + public static Task Account_ReorderUsernames(this Client client, params string[] order) + => client.Invoke(new Account_ReorderUsernames + { + order = order, + }); + + /// See + public static Task Account_ToggleUsername(this Client client, string username, bool active) + => client.Invoke(new Account_ToggleUsername + { + username = username, + active = active, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1425,12 +1438,13 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), message = message, random_id = random_id, reply_markup = reply_markup, @@ -1454,12 +1468,13 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), media = media, message = message, random_id = random_id, @@ -1482,14 +1497,15 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ForwardMessages.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, + top_msg_id = top_msg_id.GetValueOrDefault(), schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, }); @@ -1979,12 +1995,13 @@ namespace TL /// Result ID from messages.getInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), random_id = random_id, query_id = query_id, id = id, @@ -2088,11 +2105,12 @@ namespace TL /// Destination of the message that should be sent /// The draft /// Message entities for styled text - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, MessageEntity[] entities = null) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, int? top_msg_id = null, MessageEntity[] entities = null) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (entities != null ? 0x8 : 0)), + flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), peer = peer, message = message, entities = entities, @@ -2369,10 +2387,12 @@ namespace TL /// Maximum number of results to return, see pagination /// Maximum message ID to return, see pagination /// Minimum message ID to return, see pagination - public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) + public static Task Messages_GetUnreadMentions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) => client.Invoke(new Messages_GetUnreadMentions { + flags = (Messages_GetUnreadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -2382,10 +2402,12 @@ namespace TL /// Mark mentions as read See Possible codes: 400 (details) /// Dialog - public static Task Messages_ReadMentions(this Client client, InputPeer peer) + public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadMentions { + flags = (Messages_ReadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// Get live location history of a certain user See @@ -2411,12 +2433,13 @@ namespace TL /// The medias to send: note that they must be separately uploaded using messages.uploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, @@ -2575,10 +2598,12 @@ namespace TL /// Get the number of results that would be found by a messages.search call with the same parameters See Possible codes: 400 (details) /// Peer where to search /// Search filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, params MessagesFilter[] filters) + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) => client.Invoke(new Messages_GetSearchCounters { + flags = (Messages_GetSearchCounters.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), filters = filters, }); @@ -2783,10 +2808,12 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin - public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer) + public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_UnpinAllMessages { + flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
@@ -3149,10 +3176,12 @@ namespace TL /// Maximum number of results to return, see pagination /// Only return reactions for messages up until this message ID /// Only return reactions for messages starting from this message ID - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default) + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) => client.Invoke(new Messages_GetUnreadReactions { + flags = (Messages_GetUnreadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -3162,10 +3191,12 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer - public static Task Messages_ReadReactions(this Client client, InputPeer peer) + public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadReactions { + flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, + top_msg_id = top_msg_id.GetValueOrDefault(), }); /// View and search recently sent media.
This method does not support pagination. See
@@ -3218,10 +3249,10 @@ namespace TL /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, 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) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, 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, int? top_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) | (send_as != null ? 0x2000 : 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) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, url = url, @@ -3229,6 +3260,7 @@ namespace TL theme_params = theme_params, platform = platform, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), send_as = send_as, }); @@ -3239,14 +3271,15 @@ namespace TL /// Web app interaction ID obtained from messages.requestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. /// Open the web app as the specified peer - 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) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, int? top_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) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), peer = peer, bot = bot, query_id = query_id, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id.GetValueOrDefault(), send_as = send_as, }); @@ -4123,6 +4156,7 @@ namespace TL /// Get a list of sponsored messages See Possible codes: 400 (details) /// Peer + /// a null value means messages.sponsoredMessagesEmpty public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetSponsoredMessages { @@ -4167,6 +4201,101 @@ namespace TL enabled = enabled, }); + /// See + public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) + => client.Invoke(new Channels_ReorderUsernames + { + channel = channel, + order = order, + }); + + /// See + public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) + => client.Invoke(new Channels_ToggleUsername + { + channel = channel, + username = username, + active = active, + }); + + /// See + public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_DeactivateAllUsernames + { + channel = channel, + }); + + /// See + public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleForum + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, long? icon_emoji_id = null, InputPeer send_as = null) + => client.Invoke(new Channels_CreateForumTopic + { + flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x8 : 0) | (send_as != null ? 0x4 : 0)), + channel = channel, + title = title, + icon_color = icon_color.GetValueOrDefault(), + icon_emoji_id = icon_emoji_id.GetValueOrDefault(), + random_id = random_id, + send_as = send_as, + }); + + /// See + public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, int offset_topic, DateTime offset_date = default, int offset_id = default, int limit = int.MaxValue, string q = null) + => client.Invoke(new Channels_GetForumTopics + { + flags = (Channels_GetForumTopics.Flags)(q != null ? 0x1 : 0), + channel = channel, + q = q, + offset_date = offset_date, + offset_id = offset_id, + offset_topic = offset_topic, + limit = limit, + }); + + /// See + public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) + => client.Invoke(new Channels_GetForumTopicsByID + { + channel = channel, + topics = topics, + }); + + /// See + public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default) + => client.Invoke(new Channels_EditForumTopic + { + flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0)), + channel = channel, + topic_id = topic_id, + title = title, + icon_emoji_id = icon_emoji_id.GetValueOrDefault(), + closed = closed.GetValueOrDefault(), + }); + + /// See + public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) + => client.Invoke(new Channels_UpdatePinnedForumTopic + { + channel = channel, + topic_id = topic_id, + pinned = pinned, + }); + + /// See + public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) + => client.Invoke(new Channels_DeleteTopicHistory + { + channel = channel, + top_msg_id = top_msg_id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5592,12 +5721,11 @@ namespace TL.Methods } } - [TLDef(0x8D9D742B)] + [TLDef(0x3A5869EC)] public class Account_GetTheme : IMethod { public string format; public InputThemeBase theme; - public long document_id; } [TLDef(0x7206E458)] @@ -5720,6 +5848,19 @@ namespace TL.Methods [TLDef(0x18201AAE)] public class Account_ClearRecentEmojiStatuses : IMethod { } + [TLDef(0xEF500EAB)] + public class Account_ReorderUsernames : IMethod + { + public string[] order; + } + + [TLDef(0x58D6B376)] + public class Account_ToggleUsername : IMethod + { + public string username; + public bool active; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -6018,12 +6159,13 @@ namespace TL.Methods } } - [TLDef(0x0D9D75A4)] + [TLDef(0x1CC20387)] public class Messages_SendMessage : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public string message; public long random_id; [IfFlag(2)] public ReplyMarkup reply_markup; @@ -6040,6 +6182,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -6047,12 +6190,13 @@ namespace TL.Methods } } - [TLDef(0xE25FF8E0)] + [TLDef(0x7547C966)] public class Messages_SendMedia : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public InputMedia media; public string message; public long random_id; @@ -6069,6 +6213,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -6076,7 +6221,7 @@ namespace TL.Methods } } - [TLDef(0xCC30290B)] + [TLDef(0xC661BBC4)] public class Messages_ForwardMessages : IMethod { public Flags flags; @@ -6084,6 +6229,7 @@ namespace TL.Methods public int[] id; public long[] random_id; public InputPeer to_peer; + [IfFlag(9)] public int top_msg_id; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; @@ -6092,6 +6238,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, with_my_score = 0x100, + has_top_msg_id = 0x200, has_schedule_date = 0x400, drop_author = 0x800, drop_media_captions = 0x1000, @@ -6476,12 +6623,13 @@ namespace TL.Methods } } - [TLDef(0x7AA11297)] + [TLDef(0xD3FBDCCB)] public class Messages_SendInlineBotResult : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public long random_id; public long query_id; public string id; @@ -6494,6 +6642,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, hide_via = 0x800, has_send_as = 0x2000, @@ -6590,11 +6739,12 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xBC39E14B)] + [TLDef(0xB4331E3F)] public class Messages_SaveDraft : IMethod { public Flags flags; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(2)] public int top_msg_id; public InputPeer peer; public string message; [IfFlag(3)] public MessageEntity[] entities; @@ -6603,6 +6753,7 @@ namespace TL.Methods { has_reply_to_msg_id = 0x1, no_webpage = 0x2, + has_top_msg_id = 0x4, has_entities = 0x8, } } @@ -6839,21 +6990,35 @@ namespace TL.Methods public bool unfave; } - [TLDef(0x46578472)] + [TLDef(0xF107E790)] public class Messages_GetUnreadMentions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public int offset_id; public int add_offset; public int limit; public int max_id; public int min_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } - [TLDef(0x0F0189D3)] + [TLDef(0x36E5BF4D)] public class Messages_ReadMentions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x702A40E0)] @@ -6864,12 +7029,13 @@ namespace TL.Methods public long hash; } - [TLDef(0xF803138F)] + [TLDef(0xB6F11A1C)] public class Messages_SendMultiMedia : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; public InputSingleMedia[] multi_media; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; @@ -6880,6 +7046,7 @@ namespace TL.Methods silent = 0x20, background = 0x40, clear_draft = 0x80, + has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -7003,11 +7170,18 @@ namespace TL.Methods public string lang_code; } - [TLDef(0x732EEF00)] + [TLDef(0x00AE7CC1)] public class Messages_GetSearchCounters : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public MessagesFilter[] filters; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x198FB446)] @@ -7170,10 +7344,17 @@ namespace TL.Methods public int read_max_id; } - [TLDef(0xF025BC8B)] + [TLDef(0xEE22B9A8)] public class Messages_UnpinAllMessages : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x5BD0EE50)] @@ -7470,21 +7651,35 @@ namespace TL.Methods } } - [TLDef(0xE85BAE1A)] + [TLDef(0x3223495B)] public class Messages_GetUnreadReactions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; public int offset_id; public int add_offset; public int limit; public int max_id; public int min_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } - [TLDef(0x82E251D7)] + [TLDef(0x54AA7F8E)] public class Messages_ReadReactions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } } [TLDef(0x107E31A0)] @@ -7514,7 +7709,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0xFC87A53C)] + [TLDef(0x178B480B)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -7525,6 +7720,7 @@ namespace TL.Methods [IfFlag(2)] public DataJSON theme_params; public string platform; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint @@ -7535,11 +7731,12 @@ namespace TL.Methods has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, + has_top_msg_id = 0x200, has_send_as = 0x2000, } } - [TLDef(0xEA5FBCCE)] + [TLDef(0x7FF34309)] public class Messages_ProlongWebView : IMethod { public Flags flags; @@ -7547,12 +7744,14 @@ namespace TL.Methods public InputUserBase bot; public long query_id; [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(9)] public int top_msg_id; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { has_reply_to_msg_id = 0x1, silent = 0x20, + has_top_msg_id = 0x200, has_send_as = 0x2000, } } @@ -8226,6 +8425,110 @@ namespace TL.Methods public bool enabled; } + [TLDef(0xB45CED1D)] + public class Channels_ReorderUsernames : IMethod + { + public InputChannelBase channel; + public string[] order; + } + + [TLDef(0x50F24105)] + public class Channels_ToggleUsername : IMethod + { + public InputChannelBase channel; + public string username; + public bool active; + } + + [TLDef(0x0A245DD3)] + public class Channels_DeactivateAllUsernames : IMethod + { + public InputChannelBase channel; + } + + [TLDef(0xA4298B29)] + public class Channels_ToggleForum : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xF40C0224)] + public class Channels_CreateForumTopic : IMethod + { + public Flags flags; + public InputChannelBase channel; + public string title; + [IfFlag(0)] public int icon_color; + [IfFlag(3)] public long icon_emoji_id; + public long random_id; + [IfFlag(2)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_icon_color = 0x1, + has_send_as = 0x4, + has_icon_emoji_id = 0x8, + } + } + + [TLDef(0x0DE560D1)] + public class Channels_GetForumTopics : IMethod + { + public Flags flags; + public InputChannelBase channel; + [IfFlag(0)] public string q; + public DateTime offset_date; + public int offset_id; + public int offset_topic; + public int limit; + + [Flags] public enum Flags : uint + { + has_q = 0x1, + } + } + + [TLDef(0xB0831EB9)] + public class Channels_GetForumTopicsByID : IMethod + { + public InputChannelBase channel; + public int[] topics; + } + + [TLDef(0x6C883E2D)] + public class Channels_EditForumTopic : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int topic_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + } + } + + [TLDef(0x6C2D9026)] + public class Channels_UpdatePinnedForumTopic : IMethod + { + public InputChannelBase channel; + public int topic_id; + public bool pinned; + } + + [TLDef(0x34435F2D)] + public class Channels_DeleteTopicHistory : IMethod + { + public InputChannelBase channel; + public int top_msg_id; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3682f20..77a69be 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 = 146; // fetched 14/09/2022 16:18:39 + public const int Version = 148; // fetched 01/11/2022 17:33:23 internal const int SecretChats = 101; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -119,7 +119,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x5D99ADEE] = typeof(User), + [0x8F97C628] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -131,7 +131,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x8261AC61] = typeof(Channel), + [0x83259464] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), [0xF2355507] = typeof(ChannelFull), @@ -191,6 +191,8 @@ namespace TL [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), [0xABA0F5C6] = typeof(MessageActionGiftPremium), + [0x0D999256] = typeof(MessageActionTopicCreate), + [0xB18A431C] = typeof(MessageActionTopicEdit), [0xA8EDD0F5] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -211,6 +213,7 @@ namespace TL [0x193B4417] = typeof(InputNotifyUsers), [0x4A95E84E] = typeof(InputNotifyChats), [0xB1DB7C7E] = typeof(InputNotifyBroadcasts), + [0x5C467992] = typeof(InputNotifyForumTopic), [0xDF1F002B] = typeof(InputPeerNotifySettings), [0xA83B0426] = typeof(PeerNotifySettings), [0xA518110D] = typeof(PeerSettings), @@ -260,7 +263,7 @@ namespace TL [0x83487AF0] = typeof(UpdateChatUserTyping), [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), - [0xC3F202E0] = typeof(UpdateUserName), + [0xA7848924] = typeof(UpdateUserName), [0xF227868C] = typeof(UpdateUserPhoto), [0x12BCBD9A] = typeof(UpdateNewEncryptedMessage), [0x1710F156] = typeof(UpdateEncryptedChatTyping), @@ -295,7 +298,7 @@ namespace TL [0xE40370A3] = typeof(UpdateEditMessage), [0x691E9052] = typeof(UpdateInlineBotCallbackQuery), [0xB75F99A9] = typeof(UpdateReadChannelOutbox), - [0xEE2BB969] = typeof(UpdateDraftMessage), + [0x1B49EC6D] = typeof(UpdateDraftMessage), [0x571D2742] = typeof(UpdateReadFeaturedStickers), [0x9A422C20] = typeof(UpdateRecentStickers), [0xA229DD06] = typeof(UpdateConfig), @@ -311,7 +314,7 @@ namespace TL [0x46560264] = typeof(UpdateLangPackTooLong), [0x56022F4D] = typeof(UpdateLangPack), [0xE511996D] = typeof(UpdateFavedStickers), - [0x44BDD535] = typeof(UpdateChannelReadMessagesContents), + [0xEA29055D] = typeof(UpdateChannelReadMessagesContents), [0x7084A7BE] = typeof(UpdateContactsReset), [0xB23FC698] = typeof(UpdateChannelAvailableMessages), [0xE16459C3] = typeof(UpdateDialogUnreadMark), @@ -348,7 +351,7 @@ namespace TL [0x4D712F2E] = typeof(UpdateBotCommands), [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), - [0x154798C3] = typeof(UpdateMessageReactions), + [0x5E1B3CB8] = typeof(UpdateMessageReactions), [0x17B7A20B] = typeof(UpdateAttachMenuBots), [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), @@ -360,6 +363,7 @@ namespace TL [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), + [0xF694B0AE] = typeof(UpdateChannelPinnedTopic), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -410,6 +414,7 @@ namespace TL [0xB4C83B4C] = typeof(NotifyUsers), [0xC007CEC3] = typeof(NotifyChats), [0xD612E8EF] = typeof(NotifyBroadcasts), + [0x226E6308] = typeof(NotifyForumTopic), [0x16BF744E] = typeof(SendMessageTypingAction), [0xFD5EC8F5] = typeof(SendMessageCancelAction), [0xA187D66F] = typeof(SendMessageRecordVideoAction), @@ -486,8 +491,9 @@ namespace TL [0xC88B3B02] = typeof(InputStickerSetPremiumGifts), [0x04C4D4CE] = typeof(InputStickerSetEmojiGenericAnimations), [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), + [0x44C1F8E9] = typeof(InputStickerSetEmojiDefaultTopicIcons), [0x2DD14EDC] = typeof(StickerSet), - [0xB60A24A6] = typeof(Messages_StickerSet), + [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), [0x8F300B57] = typeof(BotInfo), @@ -613,7 +619,7 @@ namespace TL [0x35E410A8] = typeof(Messages_StickerSetInstallResultArchive), [0x6410A5D2] = typeof(StickerSetCovered), [0x3407E51B] = typeof(StickerSetMultiCovered), - [0x1AED5EE5] = typeof(StickerSetFullCovered), + [0x40D13C0E] = typeof(StickerSetFullCovered), [0xAED6DBB2] = typeof(MaskCoords), [0x4A992157] = typeof(InputStickeredMediaPhoto), [0x0438865B] = typeof(InputStickeredMediaDocument), @@ -750,6 +756,12 @@ namespace TL [0xCB2AC766] = typeof(ChannelAdminLogEventActionToggleNoForwards), [0x278F2868] = typeof(ChannelAdminLogEventActionSendMessage), [0xBE4E0EF8] = typeof(ChannelAdminLogEventActionChangeAvailableReactions), + [0xF04FB3A9] = typeof(ChannelAdminLogEventActionChangeUsernames), + [0x02CC6383] = typeof(ChannelAdminLogEventActionToggleForum), + [0x58707D28] = typeof(ChannelAdminLogEventActionCreateTopic), + [0xF06FE208] = typeof(ChannelAdminLogEventActionEditTopic), + [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), + [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -953,7 +965,8 @@ namespace TL [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), [0x3A836DF8] = typeof(SponsoredMessage), - [0x65A4C7D5] = typeof(Messages_SponsoredMessages), + [0xC9EE1D87] = typeof(Messages_SponsoredMessages), + [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), [0x7F648B67] = typeof(SearchResultPosition), @@ -1028,6 +1041,11 @@ namespace TL [0xB81C7034] = typeof(SendAsPeer), [0xAD628CC8] = typeof(MessageExtendedMediaPreview), [0xEE479C64] = typeof(MessageExtendedMedia), + [0xFCFEB29C] = typeof(StickerKeyword), + [0xB4073647] = typeof(Username), + [0x023F109B] = typeof(ForumTopicDeleted), + [0x71701DA9] = typeof(ForumTopic), + [0x367617D3] = typeof(Messages_ForumTopics), // from TL.Secret: [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), @@ -1130,6 +1148,7 @@ namespace TL [typeof(DialogFilter)] = 0x363293AE, //dialogFilterDefault [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified [typeof(BotCommandScope)] = 0x2F6CB2AB, //botCommandScopeDefault + [typeof(Messages_SponsoredMessages)] = 0x1839490F, //messages.sponsoredMessagesEmpty [typeof(Messages_AvailableReactions)] = 0x9F071957, //messages.availableReactionsNotModified [typeof(AttachMenuBots)] = 0xF1D88A5C, //attachMenuBotsNotModified [typeof(BotMenuButtonBase)] = 0x7533A588, //botMenuButtonDefault diff --git a/src/TL.cs b/src/TL.cs index 6daf747..c7b1767 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -59,14 +59,16 @@ namespace TL writer.Write(ctorNb); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - uint flags = 0; + ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1UL << ifFlag.Bit)) == 0) continue; object value = field.GetValue(obj); writer.WriteTLValue(value, field.FieldType); - if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; + if (field.FieldType.IsEnum) + if (field.Name == "flags") flags = (uint)value; + else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; } } @@ -83,14 +85,16 @@ namespace TL var obj = Activator.CreateInstance(type, true); IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); - uint flags = 0; + ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) { - if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1U << ifFlag.Bit)) == 0) continue; + if (((ifFlag = field.GetCustomAttribute()) != null) && (flags & (1UL << ifFlag.Bit)) == 0) continue; object value = reader.ReadTLValue(field.FieldType); field.SetValue(obj, value); - if (field.FieldType.IsEnum && field.Name == "flags") flags = (uint)value; + if (field.FieldType.IsEnum) + if (field.Name == "flags") flags = (uint)value; + else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; if (reader.Client?.CollectAccessHash == true) reader.Client.CollectField(field, obj, value); } return (IObject)obj; From d9b137d41cae87b347dc3e05598ae2b4a839f546 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 5 Nov 2022 23:01:38 +0100 Subject: [PATCH 010/336] added User.MainUsername to help with multiple usernames --- .github/dev.yml | 2 +- EXAMPLES.md | 18 +++++++++--------- src/TL.Helpers.cs | 1 + src/TL.Schema.cs | 2 +- src/TL.SchemaFuncs.cs | 6 +++--- 5 files changed, 15 insertions(+), 14 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 04417b8..ddfdabc 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.0.2-dev.$(Rev:r) +name: 3.0.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 59bf859..35a535c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -7,7 +7,7 @@ using System.Linq; using TL; using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -var myself = await client.LoginUserIfNeeded(); +await client.LoginUserIfNeeded(); ``` In this case, environment variables are used for configuration so make sure to @@ -58,7 +58,7 @@ If the username is invalid/unused, the API call raises an RpcException.* ### Convert message to/from HTML or Markdown, and send it to ourself (Saved Messages) ```csharp // HTML-formatted text: -var text = $"Hello dear {HtmlText.Escape(myself.first_name)}\n" + +var text = $"Hello dear {HtmlText.Escape(client.User.first_name)}\n" + "Enjoy this userbot written with WTelegramClient"; var entities = client.HtmlToEntities(ref text); var sent = await client.SendMessageAsync(InputPeer.Self, text, entities: entities); @@ -67,7 +67,7 @@ text = client.EntitiesToHtml(sent.message, sent.entities); ``` ```csharp // Markdown-style text: -var text2 = $"Hello __dear *{Markdown.Escape(myself.first_name)}*__\n" + +var text2 = $"Hello __dear *{Markdown.Escape(client.User.first_name)}*__\n" + "Enjoy this `userbot` written with [WTelegramClient](https://github.com/wiz0u/WTelegramClient)"; var entities2 = client.MarkdownToEntities(ref text2); var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entities2); @@ -147,7 +147,7 @@ var participants = await client.Channels_GetAllParticipants(channel); You can use specific filters, for example to list only the channel owner/admins: ```csharp var participants = await client.Channels_GetParticipants(channel, filter: new ChannelParticipantsAdmins()); -foreach (var participant in participants.participants) // This is the correct way to enumerate the result +foreach (var participant in participants.participants) // This is the better way to enumerate the result { var user = participants.users[participant.UserID]; if (participant is ChannelParticipantCreator cpc) Console.WriteLine($"{user} is the owner '{cpc.rank}'"); @@ -232,7 +232,7 @@ var inputMedias = new List { photoFromTelegram, // PhotoBase has implicit conversion to InputMediaPhoto new InputMediaUploadedPhoto { file = uploadedFile }, - new InputMediaPhotoExternal() { url = photoUrl }, + new InputMediaPhotoExternal { url = photoUrl }, }; await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ``` @@ -349,7 +349,7 @@ var messages = await client.Messages_Search(chat, lim foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); ``` -*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/method/messages.getFeaturedEmojiStickers) or inspecting incoming messages. Access hash is not required* +*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/methods#working-with-custom-animated-emojis) or inspecting incoming messages. Access hash is not required* @@ -407,7 +407,7 @@ var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContac if (contacts.imported.Length > 0) await client.SendMessageAsync(contacts.users[contacts.imported[0].user_id], "Hello!"); ``` -*Note: Don't use this method too much. To prevent spam, Telegram may restrict your ability to add new phone numbers.* +*Note: Don't use this method too much. To prevent spam, Telegram may restrict your ability to add new phone numbers or ban your account.* ### Retrieve the current user's contacts list @@ -457,7 +457,7 @@ client.TcpHandler = async (address, port) => var proxy = new Socks5ProxyClient(ProxyHost, ProxyPort, ProxyUsername, ProxyPassword); return proxy.CreateConnection(address, port); }; -var myself = await client.LoginUserIfNeeded(); +await client.LoginUserIfNeeded(); ``` or with [xNetStandard](https://www.nuget.org/packages/xNetStandard/): ```csharp @@ -472,7 +472,7 @@ MTProxy (MTProto proxy) can be used to prevent ISP blocking Telegram servers, th ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.MTProxyUrl = "http://t.me/proxy?server=...&port=...&secret=..."; -var myself = await client.LoginUserIfNeeded(); +await client.LoginUserIfNeeded(); ``` You can find a list of working MTProxies in channels like [@ProxyMTProto](https://t.me/ProxyMTProto) or [@MTProxyT](https://t.me/MTProxyT) *(right-click the "Connect" buttons)* If your Telegram client is already connected to such MTPROTO proxy, you can also export its URL by clicking on the shield button ![🛡](https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/icons/proxy_on.png) and then **⋮** > **Share** diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 0e8f82e..3bf8380 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -129,6 +129,7 @@ namespace TL { public override long ID => id; public override bool IsActive => (flags & Flags.deleted) == 0; + public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser(id, access_hash); protected override InputUser ToInputUser() => new(id, access_hash); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b785fb9..eb74e8c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3207,7 +3207,7 @@ namespace TL public DateTime date; /// New profile photo public UserProfilePhoto photo; - /// (), if one of the previously used photos is set a profile photo. + /// (), if one of the previously used photos is set a profile photo. public bool previous; } /// New encrypted message. See diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 081d365..5eb402f 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -290,7 +290,7 @@ namespace TL /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. /// Device token, see PUSH updates for the possible values. - /// If is transmitted, a sandbox-certificate will be used during transmission. + /// If is transmitted, a sandbox-certificate will be used during transmission. /// For FCM and APNS VoIP, optional encryption key used to encrypt push notifications /// List of user identifiers of other users currently using the client public static Task Account_RegisterDevice(this Client client, int token_type, string token, bool app_sandbox, byte[] secret, long[] other_uids, bool no_muted = false) @@ -354,7 +354,7 @@ namespace TL }); /// Updates online user status. See Possible codes: 403 (details) - /// If is transmitted, user status will change to . + /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus { @@ -1656,7 +1656,7 @@ namespace TL /// Send typing event by the current user to a secret chat. See Possible codes: 400 (details) /// Secret chat ID - /// Typing.
Possible values:
, if the user started typing and more than 5 seconds have passed since the last request
, if the user stopped typing + /// Typing.
Possible values:
, if the user started typing and more than 5 seconds have passed since the last request
, if the user stopped typing public static Task Messages_SetEncryptedTyping(this Client client, InputEncryptedChat peer, bool typing) => client.Invoke(new Messages_SetEncryptedTyping { From 8fa00a8cc6daf7599485ac7c56b560ac6c0adb31 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 8 Nov 2022 17:06:16 +0100 Subject: [PATCH 011/336] Support for bare methods in session --- EXAMPLES.md | 2 +- Examples/Program_ListenUpdates.cs | 2 +- FAQ.md | 6 +++--- src/Client.cs | 13 +++++++++---- 4 files changed, 14 insertions(+), 9 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 35a535c..d8fc6dc 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -448,7 +448,7 @@ This is done by activating the experimental `client.CollectAccessHash` system. See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.cs) for how to enable it, and save/restore them for later use. -### Use a proxy to connect to Telegram +### Use a proxy or MTProxy to connect to Telegram SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 920dfd1..e463eef 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -52,7 +52,7 @@ namespace WTelegramClientTest case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break; - default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above cases + default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above example cases } } diff --git a/FAQ.md b/FAQ.md index 6e4e747..188d5dd 100644 --- a/FAQ.md +++ b/FAQ.md @@ -48,7 +48,7 @@ calling `client.Login(...)` as the user provides the requested configuration ele You can download such full example apps [for WinForms](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip) and [for ASP.NET](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/ASPnet_webapp.zip) -#### 4. Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? +#### 4. How to use IDs? Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? Having only the ID is **not enough**: An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... This serves as a proof that the logged-in user is entitled to access it (otherwise, anybody with the ID could access it) @@ -206,7 +206,7 @@ In this case, the recommended action would be to dispose the client and recreate you might also get Connection shutdown because your client couldn't send Pings to Telegram in the allotted time. In this case, you can use the `PingInterval` property to increase the delay between pings *(for example 300 seconds instead of 60)*. -5) If you're using an MTProxy, some of them are known to be quite unstable. You may want to try switching to another MTProxy that is more stable. +5) If you're using an [MTProxy](EXAMPLES.md#proxy), some of them are known to be quite unstable. You may want to try switching to another MTProxy that is more stable. #### 12. How to migrate from TLSharp? How to sign-in/sign-up/register account properly? @@ -233,7 +233,7 @@ In particular, it will detect and handle automatically and properly the various * Request to resend the verification code through alternate ways like SMS (if your Config answer an empty "verification_code" initially) * Transient failures, slowness to respond, wrong code/password, checks for encryption key safety, etc.. -Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto Proxy, real-time updates, multiple DC connections, API documentation in Intellisense... +Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto [Proxy](EXAMPLES.md#proxy), real-time updates, multiple DC connections, API documentation in Intellisense... #### 13. How to host my userbot online? diff --git a/src/Client.cs b/src/Client.cs index 7386ae7..27b4c8a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -578,11 +578,16 @@ namespace WTelegram if (_bareRpc != null) { var rpc = PullPendingRequest(_bareRpc.msgId); - if ((rpc?.type.IsAssignableFrom(obj.GetType())) != true) + if ((rpc?.type.IsAssignableFrom(obj.GetType())) == true) + { + _bareRpc = null; + rpc.tcs.SetResult(obj); + return; + } + else if (_dcSession.AuthKeyID == 0) throw new ApplicationException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); - _bareRpc = null; - rpc.tcs.SetResult(obj); - return; + lock (_pendingRpcs) + _pendingRpcs[_bareRpc.msgId] = _bareRpc; } switch (obj) { From a038be87af41f9799a65bce870d55e7dd57d9ada Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 11 Nov 2022 00:33:29 +0100 Subject: [PATCH 012/336] Improved Secret Chats: Support layer 144 : big documents, silent (layer not yet supported by other clients) List of ISecretChat with detailed properties Fix PFS issue losing a message... --- .github/dev.yml | 2 +- .github/release.yml | 2 +- Examples/Program_SecretChats.cs | 31 +-- FAQ.md | 2 +- src/Encryption.cs | 2 +- src/SecretChats.cs | 93 ++++---- src/TL.Schema.cs | 2 +- src/TL.Secret.cs | 411 ++++++++++++++++++-------------- src/TL.Table.cs | 56 ++--- 9 files changed, 326 insertions(+), 275 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ddfdabc..02d8f36 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.0.4-dev.$(Rev:r) +name: 3.1.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 9a0e1a8..250e994 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.0.$(Rev:r) +name: 3.1.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index c204af8..4b0edf0 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -4,23 +4,24 @@ using System.IO; using System.Linq; using System.Threading.Tasks; using TL; +using WTelegram; namespace WTelegramClientTest { static class Program_SecretChats { - static WTelegram.Client Client; - static WTelegram.SecretChats Secrets; - static InputEncryptedChat ActiveChat; // the secret chat currently selected + static Client Client; + static SecretChats Secrets; + static ISecretChat ActiveChat; // the secret chat currently selected static readonly Dictionary Users = new(); static readonly Dictionary Chats = new(); // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main() { - WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); - Client = new WTelegram.Client(Environment.GetEnvironmentVariable); - Secrets = new WTelegram.SecretChats(Client, "Secrets.bin"); + Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); + Client = new Client(Environment.GetEnvironmentVariable); + Secrets = new SecretChats(Client, "Secrets.bin"); AppDomain.CurrentDomain.ProcessExit += (s, e) => { Secrets.Dispose(); Client.Dispose(); }; SelectActiveChat(); @@ -46,9 +47,9 @@ Type a command, or a message to send to the active secret chat:"); var line = Console.ReadLine(); if (line.StartsWith('/')) { - if (line == "/discard delete") { await Secrets.Discard(ActiveChat, true); SelectActiveChat(); } - else if (line == "/discard") { await Secrets.Discard(ActiveChat, false); SelectActiveChat(); } - else if (line == "/read") await Client.Messages_ReadEncryptedHistory(ActiveChat, DateTime.UtcNow); + if (line == "/discard delete") { await Secrets.Discard(ActiveChat.ChatId, true); SelectActiveChat(); } + else if (line == "/discard") { await Secrets.Discard(ActiveChat.ChatId, false); SelectActiveChat(); } + else if (line == "/read") await Client.Messages_ReadEncryptedHistory(ActiveChat.Peer, DateTime.UtcNow); else if (line == "/users") foreach (var user in Users.Values) Console.WriteLine($"{user.id,-10} {user}"); else if (line.StartsWith("/select ")) SelectActiveChat(int.Parse(line[8..])); else if (line.StartsWith("/request ")) @@ -58,15 +59,15 @@ Type a command, or a message to send to the active secret chat:"); Console.WriteLine("User not found"); else if (line.StartsWith("/photo ")) { - var media = new TL.Layer45.DecryptedMessageMediaPhoto { caption = line[7..] }; + var media = new TL.Layer46.DecryptedMessageMediaPhoto { caption = line[7..] }; var file = await Secrets.UploadFile(File.OpenRead(line[7..]), media); - var sent = await Secrets.SendMessage(ActiveChat, new TL.Layer73.DecryptedMessage { random_id = WTelegram.Helpers.RandomLong(), + var sent = await Secrets.SendMessage(ActiveChat.ChatId, new TL.Layer73.DecryptedMessage { random_id = Helpers.RandomLong(), media = media, flags = TL.Layer73.DecryptedMessage.Flags.has_media }, file: file); } else Console.WriteLine("Unrecognized command"); } else if (ActiveChat == null) Console.WriteLine("No active secret chat"); - else await Secrets.SendMessage(ActiveChat, new TL.Layer73.DecryptedMessage { message = line, random_id = WTelegram.Helpers.RandomLong() }); + else await Secrets.SendMessage(ActiveChat.ChatId, new TL.Layer73.DecryptedMessage { message = line, random_id = Helpers.RandomLong() }); } catch (Exception ex) { @@ -86,7 +87,7 @@ Type a command, or a message to send to the active secret chat:"); await Secrets.HandleUpdate(ue); break; case UpdateNewEncryptedMessage unem: // Encrypted message or service message: - if (unem.message.ChatId != ActiveChat?.chat_id) SelectActiveChat(unem.message.ChatId); + if (unem.message.ChatId != ActiveChat?.ChatId) SelectActiveChat(unem.message.ChatId); foreach (var msg in Secrets.DecryptMessage(unem.message)) { if (msg.Media != null && unem.message is EncryptedMessage { file: EncryptedFile ef }) @@ -110,8 +111,8 @@ Type a command, or a message to send to the active secret chat:"); private static void SelectActiveChat(int newActiveChat = 0) { - ActiveChat = Secrets.Peers.FirstOrDefault(sc => newActiveChat == 0 || sc.chat_id == newActiveChat); - Console.WriteLine("Active secret chat ID: " + ActiveChat?.chat_id); + ActiveChat = Secrets.Chats.FirstOrDefault(sc => newActiveChat == 0 || sc.ChatId == newActiveChat); + Console.WriteLine("Active secret chat ID: " + ActiveChat?.ChatId); } } } diff --git a/FAQ.md b/FAQ.md index 188d5dd..9a1c8d8 100644 --- a/FAQ.md +++ b/FAQ.md @@ -140,7 +140,7 @@ Some additional advices from me: 5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdate` events. 6. Don't buy fake user accounts/sessions and don't extract api_id/hash/authkey/sessions from official clients, this is [specifically forbidden by API TOS](https://core.telegram.org/api/terms#2-transparency). You must use your own api_id and create your own sessions associated with it. -7. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happens often with VoIP or other easy-to-buy-online numbers, so expect fast ban) +7. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happen often with VoIP or other easy-to-buy-online numbers, so expect fast ban) 8. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient. 9. When creating a new API ID/Hash, I recommend you use your own phone number with long history of normal Telegram usage, rather than a brand new phone number with short history. In particular, DON'T create an API ID/Hash for every phone numbers you will control. One API ID/Hash represents your application, which can be used to control several user accounts. diff --git a/src/Encryption.cs b/src/Encryption.cs index 450e35f..a3a3eaf 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -531,7 +531,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB private readonly ICryptoTransform aesCrypto; private readonly byte[] prevBytes; - public AES_IGE_Stream(Stream stream, int size, byte[] key, byte[] iv) : this(stream, key, iv, false) { ContentLength = size; } + public AES_IGE_Stream(Stream stream, long size, byte[] key, byte[] iv) : this(stream, key, iv, false) { ContentLength = size; } public AES_IGE_Stream(Stream stream, byte[] key, byte[] iv, bool encrypt) : base(stream) { aesCrypto = encrypt ? Encryption.AesECB.CreateEncryptor(key, null) : Encryption.AesECB.CreateDecryptor(key, null); diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 8065b5f..b857422 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -13,6 +13,14 @@ using static WTelegram.Encryption; namespace WTelegram { + public interface ISecretChat + { + int ChatId { get; } + long RemoteUserId { get; } + InputEncryptedChat Peer { get; } + int RemoteLayer { get; } + } + public sealed class SecretChats : IDisposable { public event Action OnChanged; @@ -28,7 +36,7 @@ namespace WTelegram private const int ThresholdPFS = 100; [TLDef(0xFEFEFEFE)] - internal class SecretChat : IObject + internal class SecretChat : IObject, ISecretChat { [Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 } public Flags flags; @@ -43,8 +51,12 @@ namespace WTelegram public long exchange_id; public int ChatId => peer.chat_id; + public long RemoteUserId => participant_id; + public InputEncryptedChat Peer => peer; + public int RemoteLayer => remoteLayer; + internal long key_fingerprint; - internal SortedList pendingMsgs = new(); + internal SortedList pendingMsgs = new(); internal void Discarded() // clear out fields for more security { Array.Clear(authKey, 0, authKey.Length); @@ -67,13 +79,7 @@ namespace WTelegram } public void Dispose() { OnChanged?.Invoke(); storage?.Dispose(); sha256.Dispose(); sha1.Dispose(); } - public List Peers => chats.Values.Select(sc => sc.peer).ToList(); - - /// Return secret chats with the given remote user ID - /// remote user ID - /// List of matching secret chat ids/access_hash - public List FindChatsByParticipant(long participant_id) - => chats.Where(kvp => kvp.Value.participant_id == participant_id).Select(kvp => kvp.Value.peer).ToList(); + public List Chats => chats.Values.ToList(); public bool IsChatActive(int chat_id) => !(chats.GetValueOrDefault(chat_id)?.flags.HasFlag(SecretChat.Flags.requestChat) ?? true); @@ -253,16 +259,16 @@ namespace WTelegram private async Task SendNotifyLayer(SecretChat chat) { - await SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer17.DecryptedMessageActionNotifyLayer { layer = Layer.SecretChats } }); + await SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionNotifyLayer { layer = Layer.SecretChats } }); if (chat.remoteLayer < Layer.MTProto2) chat.remoteLayer = Layer.MTProto2; } /// Encrypt and send a message on a secret chat - /// You would typically pass an instance of or that you created and filled + /// You would typically pass an instance of or that you created and filled ///
Remember to fill random_id with , and the flags field if necessary
/// Secret Chat ID - /// The pre-filled DecryptedMessage or DecryptedMessageService to send + /// The pre-filled DecryptedMessage or DecryptedMessageService to send /// Send encrypted message without a notification /// Optional file attachment. See method UploadFile /// Confirmation of sent message @@ -271,7 +277,7 @@ namespace WTelegram if (!chats.TryGetValue(chatId, out var chat)) throw new ApplicationException("Secret chat not found"); try { - var dml = new TL.Layer17.DecryptedMessageLayer + var dml = new TL.Layer23.DecryptedMessageLayer { layer = Math.Min(chat.remoteLayer, Layer.SecretChats), random_bytes = new byte[15], @@ -290,7 +296,7 @@ namespace WTelegram } } - private async Task SendMessage(SecretChat chat, TL.Layer17.DecryptedMessageLayer dml, bool silent = false, InputEncryptedFileBase file = null) + private async Task SendMessage(SecretChat chat, TL.Layer23.DecryptedMessageLayer dml, bool silent = false, InputEncryptedFileBase file = null) { RNG.GetBytes(dml.random_bytes); int x = 8 - (int)(chat.flags & SecretChat.Flags.originator); @@ -321,7 +327,7 @@ namespace WTelegram CheckPFS(chat); if (file != null) return await client.Messages_SendEncryptedFile(chat.peer, dml.message.RandomId, data, file, silent); - else if (dml.message is TL.Layer17.DecryptedMessageService or TL.Layer8.DecryptedMessageService) + else if (dml.message is TL.Layer23.DecryptedMessageService or TL.Layer8.DecryptedMessageService) return await client.Messages_SendEncryptedService(chat.peer, dml.message.RandomId, data); else return await client.Messages_SendEncrypted(chat.peer, dml.message.RandomId, data, silent); @@ -360,7 +366,7 @@ namespace WTelegram /// Decrypt an encrypted message obtained in /// Encrypted /// If messages are missing or received in wrong order, automatically request to resend missing messages - /// An array of DecryptedMessage or DecryptedMessageService from various TL.LayerXX namespaces.
+ /// An array of DecryptedMessage or DecryptedMessageService from various TL.LayerXX namespaces.
/// You can use the generic properties to access their fields /// May return an empty array if msg was already previously received or is not the next message in sequence. ///
May return multiple messages if missing messages are finally received (using = true)
@@ -371,7 +377,7 @@ namespace WTelegram try { var obj = Decrypt(chat, msg.Bytes, msg.Bytes.Length); - if (obj is not TL.Layer17.DecryptedMessageLayer dml) throw new ApplicationException("Decrypted object is not DecryptedMessageLayer"); + if (obj is not TL.Layer23.DecryptedMessageLayer dml) throw new ApplicationException("Decrypted object is not DecryptedMessageLayer"); if (dml.random_bytes.Length < 15) throw new ApplicationException("Not enough random_bytes"); if (((dml.out_seq_no ^ dml.in_seq_no) & 1) != 1 || ((dml.out_seq_no ^ chat.in_seq_no) & 1) != 0) throw new ApplicationException("Invalid seq_no parities"); if (dml.layer > chat.remoteLayer) chat.remoteLayer = dml.layer; @@ -384,8 +390,8 @@ namespace WTelegram if (lastPending == 0) lastPending = chat.in_seq_no; chat.pendingMsgs[dml.out_seq_no] = dml; if (dml.out_seq_no > lastPending + 2) // send request to resend missing gap asynchronously - _ = SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer17.DecryptedMessageActionResend { start_seq_no = lastPending + 2, end_seq_no = dml.out_seq_no - 2 } }); + _ = SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionResend { start_seq_no = lastPending + 2, end_seq_no = dml.out_seq_no - 2 } }); return Array.Empty(); } chat.in_seq_no = dml.out_seq_no; @@ -423,13 +429,13 @@ namespace WTelegram { switch (action) { - case TL.Layer17.DecryptedMessageActionNotifyLayer dmanl: + case TL.Layer23.DecryptedMessageActionNotifyLayer dmanl: chat.remoteLayer = dmanl.layer; return true; - case TL.Layer17.DecryptedMessageActionResend resend: + case TL.Layer23.DecryptedMessageActionResend resend: Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> Resend {resend.start_seq_no}-{resend.end_seq_no}"); - var msgSvc = new TL.Layer17.DecryptedMessageService { action = new TL.Layer20.DecryptedMessageActionNoop() }; - var dml = new TL.Layer17.DecryptedMessageLayer + var msgSvc = new TL.Layer23.DecryptedMessageService { action = new TL.Layer23.DecryptedMessageActionNoop() }; + var dml = new TL.Layer23.DecryptedMessageLayer { layer = Math.Min(chat.remoteLayer, Layer.SecretChats), random_bytes = new byte[15], @@ -442,13 +448,13 @@ namespace WTelegram _ = SendMessage(chat, dml); } return true; - case TL.Layer20.DecryptedMessageActionNoop: + case TL.Layer23.DecryptedMessageActionNoop: Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> Noop"); return true; - case TL.Layer20.DecryptedMessageActionRequestKey: - case TL.Layer20.DecryptedMessageActionAcceptKey: - case TL.Layer20.DecryptedMessageActionCommitKey: - case TL.Layer20.DecryptedMessageActionAbortKey: + case TL.Layer23.DecryptedMessageActionRequestKey: + case TL.Layer23.DecryptedMessageActionAcceptKey: + case TL.Layer23.DecryptedMessageActionCommitKey: + case TL.Layer23.DecryptedMessageActionAbortKey: Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> PFS {action.GetType().Name[22..]}"); HandlePFS(chat, action); return true; @@ -465,16 +471,17 @@ namespace WTelegram else { Helpers.Log(4, "SC{(short)chat.ChatId:X4}> PFS Failure"); _ = Discard(chat.ChatId); return; } try { + chat.flags |= SecretChat.Flags.renewKey; Helpers.Log(1, $"SC{(short)chat.ChatId:X4}> PFS RenewKey"); + await Task.Delay(100); chat.salt = new byte[256]; RNG.GetBytes(chat.salt); var a = BigEndianInteger(chat.salt); var g_a = BigInteger.ModPow(dh.g, a, dh_prime); CheckGoodGaAndGb(g_a, dh_prime); - chat.flags |= SecretChat.Flags.renewKey; chat.exchange_id = Helpers.RandomLong(); - await SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer20.DecryptedMessageActionRequestKey { exchange_id = chat.exchange_id, g_a = g_a.To256Bytes() } }); + await SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionRequestKey { exchange_id = chat.exchange_id, g_a = g_a.To256Bytes() } }); } catch (Exception ex) { @@ -489,7 +496,7 @@ namespace WTelegram { switch (action) { - case TL.Layer20.DecryptedMessageActionRequestKey request: + case TL.Layer23.DecryptedMessageActionRequestKey request: switch (chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) { case SecretChat.Flags.renewKey: // Concurrent Re-Keying @@ -517,10 +524,10 @@ namespace WTelegram chat.salt = gab.To256Bytes(); chat.exchange_id = request.exchange_id; var key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(chat.salt).AsSpan(12)); - await SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer20.DecryptedMessageActionAcceptKey { exchange_id = request.exchange_id, g_b = g_b.To256Bytes(), key_fingerprint = key_fingerprint } }); + await SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionAcceptKey { exchange_id = request.exchange_id, g_b = g_b.To256Bytes(), key_fingerprint = key_fingerprint } }); break; - case TL.Layer20.DecryptedMessageActionAcceptKey accept: + case TL.Layer23.DecryptedMessageActionAcceptKey accept: if ((chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) != SecretChat.Flags.renewKey) throw new ApplicationException("Invalid AcceptKey"); if (accept.exchange_id != chat.exchange_id) @@ -533,13 +540,13 @@ namespace WTelegram key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(authKey).AsSpan(12)); if (accept.key_fingerprint != key_fingerprint) throw new ApplicationException("AcceptKey: key_fingerprint mismatch"); - _ = SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer20.DecryptedMessageActionCommitKey { exchange_id = accept.exchange_id, key_fingerprint = accept.key_fingerprint } }); + _ = SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionCommitKey { exchange_id = accept.exchange_id, key_fingerprint = accept.key_fingerprint } }); chat.salt = chat.authKey; // A may only discard the previous key after a message encrypted with the new key has been received. SetAuthKey(chat, authKey); chat.flags = chat.flags & ~SecretChat.Flags.renewKey | SecretChat.Flags.commitKey; break; - case TL.Layer20.DecryptedMessageActionCommitKey commit: + case TL.Layer23.DecryptedMessageActionCommitKey commit: if ((chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) != SecretChat.Flags.acceptKey) throw new ApplicationException("Invalid RequestKey"); key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(chat.salt).AsSpan(12)); @@ -549,10 +556,10 @@ namespace WTelegram authKey = chat.authKey; SetAuthKey(chat, chat.salt); Array.Clear(authKey, 0, authKey.Length); // the old key must be securely discarded - await SendMessage(chat.ChatId, new TL.Layer17.DecryptedMessageService { random_id = Helpers.RandomLong(), - action = new TL.Layer20.DecryptedMessageActionNoop() }); + await SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), + action = new TL.Layer23.DecryptedMessageActionNoop() }); break; - case TL.Layer20.DecryptedMessageActionAbortKey abort: + case TL.Layer23.DecryptedMessageActionAbortKey abort: if ((chat.flags & (SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) == 0 || chat.flags.HasFlag(SecretChat.Flags.commitKey) || abort.exchange_id != chat.exchange_id) return; @@ -579,7 +586,7 @@ namespace WTelegram byte[] aes_key = new byte[32], aes_iv = new byte[32]; RNG.GetBytes(aes_key); RNG.GetBytes(aes_iv); - media.SizeKeyIV = (checked((int)stream.Length), aes_key, aes_iv); + media.SizeKeyIV = (stream.Length, aes_key, aes_iv); using var md5 = MD5.Create(); md5.TransformBlock(aes_key, 0, 32, null, 0); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index eb74e8c..a9026f8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -13179,7 +13179,7 @@ namespace TL public DocumentBase static_icon; /// The animated sticker to show when the user opens the reaction dropdown public DocumentBase appear_animation; - /// The animated sticker to show when the user selects this reaction + /// The animated sticker to show when the user hovers over the reaction public DocumentBase select_animation; /// The animated sticker to show when the reaction is chosen and activated public DocumentBase activate_animation; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 1cf43a6..1253e9b 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -32,7 +32,7 @@ namespace TL public abstract class DecryptedMessageMedia : IObject { public virtual string MimeType { get; } - internal virtual (int size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } + internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } } /// Object describes the action to which a service message is linked. See @@ -110,7 +110,7 @@ namespace TL public byte[] iv; public override string MimeType => "image/jpeg"; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] @@ -135,7 +135,7 @@ namespace TL /// Initialization vector public byte[] iv; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] @@ -182,7 +182,7 @@ namespace TL /// File MIME-type public override string MimeType => mime_type; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] @@ -197,7 +197,7 @@ namespace TL /// Initialization vector public byte[] iv; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// Setting of a message lifetime after reading. See @@ -233,8 +233,43 @@ namespace TL public class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } - namespace Layer17 + namespace Layer23 { + /// Image description. See + [TLDef(0x77BFB61B)] + public partial class PhotoSize : PhotoSizeBase + { + /// Thumbnail type » + public string type; + public FileLocationBase location; + /// Image width + public int w; + /// Image height + public int h; + /// File size + public int size; + + /// Thumbnail type » + public override string Type => type; + } + /// Description of an image and its content. See + [TLDef(0xE9A734FA)] + public partial class PhotoCachedSize : PhotoSizeBase + { + /// Thumbnail type + public string type; + public FileLocationBase location; + /// Image width + public int w; + /// Image height + public int h; + /// Binary data, file content + public byte[] bytes; + + /// Thumbnail type + public override string Type => type; + } + /// User is uploading a video. See [TLDef(0x92042FF7)] public class SendMessageUploadVideoAction : SendMessageAction { } @@ -248,6 +283,28 @@ namespace TL [TLDef(0x8FAEE98E)] public class SendMessageUploadDocumentAction : SendMessageAction { } + /// Defines a sticker See + [TLDef(0xFB0A5727)] + public class DocumentAttributeSticker : DocumentAttribute { } + /// Defines a video See + [TLDef(0x5910CCCB)] + public class DocumentAttributeVideo : DocumentAttribute + { + /// Duration in seconds + public int duration; + /// Video width + public int w; + /// Video height + public int h; + } + /// Represents an audio file See + [TLDef(0x051448E5)] + public class DocumentAttributeAudio : DocumentAttribute + { + /// Duration in seconds + public int duration; + } + /// Contents of an encrypted message. See [TLDef(0x204D3878)] public class DecryptedMessage : DecryptedMessageBase @@ -313,7 +370,7 @@ namespace TL /// MIME-type of the video file
Parameter added in Layer 17.
public override string MimeType => mime_type; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } ///
Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] @@ -333,7 +390,31 @@ namespace TL /// MIME-type of the audio file
Parameter added in Layer 13.
public override string MimeType => mime_type; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } + } + ///
Non-e2e documented forwarded from non-secret chat See + [TLDef(0xFA95B0DD)] + public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia + { + /// Document ID + public long id; + /// access hash + public long access_hash; + /// Date + public DateTime date; + /// Mime type + public string mime_type; + /// Size + public int size; + /// Thumbnail + public PhotoSizeBase thumb; + /// DC ID + public int dc_id; + /// Attributes for media types + public DocumentAttribute[] attributes; + + /// Mime type + public override string MimeType => mime_type; } /// Request for the other party in a Secret Chat to automatically resend a contiguous range of previously sent messages, as explained in Sequence number is Secret Chats. See @@ -359,6 +440,45 @@ namespace TL /// Type of action public SendMessageAction action; } + /// Request rekeying, see rekeying process See + [TLDef(0xF3C9611B)] + public class DecryptedMessageActionRequestKey : DecryptedMessageAction + { + /// Exchange ID + public long exchange_id; + /// g_a, see rekeying process + public byte[] g_a; + } + /// Accept new key See + [TLDef(0x6FE1735B)] + public class DecryptedMessageActionAcceptKey : DecryptedMessageAction + { + /// Exchange ID + public long exchange_id; + /// B parameter, see rekeying process + public byte[] g_b; + /// Key fingerprint, see rekeying process + public long key_fingerprint; + } + /// Abort rekeying See + [TLDef(0xDD05EC6B)] + public class DecryptedMessageActionAbortKey : DecryptedMessageAction + { + /// Exchange ID + public long exchange_id; + } + /// Commit new key, see rekeying process See + [TLDef(0xEC2E0B9B)] + public class DecryptedMessageActionCommitKey : DecryptedMessageAction + { + /// Exchange ID, see rekeying process + public long exchange_id; + /// Key fingerprint, see rekeying process + public long key_fingerprint; + } + /// NOOP action See + [TLDef(0xA82FDD63)] + public class DecryptedMessageActionNoop : DecryptedMessageAction { } /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] @@ -375,19 +495,49 @@ namespace TL /// The content of message itself public DecryptedMessageBase message; } + + /// File is currently unavailable. See + [TLDef(0x7C596B46)] + public class FileLocationUnavailable : FileLocationBase + { + /// Server volume + public long volume_id; + /// File ID + public int local_id; + /// Checksum to access the file + public long secret; + + /// Server volume + public override long VolumeId => volume_id; + /// File ID + public override int LocalId => local_id; + /// Checksum to access the file + public override long Secret => secret; + } + /// File location. See + [TLDef(0x53D69076)] + public class FileLocation : FileLocationBase + { + /// Number of the data center holding the file + public int dc_id; + /// Server volume + public long volume_id; + /// File ID + public int local_id; + /// Checksum to access the file + public long secret; + + /// Server volume + public override long VolumeId => volume_id; + /// File ID + public override int LocalId => local_id; + /// Checksum to access the file + public override long Secret => secret; + } } namespace Layer45 { - /// Defines a sticker See - [TLDef(0x3A556302)] - public class DocumentAttributeSticker : DocumentAttribute - { - /// Alternative emoji representation of sticker - public string alt; - /// Associated stickerset - public InputStickerSet stickerset; - } /// Represents an audio file See [TLDef(0xDED218E0)] public class DocumentAttributeAudio : DocumentAttribute @@ -399,6 +549,27 @@ namespace TL /// Performer public string performer; } + } + + namespace Layer46 + { + /// Defines a sticker See + [TLDef(0x3A556302)] + public class DocumentAttributeSticker : DocumentAttribute + { + /// Alternative emoji representation of sticker + public string alt; + /// Associated stickerset + public InputStickerSet stickerset; + } + + /// Message entity representing a user mention: for creating a mention use . See + [TLDef(0x352DCA58, inheritBefore = true)] + public class MessageEntityMentionName : MessageEntityMention + { + /// Identifier of the user that was mentioned + public int user_id; + } /// Contents of an encrypted message. See [TLDef(0x36B091DE)] @@ -475,7 +646,7 @@ namespace TL public string caption; public override string MimeType => "image/jpeg"; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] @@ -507,7 +678,7 @@ namespace TL /// MIME-type of the video file
Parameter added in Layer 17.
public override string MimeType => mime_type; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } ///
Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] @@ -535,7 +706,7 @@ namespace TL /// File MIME-type public override string MimeType => mime_type; - internal override (int, byte[], byte[]) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = (checked((int)value.size), value.key, value.iv); } } /// Venue See [TLDef(0x8A0DF56F)] @@ -563,6 +734,13 @@ namespace TL } } + namespace Layer66 + { + /// User is uploading a round video See + [TLDef(0xBB718624)] + public class SendMessageUploadRoundAction : SendMessageAction { } + } + namespace Layer73 { /// Contents of an encrypted message. See @@ -592,6 +770,8 @@ namespace TL { /// Field has a value has_reply_to_random_id = 0x8, + /// Whether this is a silent message (no notification triggered) + silent = 0x20, /// Field has a value has_entities = 0x80, /// Field has a value @@ -623,180 +803,41 @@ namespace TL } } - namespace Layer20 + namespace Layer101 + { } + + namespace Layer143 { - /// Request rekeying, see rekeying process See - [TLDef(0xF3C9611B)] - public class DecryptedMessageActionRequestKey : DecryptedMessageAction + /// Document attached to a message in a secret chat. See + [TLDef(0x6ABD9782)] + public class DecryptedMessageMediaDocument : DecryptedMessageMedia { - /// Exchange ID - public long exchange_id; - /// g_a, see rekeying process - public byte[] g_a; - } - /// Accept new key See - [TLDef(0x6FE1735B)] - public class DecryptedMessageActionAcceptKey : DecryptedMessageAction - { - /// Exchange ID - public long exchange_id; - /// B parameter, see rekeying process - public byte[] g_b; - /// Key fingerprint, see rekeying process - public long key_fingerprint; - } - /// Abort rekeying See - [TLDef(0xDD05EC6B)] - public class DecryptedMessageActionAbortKey : DecryptedMessageAction - { - /// Exchange ID - public long exchange_id; - } - /// Commit new key, see rekeying process See - [TLDef(0xEC2E0B9B)] - public class DecryptedMessageActionCommitKey : DecryptedMessageAction - { - /// Exchange ID, see rekeying process - public long exchange_id; - /// Key fingerprint, see rekeying process - public long key_fingerprint; - } - /// NOOP action See - [TLDef(0xA82FDD63)] - public class DecryptedMessageActionNoop : DecryptedMessageAction { } - } - - namespace Layer23 - { - /// Image description. See - [TLDef(0x77BFB61B)] - public partial class PhotoSize : PhotoSizeBase - { - /// Thumbnail type » - public string type; - public FileLocationBase location; - /// Image width - public int w; - /// Image height - public int h; - /// File size - public int size; - - /// Thumbnail type » - public override string Type => type; - } - /// Description of an image and its content. See - [TLDef(0xE9A734FA)] - public partial class PhotoCachedSize : PhotoSizeBase - { - /// Thumbnail type - public string type; - public FileLocationBase location; - /// Image width - public int w; - /// Image height - public int h; - /// Binary data, file content - public byte[] bytes; - - /// Thumbnail type - public override string Type => type; - } - - /// Defines a sticker See - [TLDef(0xFB0A5727)] - public class DocumentAttributeSticker : DocumentAttribute { } - /// Defines a video See - [TLDef(0x5910CCCB)] - public class DocumentAttributeVideo : DocumentAttribute - { - /// Duration in seconds - public int duration; - /// Video width - public int w; - /// Video height - public int h; - } - /// Represents an audio file See - [TLDef(0x051448E5)] - public class DocumentAttributeAudio : DocumentAttribute - { - /// Duration in seconds - public int duration; - } - - /// Non-e2e documented forwarded from non-secret chat See - [TLDef(0xFA95B0DD)] - public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia - { - /// Document ID - public long id; - /// access hash - public long access_hash; - /// Date - public DateTime date; - /// Mime type + /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) + public byte[] thumb; + /// Thumbnail width + public int thumb_w; + /// Thumbnail height + public int thumb_h; + /// File MIME-type public string mime_type; - /// Size - public int size; - /// Thumbnail - public PhotoSizeBase thumb; - /// DC ID - public int dc_id; - /// Attributes for media types + /// Document size ( on layer <143, on layer >=143) + public long size; + /// Key to decrypt the attached document file + public byte[] key; + /// Initialization + public byte[] iv; + /// Document attributes for media types public DocumentAttribute[] attributes; + /// Caption + public string caption; - /// Mime type + /// File MIME-type public override string MimeType => mime_type; - } - /// File is currently unavailable. See - [TLDef(0x7C596B46)] - public class FileLocationUnavailable : FileLocationBase - { - /// Server volume - public long volume_id; - /// File ID - public int local_id; - /// Checksum to access the file - public long secret; - - /// Server volume - public override long VolumeId => volume_id; - /// File ID - public override int LocalId => local_id; - /// Checksum to access the file - public override long Secret => secret; - } - /// File location. See - [TLDef(0x53D69076)] - public class FileLocation : FileLocationBase - { - /// Number of the data center holding the file - public int dc_id; - /// Server volume - public long volume_id; - /// File ID - public int local_id; - /// Checksum to access the file - public long secret; - - /// Server volume - public override long VolumeId => volume_id; - /// File ID - public override int LocalId => local_id; - /// Checksum to access the file - public override long Secret => secret; + internal override (long size, byte[] key, byte[] iv) SizeKeyIV { get => (size, key, iv); set => (size, key, iv) = value; } } } - namespace Layer66 - { - /// User is uploading a round video See - [TLDef(0xBB718624)] - public class SendMessageUploadRoundAction : SendMessageAction { } - } - - namespace Layer46 + namespace Layer144 { } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 77a69be..50a3c11 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -7,7 +7,7 @@ namespace TL public static class Layer { public const int Version = 148; // fetched 01/11/2022 17:33:23 - internal const int SecretChats = 101; + internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; internal const uint NullCtor = 0x56730BCC; @@ -1047,54 +1047,56 @@ namespace TL [0x71701DA9] = typeof(ForumTopic), [0x367617D3] = typeof(Messages_ForumTopics), // from TL.Secret: + [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), + [0x91CC4674] = typeof(Layer73.DecryptedMessage), [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), - [0xE50511D8] = typeof(Layer45.DecryptedMessageMediaWebPage), - [0x8A0DF56F] = typeof(Layer45.DecryptedMessageMediaVenue), + [0xE50511D8] = typeof(Layer46.DecryptedMessageMediaWebPage), + [0x8A0DF56F] = typeof(Layer46.DecryptedMessageMediaVenue), + [0x352DCA58] = typeof(Layer46.MessageEntityMentionName), + [0x3A556302] = typeof(Layer46.DocumentAttributeSticker), + [0x7AFE8AE2] = typeof(Layer46.DecryptedMessageMediaDocument), + [0x970C8C0E] = typeof(Layer46.DecryptedMessageMediaVideo), + [0xF1FA8D78] = typeof(Layer46.DecryptedMessageMediaPhoto), + [0x36B091DE] = typeof(Layer46.DecryptedMessage), + [0xDED218E0] = typeof(Layer45.DocumentAttributeAudio), [0xFA95B0DD] = typeof(Layer23.DecryptedMessageMediaExternalDocument), [0x53D69076] = typeof(Layer23.FileLocation), [0x7C596B46] = typeof(Layer23.FileLocationUnavailable), [0xE9A734FA] = typeof(Layer23.PhotoCachedSize), [0x77BFB61B] = typeof(Layer23.PhotoSize), - [0xDED218E0] = typeof(Layer45.DocumentAttributeAudio), [0x051448E5] = typeof(Layer23.DocumentAttributeAudio), [0x5910CCCB] = typeof(Layer23.DocumentAttributeVideo), - [0x3A556302] = typeof(Layer45.DocumentAttributeSticker), [0xFB0A5727] = typeof(Layer23.DocumentAttributeSticker), - [0xA82FDD63] = typeof(Layer20.DecryptedMessageActionNoop), - [0xEC2E0B9B] = typeof(Layer20.DecryptedMessageActionCommitKey), - [0xDD05EC6B] = typeof(Layer20.DecryptedMessageActionAbortKey), - [0x6FE1735B] = typeof(Layer20.DecryptedMessageActionAcceptKey), - [0xF3C9611B] = typeof(Layer20.DecryptedMessageActionRequestKey), - [0xCCB27641] = typeof(Layer17.DecryptedMessageActionTyping), - [0xF3048883] = typeof(Layer17.DecryptedMessageActionNotifyLayer), - [0x511110B0] = typeof(Layer17.DecryptedMessageActionResend), - [0x8FAEE98E] = typeof(Layer17.SendMessageUploadDocumentAction), - [0x990A3C1A] = typeof(Layer17.SendMessageUploadPhotoAction), - [0xE6AC8A6F] = typeof(Layer17.SendMessageUploadAudioAction), - [0x92042FF7] = typeof(Layer17.SendMessageUploadVideoAction), - [0x1BE31789] = typeof(Layer17.DecryptedMessageLayer), + [0xA82FDD63] = typeof(Layer23.DecryptedMessageActionNoop), + [0xEC2E0B9B] = typeof(Layer23.DecryptedMessageActionCommitKey), + [0xDD05EC6B] = typeof(Layer23.DecryptedMessageActionAbortKey), + [0x6FE1735B] = typeof(Layer23.DecryptedMessageActionAcceptKey), + [0xF3C9611B] = typeof(Layer23.DecryptedMessageActionRequestKey), + [0xCCB27641] = typeof(Layer23.DecryptedMessageActionTyping), + [0xF3048883] = typeof(Layer23.DecryptedMessageActionNotifyLayer), + [0x511110B0] = typeof(Layer23.DecryptedMessageActionResend), + [0x8FAEE98E] = typeof(Layer23.SendMessageUploadDocumentAction), + [0x990A3C1A] = typeof(Layer23.SendMessageUploadPhotoAction), + [0xE6AC8A6F] = typeof(Layer23.SendMessageUploadAudioAction), + [0x92042FF7] = typeof(Layer23.SendMessageUploadVideoAction), + [0x1BE31789] = typeof(Layer23.DecryptedMessageLayer), + [0x57E0A9CB] = typeof(Layer23.DecryptedMessageMediaAudio), + [0x524A415D] = typeof(Layer23.DecryptedMessageMediaVideo), + [0x73164160] = typeof(Layer23.DecryptedMessageService), + [0x204D3878] = typeof(Layer23.DecryptedMessage), [0x6719E45C] = typeof(Layer8.DecryptedMessageActionFlushHistory), [0x8AC1F475] = typeof(Layer8.DecryptedMessageActionScreenshotMessages), [0x65614304] = typeof(Layer8.DecryptedMessageActionDeleteMessages), [0x0C4F40BE] = typeof(Layer8.DecryptedMessageActionReadMessages), - [0x57E0A9CB] = typeof(Layer17.DecryptedMessageMediaAudio), [0x6080758F] = typeof(Layer8.DecryptedMessageMediaAudio), - [0x7AFE8AE2] = typeof(Layer45.DecryptedMessageMediaDocument), [0xB095434B] = typeof(Layer8.DecryptedMessageMediaDocument), [0xA1733AEC] = typeof(Layer8.DecryptedMessageActionSetMessageTTL), [0x588A0A97] = typeof(Layer8.DecryptedMessageMediaContact), [0x35480A59] = typeof(Layer8.DecryptedMessageMediaGeoPoint), - [0x970C8C0E] = typeof(Layer45.DecryptedMessageMediaVideo), - [0x524A415D] = typeof(Layer17.DecryptedMessageMediaVideo), [0x4CEE6EF3] = typeof(Layer8.DecryptedMessageMediaVideo), - [0xF1FA8D78] = typeof(Layer45.DecryptedMessageMediaPhoto), [0x32798A8C] = typeof(Layer8.DecryptedMessageMediaPhoto), [0x089F5C4A] = null,//Layer8.DecryptedMessageMediaEmpty - [0x73164160] = typeof(Layer17.DecryptedMessageService), [0xAA48327D] = typeof(Layer8.DecryptedMessageService), - [0x91CC4674] = typeof(Layer73.DecryptedMessage), - [0x36B091DE] = typeof(Layer45.DecryptedMessage), - [0x204D3878] = typeof(Layer17.DecryptedMessage), [0x1F814F1F] = typeof(Layer8.DecryptedMessage), }; From 6b3fcdb967a4bdc255382d64e33e54be528c7d01 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 11 Nov 2022 01:47:37 +0100 Subject: [PATCH 013/336] Trying to add ReleaseNotes in nuget package --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/WTelegramClient.csproj | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 02d8f36..cd20498 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(ReleaseNotes)"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 diff --git a/.github/release.yml b/.github/release.yml index 250e994..180eb0e 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -31,7 +31,7 @@ stages: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(ReleaseNotes)"' - task: NuGetCommand@2 inputs: diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1356ff0..8fce696 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,6 +23,7 @@ git Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md + $(ReleaseNotes.Replace('|',$([System.Environment]::NewLine))) IDE0079;0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION
From ba523f7d21c7273d1b35bafcba3ff73ccafcafe5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 12 Nov 2022 19:40:34 +0100 Subject: [PATCH 014/336] Releasing 3.1.1 --- README.md | 20 ++++++++++---------- src/WTelegramClient.csproj | 6 +++--- 2 files changed, 13 insertions(+), 13 deletions(-) diff --git a/README.md b/README.md index 16da3f6..436378c 100644 --- a/README.md +++ b/README.md @@ -96,15 +96,15 @@ await DoLogin("+12025550156"); // user's phone_number async Task DoLogin(string loginInfo) // (add this method to your code) { - while (client.User == null) - switch (await client.Login(loginInfo)) // returns which config info is needed to continue login - { - case "verification_code": Console.Write("Code: "); loginInfo = Console.ReadLine(); break; - case "name": loginInfo = "John Doe"; break; // if sign-up is required (first_name last_name) - case "password": loginInfo = "secret!"; break; // if user has enabled 2FA - default: loginInfo = null; break; - } - Console.WriteLine($"We are logged-in as {client.User} (id {client.User.id})"); + while (client.User == null) + switch (await client.Login(loginInfo)) // returns which config is needed to continue login + { + case "verification_code": Console.Write("Code: "); loginInfo = Console.ReadLine(); break; + case "name": loginInfo = "John Doe"; break; // if sign-up is required (first/last_name) + case "password": loginInfo = "secret!"; break; // if user has enabled 2FA + default: loginInfo = null; break; + } + Console.WriteLine($"We are logged-in as {client.User} (id {client.User.id})"); } ``` @@ -134,7 +134,7 @@ foreach (var (id, chat) in chats.chats) switch (chat) // example of downcasting to their real classes: { case Chat basicChat when basicChat.IsActive: - Console.WriteLine($"{id}: Basic chat: {basicChat.title} with {basicChat.participants_count} members"); + Console.WriteLine($"{id}: Basic chat: {basicChat.title}"); break; case Channel group when group.IsGroup: Console.WriteLine($"{id}: Group {group.username}: {group.title}"); diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8fce696..5ff24ba 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl README.md - $(ReleaseNotes.Replace('|',$([System.Environment]::NewLine))) + $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) IDE0079;0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION @@ -42,9 +42,9 @@ - + From fe5773ce290357daf0121daa6bdfb76b121f06e0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 12 Nov 2022 20:02:46 +0100 Subject: [PATCH 015/336] Add release notes in Description too --- .github/dev.yml | 2 +- src/WTelegramClient.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index cd20498..4352170 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.1.1-dev.$(Rev:r) +name: 3.1.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 5ff24ba..51eaaab 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & Telegram API layer version + Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & Telegram API layer version Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient From 61510465d218519c891a1b83128512827edf4d91 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 13 Nov 2022 00:25:56 +0100 Subject: [PATCH 016/336] =?UTF-8?q?Fix=20immediate=20crash=20=F0=9F=A4=A6?= =?UTF-8?q?=F0=9F=8F=BB=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index 27b4c8a..e9506ae 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -104,7 +104,7 @@ namespace WTelegram _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; var version = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion; - Helpers.Log(1, $"WTelegramClient {version[..version.IndexOf('+')]} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); + Helpers.Log(1, $"WTelegramClient {version} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); } private Client(Client cloneOf, Session.DCSession dcSession) From 2047154d2651e5cc730e475b3aabdff8aad12e27 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 15 Nov 2022 16:20:00 +0100 Subject: [PATCH 017/336] doc --- .github/dev.yml | 2 +- README.md | 4 ++-- src/Client.Helpers.cs | 5 +++-- src/Client.cs | 2 +- 4 files changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4352170..d26fff4 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.1.2-dev.$(Rev:r) +name: 3.1.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 436378c..b4369aa 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,8 @@ -[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient)](https://www.nuget.org/packages/WTelegramClient/) +[![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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-148-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) +[![Support Chat](https://img.shields.io/badge/Contact_us-on_Telegram-238EC2)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) ## _Telegram Client API library written 100% in C# and .NET Standard_ diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index b809f94..3ef85f2 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -16,7 +16,7 @@ namespace WTelegram partial class Client { #region Collect Access Hash system - /// Enable the collection of id/access_hash pairs (experimental) + /// Enable the collection of id/access_hash pairs (experimental)
See
public bool CollectAccessHash { get; set; } public IEnumerable> AllAccessHashesFor() where T : IObject => _accessHashes.GetValueOrDefault(typeof(T)); private readonly Dictionary> _accessHashes = new(); @@ -25,10 +25,11 @@ namespace WTelegram /// Retrieve the access_hash associated with this id (for a TL class) if it was collected /// This requires to be set to first. - ///
See Examples/Program_CollectAccessHash.cs for how to use this
+ /// See Examples/Program_CollectAccessHash.cs for how to use this /// a TL object class. For example User, Channel or Photo public long GetAccessHashFor(long id) where T : IObject { + if (!CollectAccessHash) Helpers.Log(4, "GetAccessHashFor doesn't do what you think. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash"); lock (_accessHashes) return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : 0; } diff --git a/src/Client.cs b/src/Client.cs index e9506ae..891764a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -49,7 +49,7 @@ namespace WTelegram public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); /// ID of the current logged-in user or 0 public long UserId => _session.UserId; - /// Info about the current logged-in user + /// Info about the current logged-in user. This is filled after a successful (re)login public User User { get; private set; } private Func _config; From adf61349119617177f91cc72416e7dcbcfdc1fc3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 19 Nov 2022 02:03:48 +0100 Subject: [PATCH 018/336] Doc/Rationalize user/chat generic helpers --- README.md | 11 ++++++----- src/Client.Helpers.cs | 45 +++++++++++++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index b4369aa..28e6757 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ All the Telegram Client APIs (MTProto) are supported so you can do everything th This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. ->⚠️ This library relies on asynchronous C# programming (`async/await`) so make sure you are familiar with this advanced topic before proceeding. +>⚠️ This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... >If you are a beginner in C#, starting a project based on this library might not be a great idea. # How to use @@ -85,7 +85,7 @@ Another simple approach is to pass `Environment.GetEnvironmentVariable` as the c *(undefined variables get the default `null` behavior)*. Finally, if you want to redirect the library logs to your logger instead of the Console, you can install a delegate in the `WTelegram.Helpers.Log` static property. -Its `int` argument is the log severity, compatible with the [LogLevel enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel) +Its `int` argument is the log severity, compatible with the [LogLevel enum](https://docs.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel). # Alternative simplified configuration & login Since version 3.0.0, a new approach to login/configuration has been added. Some people might find it easier to deal with: @@ -185,7 +185,8 @@ Required API parameters/fields can sometimes be set to 0 or `null` when unused ( I've added several useful converters, implicit cast or helper properties to various API objects so that they are more easy to manipulate. -Beyond the TL async methods, the Client class offers a few other methods to simplify the sending/receiving of files, medias or messages. +Beyond the TL async methods, the Client class offers a few other methods to simplify the sending/receiving of files, medias or messages, +as well as generic handling of chats/channels. This library works best with **.NET 5.0+** (faster, no dependencies) and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) and **Xamarin/Mono.Android** @@ -200,10 +201,10 @@ This library can be used for any Telegram scenarios including: It has been tested in a Console app, [in Windows Forms](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip), [in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/ASPnet_webapp.zip), and in Xamarin/Android. -Please don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) +Don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers. Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient) You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide. -If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate).❤ This will help the project keep going. +If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 3ef85f2..6fe1510 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -580,13 +580,19 @@ namespace WTelegram } private const string OnlyChatChannel = "This method works on Chat & Channel only"; - public Task AddChatUser(InputPeer peer, InputUserBase user, int fwd_limit = int.MaxValue) => peer switch + ///
Generic helper: Adds a single user to a Chat or Channel See
and
Possible codes: 400,403
+ /// Chat/Channel + /// User to be added + public Task AddChatUser(InputPeer peer, InputUserBase user) => peer switch { - InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, fwd_limit), + InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, int.MaxValue), InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), _ => throw new ArgumentException(OnlyChatChannel), }; + /// Generic helper: Kick a user from a Chat or Channel [bots: ✓] See
and
Possible codes: 400,403
+ /// Chat/Channel + /// User to be removed public Task DeleteChatUser(InputPeer peer, InputUser user) => peer switch { InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, user, true), @@ -594,6 +600,8 @@ namespace WTelegram _ => throw new ArgumentException(OnlyChatChannel), }; + /// Generic helper: Leave a Chat or Channel [bots: ✓] See
and
Possible codes: 400,403
+ /// Chat/Channel to leave public Task LeaveChat(InputPeer peer) => peer switch { InputPeerChat chat => this.Messages_DeleteChatUser(chat.chat_id, InputUser.Self, true), @@ -601,6 +609,10 @@ namespace WTelegram _ => throw new ArgumentException(OnlyChatChannel), }; + /// Generic helper: Make a user admin in a Chat or Channel See
and
[bots: ✓] Possible codes: 400,403,406
+ /// Chat/Channel + /// The user to make admin + /// Whether to make them admin public async Task EditChatAdmin(InputPeer peer, InputUserBase user, bool is_admin) { switch (peer) @@ -617,6 +629,9 @@ namespace WTelegram } } + /// Generic helper: Change the photo of a Chat or Channel [bots: ✓] See
and
Possible codes: 400,403
+ /// Chat/Channel + /// New photo public Task EditChatPhoto(InputPeer peer, InputChatPhotoBase photo) => peer switch { InputPeerChat chat => this.Messages_EditChatPhoto(chat.chat_id, photo), @@ -624,6 +639,9 @@ namespace WTelegram _ => throw new ArgumentException(OnlyChatChannel), }; + /// Generic helper: Edit the name of a Chat or Channel [bots: ✓] See
and
Possible codes: 400,403
+ /// Chat/Channel + /// New name public Task EditChatTitle(InputPeer peer, string title) => peer switch { InputPeerChat chat => this.Messages_EditChatTitle(chat.chat_id, title), @@ -631,6 +649,8 @@ namespace WTelegram _ => throw new ArgumentException(OnlyChatChannel), }; + /// Get full info about a Chat or Channel [bots: ✓] See
and
Possible codes: 400,403,406
+ /// Chat/Channel public Task GetFullChat(InputPeer peer) => peer switch { InputPeerChat chat => this.Messages_GetFullChat(chat.chat_id), @@ -638,6 +658,8 @@ namespace WTelegram _ => throw new ArgumentException(OnlyChatChannel), }; + /// Generic helper: Delete a Chat or Channel See
and
Possible codes: 400,403,406
+ /// Chat/Channel to delete public async Task DeleteChat(InputPeer peer) { switch (peer) @@ -653,20 +675,23 @@ namespace WTelegram } } + /// Generic helper: Get individual messages by IDs [bots: ✓] See
and
Possible codes: 400
+ /// User/Chat/Channel + /// IDs of messages to get public Task GetMessages(InputPeer peer, params InputMessage[] id) => peer is InputPeerChannel channel ? this.Channels_GetMessages(channel, id) : this.Messages_GetMessages(id); + /// Generic helper: Delete messages by IDs [bots: ✓]
Messages are deleted for all participants See

and
Possible codes: 400,403
+ /// User/Chat/Channel + /// IDs of messages to delete public Task DeleteMessages(InputPeer peer, params int[] id) - => peer is InputPeerChannel channel ? this.Channels_DeleteMessages(channel, id) : this.Messages_DeleteMessages(id); + => peer is InputPeerChannel channel ? this.Channels_DeleteMessages(channel, id) : this.Messages_DeleteMessages(id, true); - /// Marks message history as read. See
and
Possible codes: 400 (details)
- /// Target user, channel or group + /// Generic helper: Marks message history as read. See
and
Possible codes: 400
+ /// User/Chat/Channel /// If a positive value is passed, only messages with identifiers less or equal than the given one will be marked read - public async Task ReadHistory(InputPeer peer, int max_id = default) => peer switch - { - InputPeerChannel channel => await this.Channels_ReadHistory(channel, max_id), - _ => (await this.Messages_ReadHistory(peer, max_id)) != null - }; + public async Task ReadHistory(InputPeer peer, int max_id = default) + => peer is InputPeerChannel channel ? await this.Channels_ReadHistory(channel, max_id) : (await this.Messages_ReadHistory(peer, max_id)) != null; #endregion } } From fd593b429ae37c702580676788159a81c2eb546f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 20 Nov 2022 17:15:57 +0100 Subject: [PATCH 019/336] InputPeer.ID & MessageBase.ToString helpers. Publish pre-releases on nuget now --- .github/dev.yml | 8 ++++---- EXAMPLES.md | 8 +++++--- FAQ.md | 18 +++++++++--------- README.md | 2 +- src/TL.Helpers.cs | 37 ++++++++++++++++++++++++++++++------- src/TL.Schema.cs | 12 ++++++------ src/WTelegramClient.csproj | 3 ++- 7 files changed, 57 insertions(+), 31 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index d26fff4..994f6ad 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,14 +25,14 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(ReleaseNotes)"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage)"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 inputs: command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.*upkg' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' publishPackageMetadata: true - nuGetFeedType: 'internal' - publishVstsFeed: 'WTelegramClient/WTelegramClient' + nuGetFeedType: 'external' + publishFeedCredentials: 'nuget.org' diff --git a/EXAMPLES.md b/EXAMPLES.md index d8fc6dc..1e26e97 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -88,12 +88,14 @@ foreach (Dialog dialog in dialogs.dialogs) case User user when user.IsActive: Console.WriteLine("User " + user); break; case ChatBase chat when chat.IsActive: Console.WriteLine(chat); break; } - //var latestMsg = dialogs.messages.FirstOrDefault(m => m.Peer.ID == dialog.Peer.ID && m.ID == dialog.TopMessage); + //var latestMsg = dialogs.messages.FirstOrDefault(m => m.Peer.ID == dialog.Peer.ID && m.ID == dialog.TopMessage); } ``` -*Note: the lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users.* -See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). +Notes: +- The lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users. +- See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). +- To retrieve the dialog information about a specific [peer](README.md#terminology), use `client.Messages_GetPeerDialogs(inputPeer)` ### List all chats (groups/channels NOT users) that we joined and send a message to one diff --git a/FAQ.md b/FAQ.md index 9a1c8d8..fcb3789 100644 --- a/FAQ.md +++ b/FAQ.md @@ -283,15 +283,15 @@ Here are the recommended actions to fix your problem: - Save, close Notepad and reopen your project in Visual Studio - If you still have issues on some `foreach` constructs, add this class somewhere in your project: ```csharp - static class Extensions - { - public static void Deconstruct(this KeyValuePair tuple, out T1 key, out T2 value) - { - key = tuple.Key; - value = tuple.Value; - } - } - ``` + static class Extensions + { + public static void Deconstruct(this KeyValuePair tuple, out T1 key, out T2 value) + { + key = tuple.Key; + value = tuple.Value; + } + } + ``` Also, remember to add a `using TL;` at the top of your files to have access to all the Telegram API methods. diff --git a/README.md b/README.md index 28e6757..d173cc5 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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-148-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) +[![dev nuget](https://img.shields.io/nuget/vpre/WTelegramClient?color=ffc040&label=dev%20nuget)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) [![Support Chat](https://img.shields.io/badge/Contact_us-on_Telegram-238EC2)](https://t.me/WTelegramClient) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 3bf8380..506b52d 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -15,29 +15,48 @@ namespace TL InputPeer ToInputPeer(); } - partial class InputPeer { public static InputPeerSelf Self => new(); } + partial class InputPeer + { + public static readonly InputPeerSelf Self = new(); + public abstract long ID { get; } + } + partial class InputPeerSelf + { + public override long ID => 0; + } partial class InputPeerChat { /// ⚠ Only for small private Chat. Chat groups of type Channel must use InputPeerChannel. See Terminology in README /// Chat identifier public InputPeerChat(long chat_id) => this.chat_id = chat_id; internal InputPeerChat() { } + public override long ID => chat_id; } partial class InputPeerUser { /// User identifier - /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the structure public InputPeerUser(long user_id, long access_hash) { this.user_id = user_id; this.access_hash = access_hash; } internal InputPeerUser() { } public static implicit operator InputUser(InputPeerUser user) => new(user.user_id, user.access_hash); + public override long ID => user_id; } partial class InputPeerChannel { /// Channel identifier - /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the structure public InputPeerChannel(long channel_id, long access_hash) { this.channel_id = channel_id; this.access_hash = access_hash; } internal InputPeerChannel() { } public static implicit operator InputChannel(InputPeerChannel channel) => new(channel.channel_id, channel.access_hash); + public override long ID => channel_id; + } + partial class InputPeerUserFromMessage + { + public override long ID => user_id; + } + partial class InputPeerChannelFromMessage + { + public override long ID => channel_id; } partial class InputUserBase { public abstract long? UserId { get; } } @@ -48,7 +67,7 @@ namespace TL public override long? UserId => user_id; public static InputUserSelf Self => new(); /// User identifier - /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the structure public InputUser(long user_id, long access_hash) { this.user_id = user_id; this.access_hash = access_hash; } internal InputUser() { } public static implicit operator InputPeerUser(InputUser user) => new(user.user_id, user.access_hash); @@ -138,8 +157,8 @@ namespace TL } - /// a null value means userStatusEmpty = last seen a long time ago, more than a month (this is also always shown to blocked users) - partial class UserStatus { /// An estimation of the number of days ago the user was last seen (online=0, recently=1, lastWeek=5, lastMonth=20)
= null means a long time ago, more than a month (this is also always shown to blocked users)
+ /// a null value means userStatusEmpty = last seen a long time ago, more than a month (this is also always shown for blocked/deleted users) + partial class UserStatus { /// An estimation of the number of days ago the user was last seen (online=0, recently=1, lastWeek=5, lastMonth=20)
= null means a long time ago, more than a month (this is also always shown for blocked/deleted users)
public abstract TimeSpan LastSeenAgo { get; } } partial class UserStatusOnline { public override TimeSpan LastSeenAgo => TimeSpan.Zero; } partial class UserStatusOffline { public override TimeSpan LastSeenAgo => DateTime.UtcNow - new DateTime((was_online + 62135596800L) * 10000000, DateTimeKind.Utc); } @@ -218,6 +237,10 @@ namespace TL partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => Array.Empty(); } partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } + partial class MessageEmpty { public override string ToString() => "(no message)"; } + partial class Message { public override string ToString() => $"{(from_id ?? peer_id)?.ID}> {message} {media}"; } + partial class MessageService { public override string ToString() => $"{(from_id ?? peer_id)?.ID} [{action.GetType().Name[13..]}]"; } + partial class MessageMedia { ///Use this helper method to send a copy of the media without downloading it ///Quiz poll may need to be voted before obtaining the correct answers. Dice will not replicate same value. TTL ignored
May return for Invoice and other unsupported media types
public virtual InputMedia ToInputMedia() => null; } @@ -463,7 +486,7 @@ namespace TL partial class InputChannel { /// Channel identifier - /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the constructor + /// REQUIRED FIELD. See FAQ for how to obtain it
access_hash value from the structure public InputChannel(long channel_id, long access_hash) { this.channel_id = channel_id; this.access_hash = access_hash; } internal InputChannel() { } public static implicit operator InputPeerChannel(InputChannel channel) => new(channel.channel_id, channel.access_hash); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a9026f8..4d66f08 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -36,7 +36,7 @@ namespace TL public abstract partial class InputPeer : IObject { } /// Defines the current user. See [TLDef(0x7DA07EC9)] - public class InputPeerSelf : InputPeer { } + public partial class InputPeerSelf : InputPeer { } /// Defines a chat for further interaction. See [TLDef(0x35A95CB9)] public partial class InputPeerChat : InputPeer @@ -64,7 +64,7 @@ namespace TL } /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0xA87B0A1C)] - public class InputPeerUserFromMessage : InputPeer + public partial class InputPeerUserFromMessage : InputPeer { /// The chat where the user was seen public InputPeer peer; @@ -75,7 +75,7 @@ namespace TL } /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0xBD2A0840)] - public class InputPeerChannelFromMessage : InputPeer + public partial class InputPeerChannelFromMessage : InputPeer { /// The chat where the channel's message was seen public InputPeer peer; @@ -1496,7 +1496,7 @@ namespace TL } /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] - public class MessageEmpty : MessageBase + public partial class MessageEmpty : MessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -1518,7 +1518,7 @@ namespace TL } /// A message See [TLDef(0x38116EE0)] - public class Message : MessageBase + public partial class Message : MessageBase { /// Flags, see TL conditional fields public Flags flags; @@ -1632,7 +1632,7 @@ namespace TL } /// Indicates a service message See [TLDef(0x2B085862)] - public class MessageService : MessageBase + public partial class MessageService : MessageBase { /// Flags, see TL conditional fields public Flags flags; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 51eaaab..eccde27 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -42,7 +42,8 @@ - From 11238550d313c90130dfb519f512a0de876b3e91 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 23 Nov 2022 14:18:07 +0100 Subject: [PATCH 020/336] Upgrade to layer 149: More Topics stuff --- EXAMPLES.md | 2 +- FAQ.md | 23 +++++++++++++---------- README.md | 8 +++----- src/TL.Schema.cs | 23 +++++++++++++++++++---- src/TL.SchemaFuncs.cs | 22 ++++++++++++++++++++++ src/TL.Table.cs | 7 ++++--- 6 files changed, 62 insertions(+), 23 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 1e26e97..c777b70 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -47,7 +47,7 @@ The `lvl` argument correspond to standard [LogLevel values](https://learn.micros ### Send a message to someone by @username ```csharp -var resolved = await client.Contacts_ResolveUsername("MyEch0_Bot"); // username without the @ +var resolved = await client.Contacts_ResolveUsername("JsonDumpBot"); // username without the @ await client.SendMessageAsync(resolved, "/start"); ``` *Note: This also works if the @username points to a channel/group, but you must already have joined that channel before sending a message to it. diff --git a/FAQ.md b/FAQ.md index fcb3789..b703c0b 100644 --- a/FAQ.md +++ b/FAQ.md @@ -72,13 +72,11 @@ You can then retrieve it with `client.GetAccessHashFor -#### 5. I need to test a feature that has been developed but not yet released in WTelegramClient nuget +#### 5. I need to test a feature that has been recently developed but seems not available in my program -The developmental versions of the library are available through Azure DevOps as part of the Continuous Integration builds after each Github commit. +The developmental versions of the library are now available as **pre-release** on Nuget (with `-dev` in the version number) -You can access these versions for testing in your program by going to our [private nuget feeds](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient), -click on button "Connect to feed" and follow the steps to setup your dev environment. -After that, you should be able to see/install the pre-release versions in your Nuget package manager and install them in your application. *(make sure you enable the **pre-release** checkbox)* +So make sure you tick the checkbox "Include prerelease" in Nuget manager and/or navigate to the Versions list then select the highest `x.x.x-dev.x` version to install in your program. #### 6. Telegram asks me to signup (firstname, lastname) even for an existing account @@ -307,14 +305,19 @@ So you can either: - Build your code in RELEASE mode - Modify your config callback to reply to "server_address" with the IP address of Telegram production servers (as found on your API development tools) -2) Did you call `LoginUserIfNeeded()`? -If you don't authenticate as a user (or bot), you have access to a very limited subset of Telegram APIs +2) Did you call `Login` or `LoginUserIfNeeded` succesfully? +If you don't complete authentication as a user (or bot), you have access to a very limited subset of Telegram APIs. +Make sure your calls succeed and don't throw an exception. 3) Did you use `await` with every Client methods? -This library is completely Task-based. You should learn, understand and use the [asynchronous model of C# programming](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/) before proceeding further. +This library is completely Task-based. You should learn, understand and use the [asynchronous model of C# programming](https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/async/) before proceeding further. +Using `.Result` or `.Wait()` can lead to deadlocks. 4) Is your program ending immediately instead of waiting for Updates? -Your program must be running/waiting continuously in order for the background Task to receive and process the Updates. So make sure your main program doesn't end immediately. For a console program, this is typical done by waiting for a key or some close event. +Your program must be running/waiting continuously in order for the background Task to receive and process the Updates. +So make sure your main program doesn't end immediately or dispose the client too soon (via `using`?). +For a console program, this is typical done by waiting for a key or some close event. 5) Is every Telegram API call rejected? (typically with an exception message like `AUTH_RESTART`) -The user authentification might have failed at some point (or the user revoked the authorization). It is therefore necessary to go through the authentification again. This can be done by deleting the WTelegram.session file, or at runtime by calling `client.Reset()` +The user authentification might have failed at some point (or the user revoked the authorization). +It is therefore necessary to go through the authentification again. This can be done by deleting the WTelegram.session file, or at runtime by calling `client.Reset()` diff --git a/README.md b/README.md index d173cc5..1db4148 100644 --- a/README.md +++ b/README.md @@ -1,8 +1,6 @@ [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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-148-blueviolet)](https://corefork.telegram.org/methods) -[![dev nuget](https://img.shields.io/nuget/vpre/WTelegramClient?color=ffc040&label=dev%20nuget)](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) -[![Support Chat](https://img.shields.io/badge/Contact_us-on_Telegram-238EC2)](https://t.me/WTelegramClient) +[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) ## _Telegram Client API library written 100% in C# and .NET Standard_ @@ -204,7 +202,7 @@ It has been tested in a Console app, [in Windows Forms](https://github.com/wiz0u Don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers. -Developers feedback is welcome in the Telegram support group [@WTelegramClient](https://t.me/WTelegramClient) -You can also check our [📖 Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) for more help and troubleshooting guide. +If you read all this ReadMe, the [Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md), +the [Examples codes](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going. diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 4d66f08..b7fab60 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2974,7 +2974,7 @@ namespace TL } } /// Channel messages See - [TLDef(0x64479808)] + [TLDef(0xC776BA4E)] public partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver { /// Flags, see TL conditional fields @@ -2987,6 +2987,7 @@ namespace TL [IfFlag(2)] public int offset_id_offset; /// Found messages public MessageBase[] messages; + public ForumTopicBase[] topics; /// Chats public Dictionary chats; /// Users @@ -4366,16 +4367,29 @@ namespace TL public MessageExtendedMediaBase extended_media; } /// See - [TLDef(0xF694B0AE)] + [TLDef(0x192EFBE3)] public class UpdateChannelPinnedTopic : Update { public Flags flags; public long channel_id; - [IfFlag(0)] public int topic_id; + public int topic_id; [Flags] public enum Flags : uint { - has_topic_id = 0x1, + pinned = 0x1, + } + } + /// See + [TLDef(0xFE198602)] + public class UpdateChannelPinnedTopics : Update + { + public Flags flags; + public long channel_id; + [IfFlag(0)] public int[] order; + + [Flags] public enum Flags : uint + { + has_order = 0x1, } } @@ -13857,6 +13871,7 @@ namespace TL closed = 0x4, pinned = 0x8, has_draft = 0x10, + short = 0x20, } public override int ID => id; diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5eb402f..b2d4701 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4296,6 +4296,15 @@ namespace TL top_msg_id = top_msg_id, }); + /// See + public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) + => client.Invoke(new Channels_ReorderPinnedForumTopics + { + flags = (Channels_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0), + channel = channel, + order = order, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -8529,6 +8538,19 @@ namespace TL.Methods public int top_msg_id; } + [TLDef(0x2950A18F)] + public class Channels_ReorderPinnedForumTopics : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 50a3c11..d991db7 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 = 148; // fetched 01/11/2022 17:33:23 + public const int Version = 149; // fetched 23/11/2022 13:15:45 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -233,7 +233,7 @@ namespace TL [0xF0E3E596] = typeof(Messages_DialogsNotModified), [0x8C718E87] = typeof(Messages_Messages), [0x3A54685E] = typeof(Messages_MessagesSlice), - [0x64479808] = typeof(Messages_ChannelMessages), + [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), [0x9CD81144] = typeof(Messages_ChatsSlice), @@ -363,7 +363,8 @@ namespace TL [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), - [0xF694B0AE] = typeof(UpdateChannelPinnedTopic), + [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), + [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), From 898523346b06cd396aeac4b72bec250f42cea6ed Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 23 Nov 2022 14:28:25 +0100 Subject: [PATCH 021/336] build fix | Upgrade to layer 149: More Topics stuff --- src/TL.Schema.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b7fab60..8a7851b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -13871,7 +13871,7 @@ namespace TL closed = 0x4, pinned = 0x8, has_draft = 0x10, - short = 0x20, + short_ = 0x20, } public override int ID => id; From a8d6656c0548f0cdc337e51de0efec79e36b7b2c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 26 Nov 2022 14:16:52 +0100 Subject: [PATCH 022/336] Using Github pages. Added User.IsBot helper --- .github/dev.yml | 2 +- EXAMPLES.md | 2 +- FAQ.md | 4 ++-- README.md | 26 +++++++++++------------ src/TL.Helpers.cs | 17 ++++++++------- src/TL.Schema.cs | 48 +++++++++++++++++++++---------------------- src/TL.SchemaFuncs.cs | 38 +++++++++++++++++----------------- 7 files changed, 68 insertions(+), 69 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 994f6ad..31ee239 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.1.3-dev.$(Rev:r) +name: 3.1.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index c777b70..2fcc816 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -379,7 +379,7 @@ await client.Messages_ImportChatInvite("HASH"); // join the channel/group var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the target chat ``` -After the above code, once you [have obtained](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash) an `InputUser` or `User`, you can: +After the above code, once you [have obtained](FAQ.md#access-hash) an `InputUser` or `User`, you can: ```csharp // • Directly add the user to a Chat/Channel/group: await client.AddChatUser(chat, user); diff --git a/FAQ.md b/FAQ.md index b703c0b..36f03c5 100644 --- a/FAQ.md +++ b/FAQ.md @@ -45,7 +45,7 @@ and when the user has provided the verification_code through your app, you "set" Another solution is to use the [alternative login method](README.md#alternative-simplified-configuration--login), calling `client.Login(...)` as the user provides the requested configuration elements. -You can download such full example apps [for WinForms](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip) and [for ASP.NET](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/ASPnet_webapp.zip) +You can download such full example apps [for WinForms](Examples/WinForms_app.zip) and [for ASP.NET](Examples/ASPnet_webapp.zip) #### 4. How to use IDs? Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? @@ -301,7 +301,7 @@ Here is a list of common issues and how to fix them so that your program work co It is not recommended to copy/compile the source code of the library for a normal usage. When built in DEBUG mode, the source code connects to Telegram test servers (see also [FAQ #6](#wrong-server)). So you can either: - - **Recommended:** Use the [official Nuget package](https://www.nuget.org/packages/WTelegramClient) or the [private nuget feed of development builds](https://dev.azure.com/wiz0u/WTelegramClient/_artifacts/feed/WTelegramClient/NuGet/WTelegramClient) + - **Recommended:** Use the [official Nuget package](https://www.nuget.org/packages/WTelegramClient) - Build your code in RELEASE mode - Modify your config callback to reply to "server_address" with the IP address of Telegram production servers (as found on your API development tools) diff --git a/README.md b/README.md index 1db4148..88d7368 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ +[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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-149-blueviolet)](https://corefork.telegram.org/methods) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) ## _Telegram Client API library written 100% in C# and .NET Standard_ @@ -76,7 +76,7 @@ There are other configuration items that are queried to your method but returnin Those shown above are the only ones that have no default values and should be provided by your method. Returning `null` for verification_code or password will show a prompt for console apps, or an error otherwise -*(see [FAQ #3](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#GUI) for WinForms)* +*(see [FAQ #3](https://wiz0u.github.io/WTelegramClient/FAQ#GUI) for WinForms)* Returning `""` for verification_code requests the resending of the code through another system (SMS or Call). Another simple approach is to pass `Environment.GetEnvironmentVariable` as the config callback and define the configuration items as environment variables @@ -108,7 +108,7 @@ async Task DoLogin(string loginInfo) // (add this method to your code) With this method, you can choose in some cases to interrupt the login loop via a `return` instead of `break`, and resume it later by calling `DoLogin(requestedCode)` again once you've obtained the requested code/password/etc... -See [WinForms example](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip) and [ASP.NET example](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/ASPnet_webapp.zip) +See [WinForms example](https://wiz0u.github.io/WTelegramClient/Examples/WinForms_app.zip) and [ASP.NET example](https://wiz0u.github.io/WTelegramClient/Examples/ASPnet_webapp.zip) # Example of API call @@ -148,9 +148,9 @@ Console.WriteLine($"Sending a message in chat {chatId}: {target.Title}"); await client.SendMessageAsync(target, "Hello, World"); ``` -➡️ You can find lots of useful code snippets in [EXAMPLES.md](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md) +➡️ You can find lots of useful code snippets in [EXAMPLES](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). -➡️ Check [the FAQ](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#compile) if example codes doesn't compile correctly on your machine, or other troubleshooting. +➡️ Check [the FAQ](https://wiz0u.github.io/WTelegramClient/FAQ#compile) if example codes doesn't compile correctly on your machine, or other troubleshooting. # Terminology in Telegram Client API @@ -165,14 +165,14 @@ or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (th - `Peer` : Either a `Chat`, a `Channel` or a `User` - Dialog : Status of chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. - Access Hash : Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them. -See [FAQ #4](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash) to learn more about it. +See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn more about it. - DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. - Session or Authorization : Pairing between a device and a phone number. You can have several active sessions for the same phone number. # Other things to know The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. -See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs) +See [Examples/Program_ListenUpdates.cs](https://wiz0u.github.io/WTelegramClient/Examples/Program_ListenUpdates.cs) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. @@ -191,18 +191,18 @@ This library works best with **.NET 5.0+** (faster, no dependencies) and is also # Library uses and limitations This library can be used for any Telegram scenarios including: - Sequential or parallel automated steps based on API requests/responses -- Real-time [monitoring](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#updates) of incoming Updates/Messages +- Real-time [monitoring](https://wiz0u.github.io/WTelegramClient/EXAMPLES#updates) of incoming Updates/Messages - Download/upload of files/media -- Exchange end-to-end encrypted messages/files in [Secret Chats](https://github.com/wiz0u/WTelegramClient/blob/master/EXAMPLES.md#e2e) +- Exchange end-to-end encrypted messages/files in [Secret Chats](https://wiz0u.github.io/WTelegramClient/EXAMPLES#e2e) - Building a full-featured interactive client -It has been tested in a Console app, [in Windows Forms](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/WinForms_app.zip), -[in ASP.NET webservice](https://github.com/wiz0u/WTelegramClient/raw/master/Examples/ASPnet_webapp.zip), and in Xamarin/Android. +It has been tested in a Console app, [in Windows Forms](https://wiz0u.github.io/WTelegramClient/Examples/WinForms_app.zip), +[in ASP.NET webservice](https://wiz0u.github.io/WTelegramClient/Examples/ASPnet_webapp.zip), and in Xamarin/Android. Don't use this library for Spam or Scam. Respect Telegram [Terms of Service](https://telegram.org/tos) as well as the [API Terms of Service](https://core.telegram.org/api/terms) or you might get banned from Telegram servers. -If you read all this ReadMe, the [Frequently Asked Questions](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md), -the [Examples codes](https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) +If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.github.io/WTelegramClient/FAQ), +the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going. diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 506b52d..baa60d3 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -148,6 +148,7 @@ namespace TL { public override long ID => id; public override bool IsActive => (flags & Flags.deleted) == 0; + public bool IsBot => (flags & Flags.bot) != 0; public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser(id, access_hash); @@ -156,18 +157,16 @@ namespace TL public TimeSpan LastSeenAgo => status?.LastSeenAgo ?? TimeSpan.FromDays(150); } - - /// a null value means userStatusEmpty = last seen a long time ago, more than a month (this is also always shown for blocked/deleted users) - partial class UserStatus { /// An estimation of the number of days ago the user was last seen (online=0, recently=1, lastWeek=5, lastMonth=20)
= null means a long time ago, more than a month (this is also always shown for blocked/deleted users)
- public abstract TimeSpan LastSeenAgo { get; } } - partial class UserStatusOnline { public override TimeSpan LastSeenAgo => TimeSpan.Zero; } - partial class UserStatusOffline { public override TimeSpan LastSeenAgo => DateTime.UtcNow - new DateTime((was_online + 62135596800L) * 10000000, DateTimeKind.Utc); } + /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) + partial class UserStatus { internal abstract TimeSpan LastSeenAgo { get; } } + partial class UserStatusOnline { internal override TimeSpan LastSeenAgo => TimeSpan.Zero; } + partial class UserStatusOffline { internal override TimeSpan LastSeenAgo => DateTime.UtcNow - new DateTime((was_online + 62135596800L) * 10000000, DateTimeKind.Utc); } /// covers anything between 1 second and 2-3 days - partial class UserStatusRecently { public override TimeSpan LastSeenAgo => TimeSpan.FromDays(1); } + partial class UserStatusRecently { internal override TimeSpan LastSeenAgo => TimeSpan.FromDays(1); } /// between 2-3 and seven days - partial class UserStatusLastWeek { public override TimeSpan LastSeenAgo => TimeSpan.FromDays(5); } + partial class UserStatusLastWeek { internal override TimeSpan LastSeenAgo => TimeSpan.FromDays(5); } /// between 6-7 days and a month - partial class UserStatusLastMonth { public override TimeSpan LastSeenAgo => TimeSpan.FromDays(20); } + partial class UserStatusLastMonth { internal override TimeSpan LastSeenAgo => TimeSpan.FromDays(20); } partial class ChatBase : IPeerInfo { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 8a7851b..1177959 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -50,7 +50,7 @@ namespace TL { /// User identifier public long user_id; - /// REQUIRED FIELD. See how to obtain it
access_hash value from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; } /// Defines a channel for further interaction. See @@ -59,7 +59,7 @@ namespace TL { /// Channel identifier public long channel_id; - /// REQUIRED FIELD. See how to obtain it
access_hash value from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; } ///
Defines a min user that was seen in a certain message of a certain chat. See @@ -97,7 +97,7 @@ namespace TL { /// User identifier public long user_id; - /// REQUIRED FIELD. See how to obtain it
access_hash value from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; } ///
Defines a min user that was seen in a certain message of a certain chat. See @@ -504,7 +504,7 @@ namespace TL { /// Photo identifier public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash value from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; ///
File reference public byte[] file_reference; @@ -531,7 +531,7 @@ namespace TL { /// File ID, id parameter value from public long id; - /// REQUIRED FIELD. See how to obtain it
Checksum, access_hash parameter value from
+ /// REQUIRED FIELD. See how to obtain it
Checksum, access_hash parameter value from
public long access_hash; } /// Document location (video, voice, audio, basically every type except photo) See @@ -540,7 +540,7 @@ namespace TL { /// Document ID public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; ///
File reference public byte[] file_reference; @@ -553,7 +553,7 @@ namespace TL { /// File ID, id parameter value from public long id; - /// REQUIRED FIELD. See how to obtain it
Checksum, access_hash parameter value from
+ /// REQUIRED FIELD. See how to obtain it
Checksum, access_hash parameter value from
public long access_hash; } /// Empty constructor for takeout See @@ -565,7 +565,7 @@ namespace TL { /// Photo ID, obtained from the object public long id; - /// REQUIRED FIELD. See how to obtain it
Photo's access hash, obtained from the object
+ /// REQUIRED FIELD. See how to obtain it
Photo's access hash, obtained from the object
public long access_hash; ///
File reference public byte[] file_reference; @@ -578,7 +578,7 @@ namespace TL { /// Photo ID public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; /// File reference public byte[] file_reference; @@ -5112,7 +5112,7 @@ namespace TL { /// Chat ID public int chat_id; - /// REQUIRED FIELD. See how to obtain it
Checking sum from constructor , or
+ /// REQUIRED FIELD. See how to obtain it
Checking sum from constructor , or
public long access_hash; } @@ -5162,7 +5162,7 @@ namespace TL { /// File ID, value of id parameter from public long id; - /// REQUIRED FIELD. See how to obtain it
Checking sum, value of access_hash parameter from
+ /// REQUIRED FIELD. See how to obtain it
Checking sum, value of access_hash parameter from
public long access_hash; /// File ID, value of id parameter from @@ -5287,7 +5287,7 @@ namespace TL { /// Document ID public long id; - /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
+ /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; /// File reference public byte[] file_reference; @@ -6192,7 +6192,7 @@ namespace TL { /// ID public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } /// Stickerset by short name, from a stickerset deep link » See @@ -6698,7 +6698,7 @@ namespace TL { /// Channel ID public long channel_id; - /// REQUIRED FIELD. See how to obtain it
Access hash taken from the
+ /// REQUIRED FIELD. See how to obtain it
Access hash taken from the
public long access_hash; /// Channel ID @@ -7858,7 +7858,7 @@ namespace TL public int dc_id; /// ID of message, contains both the (32-bit, legacy) owner ID and the message ID, used only for Bot API backwards compatibility with 32-bit user ID. public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash of message
+ /// REQUIRED FIELD. See how to obtain it
Access hash of message
public long access_hash; /// DC ID to use when working with this inline message @@ -7876,7 +7876,7 @@ namespace TL public long owner_id; /// ID of message public int id; - /// REQUIRED FIELD. See how to obtain it
Access hash of message
+ /// REQUIRED FIELD. See how to obtain it
Access hash of message
public long access_hash; /// DC ID to use when working with this inline message @@ -8201,7 +8201,7 @@ namespace TL { /// game ID from constructor public long id; - /// REQUIRED FIELD. See how to obtain it
access hash from constructor
+ /// REQUIRED FIELD. See how to obtain it
access hash from constructor
public long access_hash; } ///
Game by short name See @@ -8891,7 +8891,7 @@ namespace TL { /// HTTP URL of file public string url; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } ///
Used to download a server-generated image with the map preview from a , see the webfile docs for more info ». See @@ -8900,7 +8900,7 @@ namespace TL { /// Generated from the lat, long and accuracy_radius parameters of the public InputGeoPoint geo_point; - /// REQUIRED FIELD. See how to obtain it
Access hash of the
+ /// REQUIRED FIELD. See how to obtain it
Access hash of the
public long access_hash; /// Map width in pixels before applying scale; 16-1024 public int w; @@ -9197,7 +9197,7 @@ namespace TL { /// Call ID public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } @@ -10319,7 +10319,7 @@ namespace TL { /// Secure file ID public long id; - /// REQUIRED FIELD. See how to obtain it
Secure file access hash
+ /// REQUIRED FIELD. See how to obtain it
Secure file access hash
public long access_hash; /// Secure file ID @@ -11261,7 +11261,7 @@ namespace TL { ///
Wallpaper ID public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } /// Wallpaper by slug (a unique ID, obtained from a wallpaper link ») See @@ -11589,7 +11589,7 @@ namespace TL { /// ID public long id; - /// REQUIRED FIELD. See how to obtain it
Access hash
+ /// REQUIRED FIELD. See how to obtain it
Access hash
public long access_hash; } ///
Theme by theme ID See @@ -12525,7 +12525,7 @@ namespace TL { /// Group call ID public long id; - /// REQUIRED FIELD. See how to obtain it
Group call access hash
+ /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index b2d4701..93ac53c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -97,7 +97,7 @@ namespace TL /// Application identifier (see
App configuration) /// Application secret hash (see App configuration) /// Settings for the code type to send - [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.Invoke(new Auth_SendCode { @@ -112,7 +112,7 @@ namespace TL /// SMS-message ID /// New user first name /// New user last name - [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) => client.Invoke(new Auth_SignUp { @@ -127,7 +127,7 @@ namespace TL /// SMS-message ID, obtained from auth.sendCode /// Valid numerical code from the SMS-message /// Email verification code or token - [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_SignIn(this Client client, string phone_number, string phone_code_hash, string phone_code = null, EmailVerification email_verification = null) => client.Invoke(new Auth_SignIn { @@ -223,7 +223,7 @@ namespace TL /// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See Possible codes: 400,406 (details) /// The phone number /// The phone code hash obtained from auth.sendCode - [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResendCode { @@ -234,7 +234,7 @@ namespace TL /// Cancel the login verification code See Possible codes: 400,406 (details) /// Phone number /// Phone code hash from auth.sendCode - [Obsolete("Use LoginUserIfNeeded instead of this method. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#tlsharp")] + [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_CancelCode { @@ -1282,7 +1282,7 @@ namespace TL phone = phone, }); - /// This method is only for basic Chat. See Terminology 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: ✓]
+ /// This method is only for basic Chat. See Terminology 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) => client.Invoke(new Messages_GetMessages @@ -1392,7 +1392,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See
[bots: ✓] Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) @@ -1402,7 +1402,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages @@ -1540,7 +1540,7 @@ namespace TL message = message, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See
[bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details)
/// List of chat IDs public static Task Messages_GetChats(this Client client, params long[] id) => client.Invoke(new Messages_GetChats @@ -1548,7 +1548,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
/// Basic group ID. public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat @@ -1556,7 +1556,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) @@ -1566,7 +1566,7 @@ namespace TL title = title, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) @@ -1576,7 +1576,7 @@ namespace TL photo = photo, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
/// Chat ID /// User ID to be added /// Number of last messages to be forwarded @@ -1588,7 +1588,7 @@ namespace TL fwd_limit = fwd_limit, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted @@ -1732,7 +1732,7 @@ namespace TL peer = peer, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.Invoke(new Messages_ReadMessageContents @@ -1860,7 +1860,7 @@ namespace TL increment = increment, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a
basic group. See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a basic group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make them admin @@ -1872,7 +1872,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2816,7 +2816,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
/// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) => client.Invoke(new Messages_DeleteChat @@ -3298,7 +3298,7 @@ namespace TL platform = platform, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
/// Webview interaction ID obtained from messages.requestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) From bd629e7384406951e6dc07518cf2cf962a7deb7a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 26 Nov 2022 15:16:04 +0100 Subject: [PATCH 023/336] doc updates --- EXAMPLES.md | 57 +++++++++++++++++++++++++++-------------------------- FAQ.md | 36 +++++++++++++++++---------------- 2 files changed, 48 insertions(+), 45 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2fcc816..88bf1de 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -1,4 +1,4 @@ -## Example programs using WTelegramClient +# Example programs using WTelegramClient For these examples to work as a fully-functional Program.cs, be sure to start with these lines: ```csharp @@ -18,11 +18,12 @@ Remember that these are just simple example codes that you should adjust to your In real production code, you might want to properly test the success of each operation or handle exceptions, and avoid calling the same methods (like `Messages_GetAllChats`) repetitively. -ℹ️ WTelegramClient covers 100% of Telegram Client API, much more than the examples below: check the [full API methods list](https://corefork.telegram.org/methods)! -More examples can also be found in the [Examples folder](Examples) and in answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). +➡️ Use Ctrl-F to search this page for the example matching your needs +WTelegramClient covers 100% of Telegram Client API, much more than the examples below: check the [full API methods list](https://corefork.telegram.org/methods)! +More examples can also be found in the [Examples folder](https://github.com/wiz0u/WTelegramClient/tree/master/Examples) and in answers to [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient). -### Change logging settings +## Change logging settings 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: @@ -45,7 +46,7 @@ WTelegram.Helpers.Log = (lvl, str) => { }; The `lvl` argument correspond to standard [LogLevel values](https://learn.microsoft.com/en-us/dotnet/api/microsoft.extensions.logging.loglevel#fields) -### Send a message to someone by @username +## Send a message to someone by @username ```csharp var resolved = await client.Contacts_ResolveUsername("JsonDumpBot"); // username without the @ await client.SendMessageAsync(resolved, "/start"); @@ -55,7 +56,7 @@ If the username is invalid/unused, the API call raises an RpcException.* -### Convert message to/from HTML or Markdown, and send it to ourself (Saved Messages) +## Convert message to/from HTML or Markdown, and send it to ourself (Saved Messages) ```csharp // HTML-formatted text: var text = $"Hello dear {HtmlText.Escape(client.User.first_name)}\n" + @@ -78,7 +79,7 @@ See [HTML formatting style](https://core.telegram.org/bots/api/#html-style) and *Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))* -### List all dialogs (chats/groups/channels/user chat) we are currently in +## List all dialogs (chats/groups/channels/user chat) we are currently in ```csharp var dialogs = await client.Messages_GetAllDialogs(); foreach (Dialog dialog in dialogs.dialogs) @@ -98,7 +99,7 @@ Notes: - To retrieve the dialog information about a specific [peer](README.md#terminology), use `client.Messages_GetPeerDialogs(inputPeer)` -### List all chats (groups/channels NOT users) that we joined and send a message to one +## List all chats (groups/channels NOT users) that we joined and send a message to one ```csharp var chats = await client.Messages_GetAllChats(); foreach (var (id, chat) in chats.chats) @@ -116,7 +117,7 @@ but the old `Chat` will be marked with flag [deactivated] and should not be used - You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) -### List the members from a chat +## List the members from a chat For a basic Chat: *(see Terminology in [ReadMe](README.md#terminology))* ```csharp var chatFull = await client.Messages_GetFullChat(1234567890); // the chat we want @@ -159,7 +160,7 @@ foreach (var participant in participants.participants) // This is the better way *Note: It is not possible to list only the Deleted Accounts. Those will be automatically removed by Telegram from your group after a while* -### Fetch all messages (history) from a chat +## Fetch all messages (history) from a chat ```csharp var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want @@ -183,7 +184,7 @@ Notes: - To mark the message history as read, use: `await client.ReadHistory(peer);` -### Monitor all Telegram events happening for the user +## Monitor all Telegram events happening for the user This is done through the `client.OnUpdate` callback event. Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. @@ -191,7 +192,7 @@ Your event handler implementation can either return `Task.CompletedTask` or be a See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). -### Monitor new messages being posted in chats in real-time +## Monitor new messages being posted in chats in real-time You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. @@ -200,7 +201,7 @@ See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/ You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. -### Downloading photos, medias, files +## Downloading photos, medias, files This is done using the helper method `client.DownloadFileAsync(file, outputStream)` that simplifies the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. @@ -208,7 +209,7 @@ that simplifies the download of a photo/document/file once you get a reference t See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs) that download all media files you forward to yourself (Saved Messages) -### Upload a media file and post it with caption to a chat +## Upload a media file and post it with caption to a chat ```csharp const int ChatId = 1234567890; // the chat we want const string Filepath = @"C:\...\photo.jpg"; @@ -220,7 +221,7 @@ await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` -### Send a grouped media album using photos from various sources +## Send a grouped media album using photos from various sources ```csharp // Photo 1 already on Telegram: latest photo found in the user's Saved Messages var history = await client.Messages_GetHistory(InputPeer.Self); @@ -241,7 +242,7 @@ await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); *Note: Don't mix Photos and file Documents in your album, it doesn't work well* -### Forward or copy a message to another chat +## Forward or copy a message to another chat ```csharp // Determine which chats and message to forward/copy var chats = await client.Messages_GetAllChats(); @@ -261,7 +262,7 @@ await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), e ``` -### Schedule a message to be sent to a chat +## Schedule a message to be sent to a chat ```csharp var chats = await client.Messages_GetAllChats(); InputPeer peer = chats.chats[1234567890]; // the chat we want @@ -270,7 +271,7 @@ await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule ``` -### Fun with stickers, GIFs, dice, and animated emojies +## Fun with stickers, GIFs, dice, and animated emojies ```csharp // • List all stickerSets the user has added to his account var allStickers = await client.Messages_GetAllStickers(); @@ -319,7 +320,7 @@ await Task.Delay(5000); ``` -### Fun with custom emojies and reactions on pinned messages +## Fun with custom emojies and reactions on pinned messages ```csharp // • Sending a message with custom emojies in Markdown to ourself: var text = "Vicksy says Hi! [👋](emoji?id=5190875290439525089)"; @@ -355,7 +356,7 @@ foreach (var msg in messages.Messages) -### Join a channel/group by their public name or invite link +## Join a channel/group by their public name or invite link * For a public channel/group `@channelname` If you have a link of the form `https://t.me/channelname`, you need to extract the `channelname` from the URL. You can resolve the channel/group username and join it like this: @@ -374,7 +375,7 @@ await client.Messages_ImportChatInvite("HASH"); // join the channel/group ``` -### Add/Invite/Remove someone in a chat +## Add/Invite/Remove someone in a chat ```csharp var chats = await client.Messages_GetAllChats(); var chat = chats.chats[1234567890]; // the target chat @@ -403,7 +404,7 @@ await client.DeleteChatUser(chat, user); ``` -### Send a message to someone by phone number +## Send a message to someone by phone number ```csharp var contacts = await client.Contacts_ImportContacts(new[] { new InputPhoneContact { phone = "+PHONENUMBER" } }); if (contacts.imported.Length > 0) @@ -412,7 +413,7 @@ if (contacts.imported.Length > 0) *Note: Don't use this method too much. To prevent spam, Telegram may restrict your ability to add new phone numbers or ban your account.* -### Retrieve the current user's contacts list +## Retrieve the current user's contacts list There are two different methods. Here is the simpler one: ```csharp var contacts = await client.Contacts_GetContacts(); @@ -441,7 +442,7 @@ finally ``` -### Collect Access Hash and save them for later use +## Collect Access Hash and save them for later use You can automate the collection of `access_hash` for the various resources obtained in response to API calls or Updates, so that you don't have to remember them by yourself or ask the API about them each time. @@ -450,7 +451,7 @@ This is done by activating the experimental `client.CollectAccessHash` system. See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.cs) for how to enable it, and save/restore them for later use. -### Use a proxy or MTProxy to connect to Telegram +## Use a proxy or MTProxy to connect to Telegram SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -482,7 +483,7 @@ If your Telegram client is already connected to such MTPROTO proxy, you can also *Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* -### Change 2FA password +## Change 2FA password ```csharp const string old_password = "password"; // current password if any (unused otherwise) const string new_password = "new_password"; // or null to disable 2FA @@ -500,7 +501,7 @@ await client.Account_UpdatePasswordSettings(password, new Account_PasswordInputS ``` -### Store session data to database or elsewhere, instead of files +## Store session data to database or elsewhere, instead of files If you don't want to store session data into files *(for example if your VPS Hosting doesn't allow that)*, or just for easier management, you can choose to store the session data somewhere else, like in a database. @@ -511,7 +512,7 @@ Use it to pass a custom Stream-derived class that will **read** (first initial c You can find an example for such custom session store in [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs#L61) -### Send/receive end-to-end encrypted messages & files in Secret Chats +## Send/receive end-to-end encrypted messages & files in Secret Chats This can be done easily using the helper class `WTelegram.SecretChats` offering methods to manage/encrypt/decrypt secret chats & encrypted messages/files. diff --git a/FAQ.md b/FAQ.md index 36f03c5..2cd38db 100644 --- a/FAQ.md +++ b/FAQ.md @@ -1,11 +1,13 @@ -## FAQ +# FAQ Before asking questions, make sure to **[read through the ReadMe first](README.md)**, take a look at the [example programs](EXAMPLES.md) or [StackOverflow questions](https://stackoverflow.com/questions/tagged/wtelegramclient), and refer to the [API method list](https://corefork.telegram.org/methods) for the full range of Telegram services available in this library. +➡️ Use Ctrl-F to search this page for the information you seek + -#### 1. How to remove the Console logs? +## 1. How to remove the Console logs? Writing the library logs to the Console is the default behavior of the `WTelegram.Helpers.Log` delegate. You can change the delegate with the `+=` operator to **also** write them somewhere else, or with the `=` operator to prevent them from being printed to screen and instead write them somewhere (file, logger, ...). @@ -14,7 +16,7 @@ In any case, it is not recommended to totally ignore those logs because you woul Read the [example about logging settings](EXAMPLES.md#logging) for how to write logs to a file. -#### 2. How to handle multiple user accounts +## 2. How to handle multiple user accounts The WTelegram.session file contains the authentication keys negociated for the current user. @@ -32,7 +34,7 @@ Your api_id/api_hash represents your application, and shouldn't change with each -#### 3. How to use the library in a WinForms, WPF or ASP.NET application +## 3. How to use the library in a WinForms, WPF or ASP.NET application The library should work without a problem in such applications. The difficulty might be in your Config callback when the user must enter the verification code or password, as you can't use `Console.ReadLine` here. @@ -48,7 +50,7 @@ calling `client.Login(...)` as the user provides the requested configuration ele You can download such full example apps [for WinForms](Examples/WinForms_app.zip) and [for ASP.NET](Examples/ASPnet_webapp.zip) -#### 4. How to use IDs? Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? +## 4. How to use IDs? Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? Having only the ID is **not enough**: An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... This serves as a proof that the logged-in user is entitled to access it (otherwise, anybody with the ID could access it) @@ -72,14 +74,14 @@ You can then retrieve it with `client.GetAccessHashFor -#### 5. I need to test a feature that has been recently developed but seems not available in my program +## 5. I need to test a feature that has been recently developed but seems not available in my program The developmental versions of the library are now available as **pre-release** on Nuget (with `-dev` in the version number) So make sure you tick the checkbox "Include prerelease" in Nuget manager and/or navigate to the Versions list then select the highest `x.x.x-dev.x` version to install in your program. -#### 6. Telegram asks me to signup (firstname, lastname) even for an existing account +## 6. Telegram asks me to signup (firstname, lastname) even for an existing account This happens when you connect to Telegram Test servers instead of Production servers. On these separate test servers, all created accounts and chats are periodically deleted, so you shouldn't use them under normal circumstances. @@ -96,7 +98,7 @@ If you use the Github source project in an old .NET Framework 4.x or .NET Core x To fix this, you should also switch to using the [WTelegramClient Nuget package](https://www.nuget.org/packages/WTelegramClient) as it will install the required dependencies for it to work. -#### 7. I get errors FLOOD_WAIT_X or PEER_FLOOD, PHONE_NUMBER_BANNED, USER_DEACTIVATED_BAN. I can't import phone numbers. +## 7. I get errors FLOOD_WAIT_X or PEER_FLOOD, PHONE_NUMBER_BANNED, USER_DEACTIVATED_BAN. I can't import phone numbers. You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos), or the [API Terms of Service](https://core.telegram.org/api/terms), or make excessive requests. @@ -111,7 +113,7 @@ If you think your phone number was banned from Telegram for a wrong reason, you In any case, WTelegramClient is not responsible for the bad usage of the library and we are not affiliated to Telegram teams, so there is nothing we can do. -#### 8. How to NOT get banned from Telegram? +## 8. How to NOT get banned from Telegram? **Do not share publicly your app's ID and hash!** They cannot be regenerated and are bound to your Telegram account. @@ -147,7 +149,7 @@ We don't support such use of the library, and will not help people asking for su 11. If your client displays Telegram channels to your users, you have to support and display [official sponsored messages](https://core.telegram.org/api/sponsored-messages). -#### 9. Why the error `CHAT_ID_INVALID`? +## 9. Why the error `CHAT_ID_INVALID`? Most chat groups you see are likely of type `Channel`, not `Chat`. This difference is important to understand. Please [read about the Terminology in ReadMe](README.md#terminology). @@ -162,7 +164,7 @@ That object must be created with both fields `channel_id` and `access_hash` corr -#### 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat I'm looking for. +## 10. `chats.chats[id]` fails. My chats list is empty or does not contain the chat I'm looking for. There can be several reasons why `chats.chats` doesn't contain the chat you expect: - You're searching for a user instead of a chat ID. @@ -182,7 +184,7 @@ To help determine if `chats.chats` is empty or does not contain a certain chat, or simply use a debugger: Place a breakpoint after the `Messages_GetAllChats` call, run the program up to there, and use a Watch pane to display the content of the chats.chats dictionary. -#### 11. I get "Connection shut down" errors in my logs +## 11. I get "Connection shut down" errors in my logs There are various reasons why you may get this error. Here are the explanation and how to solve it: @@ -207,7 +209,7 @@ In this case, you can use the `PingInterval` property to increase the delay betw 5) If you're using an [MTProxy](EXAMPLES.md#proxy), some of them are known to be quite unstable. You may want to try switching to another MTProxy that is more stable. -#### 12. How to migrate from TLSharp? How to sign-in/sign-up/register account properly? +## 12. How to migrate from TLSharp? How to sign-in/sign-up/register account properly? First, make sure you read the [ReadMe documentation](README.md) completely, it contains essential information and a quick tutorial to easily understand how to correctly use the library. @@ -234,7 +236,7 @@ In particular, it will detect and handle automatically and properly the various Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto [Proxy](EXAMPLES.md#proxy), real-time updates, multiple DC connections, API documentation in Intellisense... -#### 13. How to host my userbot online? +## 13. How to host my userbot online? If you need your userbot to run 24/7, you would typically design your userbot as a Console program, compiled for Linux or Windows, and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosting) (Virtual Private Server). @@ -244,7 +246,7 @@ There are many cheap VPS Hosting offers available, for example Heroku: See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it. -#### 14. Secret Chats implementation details +## 14. Secret Chats implementation details The following choices were made while implementing Secret Chats in WTelegramClient: - It may not support remote antique Telegram clients *(prior to 2018, still using insecure MTProto 1.0)* @@ -260,7 +262,7 @@ If those missing messages are never obtained during the session, incoming messag If remote client doesn't complete this negotiation before reaching 200 messages, the Secret Chat is aborted. -#### 15. The example codes don't compile on my machine +## 15. The example codes don't compile on my machine The snippets of example codes found in the [ReadMe](README.md) or [Examples](EXAMPLES.md) pages were written for .NET 5 / C# 9 minimum. If you're having compiler problem on code constructs such as `using`, `foreach`, `[^1]` or about "Deconstruct", @@ -294,7 +296,7 @@ Here are the recommended actions to fix your problem: Also, remember to add a `using TL;` at the top of your files to have access to all the Telegram API methods. -## Troubleshooting guide +# Troubleshooting guide Here is a list of common issues and how to fix them so that your program work correctly: 1) Are you using the Nuget package or the library source code? From 76d75a6035efe73500ad23bead8ea9d7e123b36c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 26 Nov 2022 23:10:06 +0100 Subject: [PATCH 024/336] implicit Input* operators for Wallpaper, EncryptedChat, PhoneCall, Theme, GroupCall --- src/TL.Helpers.cs | 50 +++++++++++++++++++------ src/TL.Schema.cs | 94 ++++++++++++++++++++++++++++++++++++++++++++--- 2 files changed, 126 insertions(+), 18 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index baa60d3..dc68173 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -97,6 +97,17 @@ namespace TL public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, file_hash = file_hash, secret = secret }; } + partial class InputMediaUploadedDocument + { + public InputMediaUploadedDocument() { } + public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType) + { + file = inputFile; + mime_type = mimeType; + if (inputFile.Name is string filename) attributes = new[] { new DocumentAttributeFilename { file_name = filename } }; + } + } + partial class InputPhoto { public static implicit operator InputMediaPhoto(InputPhoto photo) => new() { id = photo }; @@ -340,17 +351,19 @@ namespace TL public static implicit operator InputGeoPoint(GeoPoint geo) => new() { lat = geo.lat, lon = geo.lon, accuracy_radius = geo.accuracy_radius, flags = (InputGeoPoint.Flags)geo.flags }; } - partial class InputMediaUploadedDocument + partial class WallPaperBase { - public InputMediaUploadedDocument() { } - public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType) - { - file = inputFile; - mime_type = mimeType; - if (inputFile.Name is string filename) attributes = new[] { new DocumentAttributeFilename { file_name = filename } }; - } + protected abstract InputWallPaperBase ToInputWallPaper(); + public static implicit operator InputWallPaperBase(WallPaperBase wp) => wp.ToInputWallPaper(); + } + partial class WallPaper + { + protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaper { id = id, access_hash = access_hash }; + } + partial class WallPaperNoFile + { + protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaperNoFile { id = id }; } - partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id?.UserOrChat(users, chats); } partial class Messages_DialogsBase { public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); public abstract int TotalCount { get; } } @@ -416,7 +429,8 @@ namespace TL }, pts = pts, pts_count = pts_count } }; } - partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; } + partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; + public static implicit operator InputEncryptedChat(EncryptedChatBase chat) => new() { chat_id = chat.ID, access_hash = chat.AccessHash }; } partial class EncryptedFile { @@ -554,14 +568,16 @@ namespace TL partial class Game { public static implicit operator InputGameID(Game game) => new() { id = game.id, access_hash = game.access_hash }; } partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } + partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class InputMessage { - public static implicit operator InputMessage(int id) => new InputMessageID() { id = id }; + public static implicit operator InputMessage(int id) => new InputMessageID { id = id }; } partial class InputDialogPeerBase { - public static implicit operator InputDialogPeerBase(InputPeer peer) => new InputDialogPeer() { peer = peer }; + public static implicit operator InputDialogPeerBase(InputPeer peer) => new InputDialogPeer { peer = peer }; } partial class SecureFile @@ -632,4 +648,14 @@ namespace TL return dic; } } + + partial class Theme + { + public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; + } + + partial class GroupCallBase + { + public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; + } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 1177959..3da5301 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2628,7 +2628,7 @@ namespace TL } /// Object contains info on a wallpaper. See Derived classes: , - public abstract class WallPaperBase : IObject + public abstract partial class WallPaperBase : IObject { /// Identifier public virtual long ID { get; } @@ -2637,7 +2637,7 @@ namespace TL } /// Represents a wallpaper based on an image. See [TLDef(0xA437C3ED)] - public class WallPaper : WallPaperBase + public partial class WallPaper : WallPaperBase { /// Identifier public long id; @@ -2673,7 +2673,7 @@ namespace TL } /// Represents a wallpaper only based on colors/gradients. See [TLDef(0xE0804116)] - public class WallPaperNoFile : WallPaperBase + public partial class WallPaperNoFile : WallPaperBase { /// Wallpaper ID public long id; @@ -5006,6 +5006,14 @@ namespace TL { /// Chat ID public virtual int ID { get; } + /// Checking sum depending on user ID + public virtual long AccessHash { get; } + /// Date of chat creation + public virtual DateTime Date { get; } + /// Chat creator ID + public virtual long AdminId { get; } + /// ID of second chat participant + public virtual long ParticipantId { get; } } /// Empty constructor. See [TLDef(0xAB7EC0A0)] @@ -5034,6 +5042,14 @@ namespace TL /// Chat ID public override int ID => id; + /// Checking sum depending on user ID + public override long AccessHash => access_hash; + /// Date of chat creation + public override DateTime Date => date; + /// Chat creator ID + public override long AdminId => admin_id; + /// ID of second chat participant + public override long ParticipantId => participant_id; } /// Request to create an encrypted chat. See [TLDef(0x48F1D94C)] @@ -5064,6 +5080,14 @@ namespace TL /// Chat ID public override int ID => id; + /// Check sum depending on user ID + public override long AccessHash => access_hash; + /// Chat creation date + public override DateTime Date => date; + /// Chat creator ID + public override long AdminId => admin_id; + /// ID of second chat participant + public override long ParticipantId => participant_id; } /// Encrypted chat See [TLDef(0x61F0D4C7)] @@ -5086,6 +5110,14 @@ namespace TL /// Chat ID public override int ID => id; + /// Check sum dependent on the user ID + public override long AccessHash => access_hash; + /// Date chat was created + public override DateTime Date => date; + /// Chat creator ID + public override long AdminId => admin_id; + /// ID of the second chat participant + public override long ParticipantId => participant_id; } /// Discarded or deleted chat. See [TLDef(0x1E1C7C45)] @@ -9202,10 +9234,20 @@ namespace TL } /// Phone call See Derived classes: , , , , , - public abstract class PhoneCallBase : IObject + public abstract partial class PhoneCallBase : IObject { /// Call ID public virtual long ID { get; } + /// Access hash + public virtual long AccessHash { get; } + /// Date + public virtual DateTime Date { get; } + /// Admin ID + public virtual long AdminId { get; } + /// Participant ID + public virtual long ParticipantId { get; } + /// Phone call protocol info + public virtual PhoneCallProtocol Protocol { get; } } /// Empty constructor See [TLDef(0x5366C915)] @@ -9248,6 +9290,16 @@ namespace TL /// Call ID public override long ID => id; + /// Access hash + public override long AccessHash => access_hash; + /// Date + public override DateTime Date => date; + /// Admin ID + public override long AdminId => admin_id; + /// Participant ID + public override long ParticipantId => participant_id; + /// Phone call protocol info + public override PhoneCallProtocol Protocol => protocol; } /// Requested phone call See [TLDef(0x14B0ED0C)] @@ -9278,6 +9330,16 @@ namespace TL /// Phone call ID public override long ID => id; + /// Access hash + public override long AccessHash => access_hash; + /// When was the phone call created + public override DateTime Date => date; + /// ID of the creator of the phone call + public override long AdminId => admin_id; + /// ID of the other participant of the phone call + public override long ParticipantId => participant_id; + /// Call protocol info to be passed to libtgvoip + public override PhoneCallProtocol Protocol => protocol; } /// An accepted phone call See [TLDef(0x3660C311)] @@ -9308,6 +9370,16 @@ namespace TL /// ID of accepted phone call public override long ID => id; + /// Access hash of phone call + public override long AccessHash => access_hash; + /// When was the call accepted + public override DateTime Date => date; + /// ID of the call creator + public override long AdminId => admin_id; + /// ID of the other user in the call + public override long ParticipantId => participant_id; + /// Protocol to use for phone call + public override PhoneCallProtocol Protocol => protocol; } /// Phone call See [TLDef(0x967F7C67)] @@ -9346,6 +9418,16 @@ namespace TL /// Call ID public override long ID => id; + /// Access hash + public override long AccessHash => access_hash; + /// Date of creation of the call + public override DateTime Date => date; + /// User ID of the creator of the call + public override long AdminId => admin_id; + /// User ID of the other participant in the call + public override long ParticipantId => participant_id; + /// Call protocol info to be passed to libtgvoip + public override PhoneCallProtocol Protocol => protocol; } /// Indicates a discarded phone call See [TLDef(0x50CA4DE1)] @@ -11602,7 +11684,7 @@ namespace TL /// Theme See [TLDef(0xA00E67D6)] - public class Theme : IObject + public partial class Theme : IObject { /// Flags, see TL conditional fields public Flags flags; @@ -12433,7 +12515,7 @@ namespace TL } /// A group call See Derived classes: , - public abstract class GroupCallBase : IObject + public abstract partial class GroupCallBase : IObject { /// Group call ID public virtual long ID { get; } From 42be9508967a924d095702befa5bbfc7c8508599 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 2 Dec 2022 01:42:39 +0100 Subject: [PATCH 025/336] Alt DC disconnection logged as simple warning --- EXAMPLES.md | 14 ++++++------ Examples/Program_Heroku.cs | 2 +- FAQ.md | 2 +- README.md | 10 ++++----- src/Client.Helpers.cs | 6 ++--- src/Client.cs | 8 +++++-- src/TL.Helpers.cs | 45 +++++++++++++------------------------- src/WTelegramClient.csproj | 4 ++-- 8 files changed, 40 insertions(+), 51 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 88bf1de..654e117 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -95,7 +95,7 @@ foreach (Dialog dialog in dialogs.dialogs) Notes: - The lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users. -- See also the `Main` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). +- See also the `Main` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L20). - To retrieve the dialog information about a specific [peer](README.md#terminology), use `client.Messages_GetPeerDialogs(inputPeer)` @@ -114,7 +114,7 @@ Notes: - The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this. - If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). -- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](Examples/Program_GetAllChats.cs) +- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_GetAllChats.cs#L32) ## List the members from a chat @@ -189,14 +189,14 @@ Notes: This is done through the `client.OnUpdate` callback event. Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. -See [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L23). ## Monitor new messages being posted in chats in real-time You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. -See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](Examples/Program_ListenUpdates.cs). +See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L23). You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. @@ -206,7 +206,7 @@ You can filter specific chats the message are posted in, by looking at the `Mess This is done using the helper method `client.DownloadFileAsync(file, outputStream)` that simplifies the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. -See [Examples/Program_DownloadSavedMedia.cs](Examples/Program_DownloadSavedMedia.cs) that download all media files you forward to yourself (Saved Messages) +See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs#L31) that download all media files you forward to yourself (Saved Messages) ## Upload a media file and post it with caption to a chat @@ -448,7 +448,7 @@ You can automate the collection of `access_hash` for the various resources obtai so that you don't have to remember them by yourself or ask the API about them each time. This is done by activating the experimental `client.CollectAccessHash` system. -See [Examples/Program_CollectAccessHash.cs](Examples/Program_CollectAccessHash.cs) for how to enable it, and save/restore them for later use. +See [Examples/Program_CollectAccessHash.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_CollectAccessHash.cs#L22) for how to enable it, and save/restore them for later use. ## Use a proxy or MTProxy to connect to Telegram @@ -516,7 +516,7 @@ You can find an example for such custom session store in [Examples/Program_Herok This can be done easily using the helper class `WTelegram.SecretChats` offering methods to manage/encrypt/decrypt secret chats & encrypted messages/files. -You can view a full working example at [Examples/Program_SecretChats.cs](Examples/Program_SecretChats.cs). +You can view a full working example at [Examples/Program_SecretChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_SecretChats.cs#L11). Secret Chats have been tested successfully with Telegram Android & iOS official clients. You can also check our [FAQ for more implementation details](FAQ.md#14-secret-chats-implementation-details). \ No newline at end of file diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index cfdb551..70fffdf 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -8,7 +8,7 @@ using TL; // This is an example userbot designed to run on a Heroku account with a PostgreSQL database for session storage // This userbot simply answer "Pong" when someone sends him a "Ping" private message (or in Saved Messages) -// To use/install/deploy this userbot, follow the steps at the end of this file +// To use/install/deploy this userbot ➡️ follow the steps at the end of this file // When run locally, close the window or type ALT-F4 to exit cleanly and save session (similar to Heroku SIGTERM) namespace WTelegramClientTest diff --git a/FAQ.md b/FAQ.md index 2cd38db..4d388e9 100644 --- a/FAQ.md +++ b/FAQ.md @@ -243,7 +243,7 @@ and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosti Pure WebApp hosts might not be adequate as they will recycle (stop) your app if there is no incoming HTTP requests. There are many cheap VPS Hosting offers available, for example Heroku: -See [Examples/Program_Heroku.cs](Examples/Program_Heroku.cs) for such an implementation and the steps to host/deploy it. +See [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs#L9) for such an implementation and the steps to host/deploy it. ## 14. Secret Chats implementation details diff --git a/README.md b/README.md index 88d7368..7aacdc3 100644 --- a/README.md +++ b/README.md @@ -1,9 +1,9 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) -## _Telegram Client API library written 100% in C# and .NET Standard_ +## _Telegram Client API library written 100% in C# and .NET_ This library allows you to connect to Telegram and control a user programmatically (or a bot, but [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. @@ -90,7 +90,7 @@ Since version 3.0.0, a new approach to login/configuration has been added. Some ```csharp WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH"); -await DoLogin("+12025550156"); // user's phone_number +await DoLogin("+12025550156"); // initial call with user's phone_number async Task DoLogin(string loginInfo) // (add this method to your code) { @@ -150,7 +150,7 @@ await client.SendMessageAsync(target, "Hello, World"); ➡️ You can find lots of useful code snippets in [EXAMPLES](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). -➡️ Check [the FAQ](https://wiz0u.github.io/WTelegramClient/FAQ#compile) if example codes doesn't compile correctly on your machine, or other troubleshooting. +➡️ Check [the FAQ](https://wiz0u.github.io/WTelegramClient/FAQ#compile) if example codes don't compile correctly on your machine, or other troubleshooting. # Terminology in Telegram Client API @@ -189,7 +189,7 @@ as well as generic handling of chats/channels. This library works best with **.NET 5.0+** (faster, no dependencies) and is also available for **.NET Standard 2.0** (.NET Framework 4.6.1+ & .NET Core 2.0+) and **Xamarin/Mono.Android** # Library uses and limitations -This library can be used for any Telegram scenarios including: +This library can be used for any Telegram scenario including: - Sequential or parallel automated steps based on API requests/responses - Real-time [monitoring](https://wiz0u.github.io/WTelegramClient/EXAMPLES#updates) of incoming Updates/Messages - Download/upload of files/media diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 6fe1510..30da842 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -586,7 +586,7 @@ namespace WTelegram public Task AddChatUser(InputPeer peer, InputUserBase user) => peer switch { InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, int.MaxValue), - InputPeerChannel channel => this.Channels_InviteToChannel(channel, new[] { user }), + InputPeerChannel channel => this.Channels_InviteToChannel(channel, user), _ => throw new ArgumentException(OnlyChatChannel), }; @@ -620,7 +620,7 @@ namespace WTelegram case InputPeerChat chat: await this.Messages_EditChatAdmin(chat.chat_id, user, is_admin); return new Updates { date = DateTime.UtcNow, users = new(), updates = Array.Empty(), - chats = (await this.Messages_GetChats(new[] { chat.chat_id })).chats }; + chats = (await this.Messages_GetChats(chat.chat_id)).chats }; case InputPeerChannel channel: return await this.Channels_EditAdmin(channel, user, new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); @@ -667,7 +667,7 @@ namespace WTelegram case InputPeerChat chat: await this.Messages_DeleteChat(chat.chat_id); return new Updates { date = DateTime.UtcNow, users = new(), updates = Array.Empty(), - chats = (await this.Messages_GetChats(new[] { chat.chat_id })).chats }; + chats = (await this.Messages_GetChats(chat.chat_id)).chats }; case InputPeerChannel channel: return await this.Channels_DeleteChannel(channel); default: diff --git a/src/Client.cs b/src/Client.cs index 891764a..af5234e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -310,7 +310,11 @@ namespace WTelegram catch (Exception ex) // an exception in RecvAsync is always fatal { if (cts.IsCancellationRequested) return; - Helpers.Log(5, $"{_dcSession.DcID}>An exception occured in the reactor: {ex}"); + bool disconnectedAltDC = !IsMainDC && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }; + if (disconnectedAltDC) + Helpers.Log(3, $"{_dcSession.DcID}>Alt DC disconnected: {ex.Message}"); + else + Helpers.Log(5, $"{_dcSession.DcID}>An exception occured in the reactor: {ex}"); var oldSemaphore = _sendSemaphore; await oldSemaphore.WaitAsync(cts.Token); // prevent any sending while we reconnect var reactorError = new ReactorError { Exception = ex }; @@ -319,7 +323,7 @@ namespace WTelegram lock (_msgsToAck) _msgsToAck.Clear(); Reset(false, false); _reactorReconnects = (_reactorReconnects + 1) % MaxAutoReconnects; - if (!IsMainDC && _pendingRpcs.Count <= 1 && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }) + if (disconnectedAltDC && _pendingRpcs.Count <= 1) if (_pendingRpcs.Values.FirstOrDefault() is not Rpc rpc || rpc.type == typeof(Pong)) _reactorReconnects = 0; if (_reactorReconnects == 0) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index dc68173..b0abb38 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -351,19 +351,11 @@ namespace TL public static implicit operator InputGeoPoint(GeoPoint geo) => new() { lat = geo.lat, lon = geo.lon, accuracy_radius = geo.accuracy_radius, flags = (InputGeoPoint.Flags)geo.flags }; } - partial class WallPaperBase - { - protected abstract InputWallPaperBase ToInputWallPaper(); - public static implicit operator InputWallPaperBase(WallPaperBase wp) => wp.ToInputWallPaper(); - } - partial class WallPaper - { - protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaper { id = id, access_hash = access_hash }; - } - partial class WallPaperNoFile - { - protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaperNoFile { id = id }; - } + partial class WallPaperBase { public static implicit operator InputWallPaperBase(WallPaperBase wp) => wp.ToInputWallPaper(); + protected abstract InputWallPaperBase ToInputWallPaper(); } + partial class WallPaper { protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaper { id = id, access_hash = access_hash }; } + partial class WallPaperNoFile { protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaperNoFile { id = id }; } + partial class Contacts_Blocked { public IPeerInfo UserOrChat(PeerBlocked peer) => peer.peer_id?.UserOrChat(users, chats); } partial class Messages_DialogsBase { public IPeerInfo UserOrChat(DialogBase dialog) => UserOrChat(dialog.Peer); public abstract int TotalCount { get; } } @@ -429,8 +421,8 @@ namespace TL }, pts = pts, pts_count = pts_count } }; } - partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; - public static implicit operator InputEncryptedChat(EncryptedChatBase chat) => new() { chat_id = chat.ID, access_hash = chat.AccessHash }; } + partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; + public static implicit operator InputEncryptedChat(EncryptedChatBase chat) => new() { chat_id = chat.ID, access_hash = chat.AccessHash }; } partial class EncryptedFile { @@ -568,7 +560,7 @@ namespace TL partial class Game { public static implicit operator InputGameID(Game game) => new() { id = game.id, access_hash = game.access_hash }; } partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } - partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } partial class InputMessage { @@ -587,11 +579,11 @@ namespace TL } partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } - partial class JSONValue { public abstract object ToNative(); } - partial class JsonNull { public override object ToNative() => null; public override string ToString() => "null"; } - partial class JsonBool { public override object ToNative() => value; public override string ToString() => value ? "true" : "false"; } - partial class JsonNumber { public override object ToNative() => value; public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } - partial class JsonString { public override object ToNative() => value; public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); } + partial class JSONValue { public abstract object ToNative(); } + partial class JsonNull { public override object ToNative() => null; public override string ToString() => "null"; } + partial class JsonBool { public override object ToNative() => value; public override string ToString() => value ? "true" : "false"; } + partial class JsonNumber { public override object ToNative() => value; public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } + partial class JsonString { public override object ToNative() => value; public override string ToString() => HttpUtility.JavaScriptStringEncode(value, true); } partial class JsonArray { public override string ToString() @@ -649,13 +641,6 @@ namespace TL } } - partial class Theme - { - public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; - } - - partial class GroupCallBase - { - public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; - } + partial class Theme { public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; } + partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index eccde27..3b1b4a8 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,7 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API library written 100% in C# and .NET Standard | Latest MTProto & Telegram API layer version Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 149 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient @@ -21,7 +21,7 @@ true https://github.com/wiz0u/WTelegramClient.git git - Telegram;Client;Api;UserBot;MTProto;TLSharp;OpenTl + Telegram;MTProto;Client;Api;UserBot;TLSharp README.md $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) IDE0079;0419;1573;1591;NETSDK1138 From 231bf632e2dddbb838e702e8f66bdf959bc90fd5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 5 Dec 2022 20:32:32 +0100 Subject: [PATCH 026/336] Custom emoji Markdown/Html syntax updated for tdlib compatibility - Markdown: ![x](tg://emoji?id=...) - Html: Previous syntaxes are still accepted Also, changed Github examples links with ts=4 --- EXAMPLES.md | 20 ++++++++++---------- FAQ.md | 2 +- README.md | 18 +++++++++--------- src/Client.Helpers.cs | 2 +- src/Client.cs | 2 +- src/TL.Extensions.cs | 17 ++++++++++------- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 654e117..f62efda 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -95,7 +95,7 @@ foreach (Dialog dialog in dialogs.dialogs) Notes: - The lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users. -- See also the `Main` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L20). +- See also the `Main` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L20). - To retrieve the dialog information about a specific [peer](README.md#terminology), use `client.Messages_GetPeerDialogs(inputPeer)` @@ -114,7 +114,7 @@ Notes: - The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this. - If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). -- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_GetAllChats.cs#L32) +- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_GetAllChats.cs?ts=4#L32) ## List the members from a chat @@ -189,14 +189,14 @@ Notes: This is done through the `client.OnUpdate` callback event. Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. -See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L23). +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). ## Monitor new messages being posted in chats in real-time You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. -See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs#L23). +See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. @@ -206,7 +206,7 @@ You can filter specific chats the message are posted in, by looking at the `Mess This is done using the helper method `client.DownloadFileAsync(file, outputStream)` that simplifies the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. -See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs#L31) that download all media files you forward to yourself (Saved Messages) +See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L31) that download all media files you forward to yourself (Saved Messages) ## Upload a media file and post it with caption to a chat @@ -323,10 +323,10 @@ await Task.Delay(5000); ## Fun with custom emojies and reactions on pinned messages ```csharp // • Sending a message with custom emojies in Markdown to ourself: -var text = "Vicksy says Hi! [👋](emoji?id=5190875290439525089)"; +var text = "Vicksy says Hi! ![👋](tg://emoji?id=5190875290439525089)"; var entities = client.MarkdownToEntities(ref text, premium: true); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); -// also available in HTML: 👋 +// also available in HTML: 👋 // • Fetch all available standard emoji reactions var all_emoji = await client.Messages_GetAvailableReactions(); @@ -448,7 +448,7 @@ You can automate the collection of `access_hash` for the various resources obtai so that you don't have to remember them by yourself or ask the API about them each time. This is done by activating the experimental `client.CollectAccessHash` system. -See [Examples/Program_CollectAccessHash.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_CollectAccessHash.cs#L22) for how to enable it, and save/restore them for later use. +See [Examples/Program_CollectAccessHash.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_CollectAccessHash.cs?ts=4#L22) for how to enable it, and save/restore them for later use. ## Use a proxy or MTProxy to connect to Telegram @@ -509,14 +509,14 @@ you can choose to store the session data somewhere else, like in a database. The WTelegram.Client constructor takes an optional `sessionStore` parameter to allow storing sessions in an alternate manner. Use it to pass a custom Stream-derived class that will **read** (first initial call to Length & Read) and **store** (subsequent Writes) session data to database. -You can find an example for such custom session store in [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs#L61) +You can find an example for such custom session store in [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs?ts=4#L61) ## Send/receive end-to-end encrypted messages & files in Secret Chats This can be done easily using the helper class `WTelegram.SecretChats` offering methods to manage/encrypt/decrypt secret chats & encrypted messages/files. -You can view a full working example at [Examples/Program_SecretChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_SecretChats.cs#L11). +You can view a full working example at [Examples/Program_SecretChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_SecretChats.cs?ts=4#L11). Secret Chats have been tested successfully with Telegram Android & iOS official clients. You can also check our [FAQ for more implementation details](FAQ.md#14-secret-chats-implementation-details). \ No newline at end of file diff --git a/FAQ.md b/FAQ.md index 4d388e9..2363f45 100644 --- a/FAQ.md +++ b/FAQ.md @@ -243,7 +243,7 @@ and hosted online on any [VPS Hosting](https://www.google.com/search?q=vps+hosti Pure WebApp hosts might not be adequate as they will recycle (stop) your app if there is no incoming HTTP requests. There are many cheap VPS Hosting offers available, for example Heroku: -See [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs#L9) for such an implementation and the steps to host/deploy it. +See [Examples/Program_Heroku.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_Heroku.cs?ts=4#L9) for such an implementation and the steps to host/deploy it. ## 14. Secret Chats implementation details diff --git a/README.md b/README.md index 7aacdc3..028de8d 100644 --- a/README.md +++ b/README.md @@ -156,23 +156,23 @@ and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree # Terminology in Telegram Client API In the API, Telegram uses some terms/classnames that can be confusing as they differ from the terms shown to end-users: -- `Channel` : A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))* +- `Channel`: A (large or public) chat group *(sometimes called [supergroup](https://corefork.telegram.org/api/channel#supergroups))*, or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (the `broadcast` flag differentiate those) -- `Chat` : A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members +- `Chat`: A private [basic chat group](https://corefork.telegram.org/api/channel#basic-groups) with less than 200 members (it may be migrated to a supergroup `Channel` with a new ID when it gets bigger or public, in which case the old `Chat` will still exist but will be `deactivated`) **⚠️ Most chat groups you see are really of type `Channel`, not `Chat`!** -- chats : In plural or general meaning, it means either `Chat` or `Channel` *(therefore, no private user discussions)* -- `Peer` : Either a `Chat`, a `Channel` or a `User` -- Dialog : Status of chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. -- Access Hash : Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them. +- **chats**: In plural or general meaning, it means either `Chat` or `Channel` *(therefore, no private user discussions)* +- `Peer`: Either a `Chat`, a `Channel` or a `User` +- **Dialog**: Status of chat with a `Peer` *(draft, last message, unread count, pinned...)*. It represents each line from your Telegram chat list. +- **Access Hash**: Telegram requires you to provide a specific `access_hash` for users, channels, and other resources before interacting with them. See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn more about it. -- DC (DataCenter) : There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. -- Session or Authorization : Pairing between a device and a phone number. You can have several active sessions for the same phone number. +- **DC** (DataCenter): There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. +- **Session** or **Authorization**: Pairing between a device and a phone number. You can have several active sessions for the same phone number. # Other things to know The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. -See [Examples/Program_ListenUpdates.cs](https://wiz0u.github.io/WTelegramClient/Examples/Program_ListenUpdates.cs) +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 30da842..f9adc37 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -25,7 +25,7 @@ namespace WTelegram /// Retrieve the access_hash associated with this id (for a TL class) if it was collected /// This requires to be set to first. - /// See Examples/Program_CollectAccessHash.cs for how to use this + /// See Examples/Program_CollectAccessHash.cs for how to use this /// a TL object class. For example User, Channel or Photo public long GetAccessHashFor(long id) where T : IObject { diff --git a/src/Client.cs b/src/Client.cs index af5234e..7918d1f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -24,7 +24,7 @@ namespace WTelegram public partial class Client : IDisposable { /// This event will be called when unsollicited updates/messages are sent by Telegram servers - /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
+ /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
public event Func OnUpdate; /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index f028131..fb18172 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -91,6 +91,9 @@ namespace TL else ProcessEntity(); break; + case '!' when offset + 1 < sb.Length && sb[offset + 1] == '[': + sb.Remove(offset, 1); + goto case '['; case '[': entities.Add(new MessageEntityTextUrl { offset = offset, length = -1 }); sb.Remove(offset, 1); @@ -112,7 +115,7 @@ namespace TL textUrl.url = sb.ToString(offset + 2, offset2 - offset - 3); if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && client.GetAccessHashFor(id) is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(id, hash) }; - else if (textUrl.url.StartsWith("emoji?id=") && long.TryParse(textUrl.url[9..], out id)) + else if ((textUrl.url.StartsWith("tg://emoji?id=") || textUrl.url.StartsWith("emoji?id=")) && long.TryParse(textUrl.url[(textUrl.url.IndexOf('=') + 1)..], out id)) if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; else entities.RemoveAt(lastIndex); sb.Remove(offset, offset2 - offset); @@ -165,7 +168,7 @@ namespace TL if (entityToMD.TryGetValue(nextEntity.GetType(), out var md)) { var closing = (nextEntity.offset + nextEntity.length, md); - if (md[0] == '[') + if (md[0] is '[' or '!') { if (nextEntity is MessageEntityTextUrl metu) closing.md = $"]({metu.url.Replace("\\", "\\\\").Replace(")", "\\)").Replace(">", "%3E")})"; @@ -174,7 +177,7 @@ namespace TL else if (nextEntity is InputMessageEntityMentionName imemn) closing.md = $"](tg://user?id={imemn.user_id.UserId ?? client.UserId})"; else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) closing.md = $"](emoji?id={mecu.document_id})"; + if (premium) closing.md = $"](tg://emoji?id={mecu.document_id})"; else continue; } else if (nextEntity is MessageEntityPre mep) @@ -208,7 +211,7 @@ namespace TL [typeof(MessageEntityUnderline)] = "__", [typeof(MessageEntityStrike)] = "~", [typeof(MessageEntitySpoiler)] = "||", - [typeof(MessageEntityCustomEmoji)] = "[", + [typeof(MessageEntityCustomEmoji)] = "![", }; /// Insert backslashes in front of Markdown reserved characters @@ -304,8 +307,8 @@ namespace TL if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; } - else if (premium && tag.StartsWith("tg-emoji id=\"")) - entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[13..^1]) }); + else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji id=\""))) + entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[(tag.IndexOf('=') + 2)..^1]) }); break; } @@ -361,7 +364,7 @@ namespace TL tag = $""; } else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) tag = $""; + if (premium) tag = $""; else continue; else if (nextEntity is MessageEntityPre mep && !string.IsNullOrEmpty(mep.language)) { From eb2577beedd7770c3353d2e8a6f39c1ccf7ae961 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 7 Dec 2022 13:36:49 +0100 Subject: [PATCH 027/336] Upgrade to layer 150: Anti-Spam, web/contact tokens, chat TTL, hide topics, Fragment login --- README.md | 2 +- src/TL.Schema.cs | 50 ++++++++++++++- src/TL.SchemaFuncs.cs | 122 ++++++++++++++++++++++++++++++++++--- src/TL.Table.cs | 12 ++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 171 insertions(+), 17 deletions(-) diff --git a/README.md b/README.md index 028de8d..ccb1edf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-149-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-150-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3da5301..908cd31 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1344,6 +1344,7 @@ namespace TL { /// Can we delete this channel? can_delete_channel = 0x1, + antispam = 0x2, } /// ID of the channel @@ -2103,11 +2104,19 @@ namespace TL public long[] users; } /// The Time-To-Live of messages in this chat was changed. See - [TLDef(0xAA1AFBFD)] + [TLDef(0x3C134D7B)] public class MessageActionSetMessagesTTL : MessageAction { + public Flags flags; /// New Time-To-Live public int period; + [IfFlag(0)] public long auto_setting_from; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_auto_setting_from = 0x1, + } } /// A group call was scheduled See [TLDef(0xB3A07661)] @@ -2168,19 +2177,21 @@ namespace TL } } /// See - [TLDef(0xB18A431C)] + [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { public Flags flags; [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint { has_title = 0x1, has_icon_emoji_id = 0x2, has_closed = 0x4, + has_hidden = 0x8, } } @@ -2193,7 +2204,7 @@ namespace TL public virtual int TopMessage { get; } } /// Chat See - [TLDef(0xA8EDD0F5)] + [TLDef(0xD58A08C6)] public class Dialog : DialogBase { /// Flags, see TL conditional fields @@ -2220,6 +2231,7 @@ namespace TL [IfFlag(1)] public DraftMessageBase draft; /// Peer folder ID, for more info click here [IfFlag(4)] public int folder_id; + [IfFlag(5)] public int ttl_period; [Flags] public enum Flags : uint { @@ -2233,6 +2245,8 @@ namespace TL unread_mark = 0x8, /// Field has a value has_folder_id = 0x10, + /// Field has a value + has_ttl_period = 0x20, } /// The chat @@ -7754,6 +7768,8 @@ namespace TL FlashCall = 0x226CCEFB, ///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user. MissedCall = 0xD61AD6EE, + ///See + FragmentSms = 0x06ED998C, } /// Type of the verification code that was sent See Derived classes: , , , , , , @@ -7831,6 +7847,12 @@ namespace TL google_signin_allowed = 0x2, } } + /// See + [TLDef(0xD9565C39)] + public class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms + { + public string url; + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -10049,6 +10071,12 @@ namespace TL has_new_topic = 0x2, } } + /// See + [TLDef(0x64F36DFC)] + public class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction + { + public bool new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -13954,6 +13982,7 @@ namespace TL pinned = 0x8, has_draft = 0x10, short_ = 0x20, + hidden = 0x40, } public override int ID => id; @@ -13978,4 +14007,19 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0x43B46B20)] + public class DefaultHistoryTTL : IObject + { + public int period; + } + + /// See + [TLDef(0x41BF109B)] + public class ExportedContactToken : IObject + { + public string url; + public DateTime expires; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 93ac53c..66f7c00 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -286,6 +286,15 @@ namespace TL code = code, }); + /// See + public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) + => client.Invoke(new Auth_ImportWebTokenAuthorization + { + api_id = api_id, + api_hash = api_hash, + web_auth_token = web_auth_token, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1282,6 +1291,19 @@ namespace TL phone = phone, }); + /// See + public static Task Contacts_ExportContactToken(this Client client) + => client.Invoke(new Contacts_ExportContactToken + { + }); + + /// See + public static Task Contacts_ImportContactToken(this Client client, string token) + => client.Invoke(new Contacts_ImportContactToken + { + token = token, + }); + /// This method is only for basic Chat. See Terminology 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) @@ -1603,11 +1625,13 @@ namespace TL /// Creates a new chat. See Possible codes: 400,403,500 (details) /// List of user IDs to be invited /// Chat name - public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title) + public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) => client.Invoke(new Messages_CreateChat { + flags = (Messages_CreateChat.Flags)(ttl_period != null ? 0x1 : 0), users = users, title = title, + ttl_period = ttl_period.GetValueOrDefault(), }); /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) @@ -3419,6 +3443,19 @@ namespace TL id = id, }); + /// See + public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) + => client.Invoke(new Messages_SetDefaultHistoryTTL + { + period = period, + }); + + /// See + public static Task Messages_GetDefaultHistoryTTL(this Client client) + => client.Invoke(new Messages_GetDefaultHistoryTTL + { + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3867,14 +3904,15 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null) + public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null) => client.Invoke(new Channels_CreateChannel { - flags = (Channels_CreateChannel.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0)), + flags = (Channels_CreateChannel.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0)), title = title, about = about, geo_point = geo_point, address = address, + ttl_period = ttl_period.GetValueOrDefault(), }); /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) @@ -4268,15 +4306,16 @@ namespace TL }); /// See - public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default) + public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) => client.Invoke(new Channels_EditForumTopic { - flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0)), + flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), channel = channel, topic_id = topic_id, title = title, icon_emoji_id = icon_emoji_id.GetValueOrDefault(), closed = closed.GetValueOrDefault(), + hidden = hidden.GetValueOrDefault(), }); /// See @@ -4305,6 +4344,22 @@ namespace TL order = order, }); + /// See + public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleAntiSpam + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) + => client.Invoke(new Channels_ReportAntiSpamFalsePositive + { + channel = channel, + msg_id = msg_id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5274,6 +5329,14 @@ namespace TL.Methods public string code; } + [TLDef(0x2DB873A9)] + public class Auth_ImportWebTokenAuthorization : IMethod + { + public int api_id; + public string api_hash; + public string web_auth_token; + } + [TLDef(0xEC86017A)] public class Account_RegisterDevice : IMethod { @@ -6049,6 +6112,15 @@ namespace TL.Methods public string phone; } + [TLDef(0xF8654027)] + public class Contacts_ExportContactToken : IMethod { } + + [TLDef(0x13005788)] + public class Contacts_ImportContactToken : IMethod + { + public string token; + } + [TLDef(0x63C66506)] public class Messages_GetMessages : IMethod { @@ -6324,11 +6396,18 @@ namespace TL.Methods } } - [TLDef(0x09CB126E)] + [TLDef(0x0034A818)] public class Messages_CreateChat : IMethod { + public Flags flags; public InputUserBase[] users; public string title; + [IfFlag(0)] public int ttl_period; + + [Flags] public enum Flags : uint + { + has_ttl_period = 0x1, + } } [TLDef(0x26CF8950)] @@ -7862,6 +7941,15 @@ namespace TL.Methods public int[] id; } + [TLDef(0x9EB51445)] + public class Messages_SetDefaultHistoryTTL : IMethod + { + public int period; + } + + [TLDef(0x658B7188)] + public class Messages_GetDefaultHistoryTTL : IMethod { } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8172,7 +8260,7 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0x3D5FB10F)] + [TLDef(0x91006707)] public class Channels_CreateChannel : IMethod { public Flags flags; @@ -8180,6 +8268,7 @@ namespace TL.Methods public string about; [IfFlag(2)] public InputGeoPoint geo_point; [IfFlag(2)] public string address; + [IfFlag(4)] public int ttl_period; [Flags] public enum Flags : uint { @@ -8187,6 +8276,7 @@ namespace TL.Methods megagroup = 0x2, has_geo_point = 0x4, for_import = 0x8, + has_ttl_period = 0x10, } } @@ -8505,7 +8595,7 @@ namespace TL.Methods public int[] topics; } - [TLDef(0x6C883E2D)] + [TLDef(0xF4DFA185)] public class Channels_EditForumTopic : IMethod { public Flags flags; @@ -8514,12 +8604,14 @@ namespace TL.Methods [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint { has_title = 0x1, has_icon_emoji_id = 0x2, has_closed = 0x4, + has_hidden = 0x8, } } @@ -8551,6 +8643,20 @@ namespace TL.Methods } } + [TLDef(0x68F3E4EB)] + public class Channels_ToggleAntiSpam : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0xA850A693)] + public class Channels_ReportAntiSpamFalsePositive : IMethod + { + public InputChannelBase channel; + public int msg_id; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d991db7..f1f9db4 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 = 149; // fetched 23/11/2022 13:15:45 + public const int Version = 150; // fetched 07/12/2022 12:23:35 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -184,7 +184,7 @@ namespace TL [0x98E0D697] = typeof(MessageActionGeoProximityReached), [0x7A0D7F42] = typeof(MessageActionGroupCall), [0x502F92F7] = typeof(MessageActionInviteToGroupCall), - [0xAA1AFBFD] = typeof(MessageActionSetMessagesTTL), + [0x3C134D7B] = typeof(MessageActionSetMessagesTTL), [0xB3A07661] = typeof(MessageActionGroupCallScheduled), [0xAA786345] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), @@ -192,8 +192,8 @@ namespace TL [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), [0xABA0F5C6] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), - [0xB18A431C] = typeof(MessageActionTopicEdit), - [0xA8EDD0F5] = typeof(Dialog), + [0xC0944820] = typeof(MessageActionTopicEdit), + [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), [0xFB197A65] = typeof(Photo), @@ -598,6 +598,7 @@ namespace TL [0x82006484] = typeof(Auth_SentCodeTypeMissedCall), [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), + [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -763,6 +764,7 @@ namespace TL [0xF06FE208] = typeof(ChannelAdminLogEventActionEditTopic), [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), + [0x64F36DFC] = typeof(ChannelAdminLogEventActionToggleAntiSpam), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1047,6 +1049,8 @@ namespace TL [0x023F109B] = typeof(ForumTopicDeleted), [0x71701DA9] = typeof(ForumTopic), [0x367617D3] = typeof(Messages_ForumTopics), + [0x43B46B20] = typeof(DefaultHistoryTTL), + [0x41BF109B] = typeof(ExportedContactToken), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3b1b4a8..5718f70 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: 149 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 150 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient From aa9c4b532cad7a01e5f50c09a52ccc1866ab2e97 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:07:07 +0100 Subject: [PATCH 028/336] Improved documentation --- .github/dev.yml | 2 +- EXAMPLES.md | 17 ++-- README.md | 2 +- src/TL.Extensions.cs | 8 +- src/TL.Helpers.cs | 2 +- src/TL.Schema.cs | 186 +++++++++++++++++++++--------------------- src/TL.SchemaFuncs.cs | 86 +++++++++---------- 7 files changed, 148 insertions(+), 155 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 31ee239..da0ac65 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.1.4-dev.$(Rev:r) +name: 3.1.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index f62efda..de51ccf 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -352,7 +352,7 @@ var messages = await client.Messages_Search(chat, lim foreach (var msg in messages.Messages) await client.Messages_SendReaction(chat, msg.ID, reaction: new[] { reaction }); ``` -*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/methods#working-with-custom-animated-emojis) or inspecting incoming messages. Access hash is not required* +*Note: you can find custom emoji document IDs via API methods like [Messages_GetFeaturedEmojiStickers](https://corefork.telegram.org/methods#working-with-custom-animated-emojis) or inspecting messages entities. Access hash is not required* @@ -371,7 +371,7 @@ To use them, you need to extract the `HASH` part from the URL and then you can u ```csharp var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get information before joining await client.Messages_ImportChatInvite("HASH"); // join the channel/group -// Note: This works also with hash invite links of public channel/group +// Note: This works also with HASH invite links from public channel/group ``` @@ -452,29 +452,22 @@ See [Examples/Program_CollectAccessHash.cs](https://github.com/wiz0u/WTelegramCl ## Use a proxy or MTProxy to connect to Telegram -SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/): +SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/) or [xNetStandard](https://www.nuget.org/packages/xNetStandard/): ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.TcpHandler = async (address, port) => { var proxy = new Socks5ProxyClient(ProxyHost, ProxyPort, ProxyUsername, ProxyPassword); + //var proxy = xNet.Socks5ProxyClient.Parse("host:port:username:password"); return proxy.CreateConnection(address, port); }; await client.LoginUserIfNeeded(); ``` -or with [xNetStandard](https://www.nuget.org/packages/xNetStandard/): -```csharp -client.TcpHandler = async (address, port) => -{ - var proxy = xNet.Socks5ProxyClient.Parse("host:port:username:password"); - return proxy.CreateConnection(address, port); -}; -``` MTProxy (MTProto proxy) can be used to prevent ISP blocking Telegram servers, through the `client.MTProxyUrl` property: ```csharp using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); -client.MTProxyUrl = "http://t.me/proxy?server=...&port=...&secret=..."; +client.MTProxyUrl = "https://t.me/proxy?server=...&port=...&secret=..."; await client.LoginUserIfNeeded(); ``` You can find a list of working MTProxies in channels like [@ProxyMTProto](https://t.me/ProxyMTProto) or [@MTProxyT](https://t.me/MTProxyT) *(right-click the "Connect" buttons)* diff --git a/README.md b/README.md index ccb1edf..caa4f31 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ If you run this program again, you will notice that only **api_hash** is request This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time. -That file path is configurable (session_pathname), and under various circumstances (changing user or server address) +That file path is configurable (**session_pathname**), and under various circumstances (changing user or server address) you may want to change it or simply delete the existing session file in order to restart the authentification process. # Non-interactive configuration diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index fb18172..2c6f5b8 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -142,8 +142,8 @@ namespace TL /// Converts the (plain text + entities) format used by Telegram messages into a Markdown text /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf - /// The plain text, typically obtained from - /// The array of formatting entities, typically obtained from + /// The plain text, typically obtained from + /// The array of formatting entities, typically obtained from /// Convert premium entities (might lead to non-standard markdown) /// The message text with MarkdownV2 formattings public static string EntitiesToMarkdown(this WTelegram.Client client, string message, MessageEntity[] entities, bool premium = false) @@ -329,8 +329,8 @@ namespace TL /// Converts the (plain text + entities) format used by Telegram messages into an HTML-formatted text /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf - /// The plain text, typically obtained from - /// The array of formatting entities, typically obtained from + /// The plain text, typically obtained from + /// The array of formatting entities, typically obtained from /// Convert premium entities /// The message text with HTML formatting tags public static string EntitiesToHtml(this WTelegram.Client client, string message, MessageEntity[] entities, bool premium = false) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index b0abb38..21adbde 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -113,7 +113,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 + /// 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 908cd31..72c0a58 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -114,7 +114,7 @@ namespace TL /// Object defines a contact from the user's phone book. See Derived classes: public abstract class InputContact : IObject { } - /// Phone contact. The client_id is just an arbitrary contact ID: it should be set, for example, to an incremental number when using contacts.importContacts, in order to retry importing only the contacts that weren't imported successfully. See + /// Phone contact. The client_id is just an arbitrary contact ID: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully. See [TLDef(0xF392B7F4)] public class InputPhoneContact : InputContact { @@ -138,7 +138,7 @@ namespace TL /// Full name of the file public virtual string Name { get; } } - /// Defines a file saved in parts using the method upload.saveFilePart. See + /// Defines a file saved in parts using the method Upload_SaveFilePart. See [TLDef(0xF52FF27F)] public partial class InputFile : InputFileBase { @@ -158,7 +158,7 @@ namespace TL /// Full name of the file public override string Name => name; } - /// Assigns a big file (over 10 MB in size), saved in part using the method upload.saveBigFilePart. See + /// Assigns a big file (over 10 MB in size), saved in part using the method Upload_SaveBigFilePart. See [TLDef(0xFA4F0BB5)] public partial class InputFileBig : InputFileBase { @@ -451,7 +451,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// File saved in parts using the method upload.saveFilePart + /// File saved in parts using the method Upload_SaveFilePart [IfFlag(0)] public InputFileBase file; /// Square video for animated profile picture [IfFlag(1)] public InputFileBase video; @@ -559,7 +559,7 @@ namespace TL /// Empty constructor for takeout See [TLDef(0x29BE5899)] public class InputTakeoutFileLocation : InputFileLocationBase { } - /// Use this object to download a photo with upload.getFile method See + /// Use this object to download a photo with Upload_GetFile method See [TLDef(0x40181FFE)] public class InputPhotoFileLocation : InputFileLocationBase { @@ -720,7 +720,7 @@ namespace TL [IfFlag(5)] public UserProfilePhoto photo; /// Online status of user [IfFlag(6)] public UserStatus status; - /// Version of the , incremented every time it changes + /// Version of the bot_info field in userFull, incremented every time it changes [IfFlag(14)] public int bot_info_version; /// Contains the reason why access to this user must be restricted. [IfFlag(18)] public RestrictionReason[] restriction_reason; @@ -1012,9 +1012,9 @@ namespace TL gigagroup = 0x4000000, /// Whether this channel or group is protected, thus does not allow forwarding messages from it noforwards = 0x8000000, - /// Whether a user needs to join the supergroup before they can send messages: can be false only for discussion groups », toggle using channels.toggleJoinToSend + /// Whether a user needs to join the supergroup before they can send messages: can be false only for discussion groups », toggle using Channels_ToggleJoinToSend join_to_send = 0x10000000, - /// Whether a user's join request will have to be approved by administrators, toggle using channels.toggleJoinToSend + /// Whether a user's join request will have to be approved by administrators, toggle using Channels_ToggleJoinRequest join_request = 0x20000000, forum = 0x40000000, } @@ -1084,7 +1084,7 @@ namespace TL public virtual InputGroupCall Call { get; } /// Time-To-Live of messages sent by the current user to this chat public virtual int TtlPeriod { get; } - /// When using phone.getGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. + /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. public virtual Peer GroupcallDefaultJoinAs { get; } /// Emoji representing a specific chat theme public virtual string ThemeEmoticon { get; } @@ -1123,7 +1123,7 @@ namespace TL [IfFlag(12)] public InputGroupCall call; /// Time-To-Live of messages sent by the current user to this chat [IfFlag(14)] public int ttl_period; - /// When using phone.getGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. + /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. [IfFlag(15)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(16)] public string theme_emoticon; @@ -1184,7 +1184,7 @@ namespace TL public override InputGroupCall Call => call; /// Time-To-Live of messages sent by the current user to this chat public override int TtlPeriod => ttl_period; - /// When using phone.getGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. + /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; @@ -1261,7 +1261,7 @@ namespace TL [IfFlag(24)] public int ttl_period; /// A list of suggested actions for the supergroup admin, see here for more info ». [IfFlag(25)] public string[] pending_suggestions; - /// When using phone.getGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. + /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. [IfFlag(26)] public Peer groupcall_default_join_as; /// Emoji representing a specific chat theme [IfFlag(27)] public string theme_emoticon; @@ -1290,7 +1290,7 @@ namespace TL has_pinned_msg_id = 0x20, /// Can we set the channel's username? can_set_username = 0x40, - /// Can we associate a stickerpack to the supergroup? + /// Can we Channels_SetStickers a stickerpack to the supergroup? can_set_stickers = 0x80, /// Field has a value has_stickerset = 0x100, @@ -1367,7 +1367,7 @@ namespace TL public override InputGroupCall Call => call; /// Time-To-Live of messages in this channel or supergroup public override int TtlPeriod => ttl_period; - /// When using phone.getGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. + /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. public override Peer GroupcallDefaultJoinAs => groupcall_default_join_as; /// Emoji representing a specific chat theme public override string ThemeEmoticon => theme_emoticon; @@ -1555,7 +1555,7 @@ namespace TL [IfFlag(15)] public DateTime edit_date; /// Name of the author of this message for channel posts (with signatures enabled) [IfFlag(16)] public string post_author; - /// Multiple media messages sent using messages.sendMultiMedia with the same grouped ID indicate an album or media group + /// Multiple media messages sent using Messages_SendMultiMedia with the same grouped ID indicate an album or media group [IfFlag(17)] public long grouped_id; /// Reactions to this message [IfFlag(20)] public MessageReactions reactions; @@ -2446,9 +2446,9 @@ namespace TL public Flags flags; /// Phone code type public Auth_SentCodeType type; - /// Phone code hash, to be stored and later re-used with auth.signIn + /// Phone code hash, to be stored and later re-used with Auth_SignIn public string phone_code_hash; - /// Phone code type that will be sent next, if the phone code is not received within timeout seconds: to send it use auth.resendCode + /// Phone code type that will be sent next, if the phone code is not received within timeout seconds: to send it use Auth_ResendCode [IfFlag(1)] public Auth_CodeType next_type; /// Timeout for reception of the phone code [IfFlag(2)] public int timeout; @@ -2630,7 +2630,7 @@ namespace TL report_geo = 0x20, /// Field has a value has_geo_distance = 0x40, - /// Whether this peer was automatically archived according to and can be unarchived + /// Whether this peer was automatically archived according to privacy settings and can be unarchived autoarchived = 0x80, /// If set, this is a recently created group chat to which new members can be invited invite_members = 0x100, @@ -2972,7 +2972,7 @@ namespace TL public Flags flags; /// Total number of messages in the list public int count; - /// Rate to use in the offset_rate parameter in the next call to messages.searchGlobal + /// Rate to use in the offset_rate parameter in the next call to Messages_SearchGlobal [IfFlag(0)] public int next_rate; /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}.
[IfFlag(2)] public int offset_id_offset; @@ -3135,7 +3135,7 @@ namespace TL /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } - /// New message in a private chat or in a basic group. See + /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] public class UpdateNewMessage : Update { @@ -3508,7 +3508,7 @@ namespace TL emojis = 0x2, } } - /// The saved gif list has changed, the client should refetch it using messages.getSavedGifs See + /// The saved gif list has changed, the client should refetch it using Messages_GetSavedGifs See [TLDef(0x9375341E)] public class UpdateSavedGifs : Update { } /// An incoming inline query See @@ -3538,7 +3538,7 @@ namespace TL has_peer_type = 0x2, } } - /// The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. See + /// The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. See [TLDef(0x12F12A07)] public class UpdateBotInlineSend : Update { @@ -3665,7 +3665,7 @@ namespace TL /// The recent sticker list was updated See [TLDef(0x9A422C20)] public class UpdateRecentStickers : Update { } - /// The server-side configuration has changed; the client should re-fetch the config using help.getConfig See + /// The server-side configuration has changed; the client should re-fetch the config using Help_GetConfig See [TLDef(0xA229DD06)] public class UpdateConfig : Update { } /// Common message box sequence PTS has changed, state has to be refetched using updates.getState See @@ -3783,7 +3783,7 @@ namespace TL /// Phone call public PhoneCallBase phone_call; } - /// A language pack has changed, the client should manually fetch the changed strings using langpack.getDifference See + /// A language pack has changed, the client should manually fetch the changed strings using Langpack_GetDifference See [TLDef(0x46560264)] public class UpdateLangPackTooLong : Update { @@ -3797,7 +3797,7 @@ namespace TL /// Changed strings public LangPackDifference difference; } - /// The list of favorited stickers was changed, the client should call messages.getFavedStickers to refetch the new list See + /// The list of favorited stickers was changed, the client should call Messages_GetFavedStickers to refetch the new list See [TLDef(0xE511996D)] public class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See @@ -4294,10 +4294,10 @@ namespace TL has_top_msg_id = 0x1, } } - /// The list of installed attachment menu entries » has changed, use messages.getAttachMenuBots to fetch the updated list. See + /// The list of installed attachment menu entries » has changed, use Messages_GetAttachMenuBots to fetch the updated list. See [TLDef(0x17B7A20B)] public class UpdateAttachMenuBots : Update { } - /// Indicates to a bot that a webview was closed and an inline message was sent on behalf of the user using messages.sendWebViewResultMessage See + /// Indicates to a bot that a webview was closed and an inline message was sent on behalf of the user using Messages_SendWebViewResultMessage See [TLDef(0x1592B79D)] public class UpdateWebViewResultSent : Update { @@ -4313,10 +4313,10 @@ namespace TL /// New menu button public BotMenuButtonBase button; } - /// The list of saved notification sounds has changed, use account.getSavedRingtones to fetch the new list. See + /// The list of saved notification sounds has changed, use Account_GetSavedRingtones to fetch the new list. See [TLDef(0x74D8BE99)] public class UpdateSavedRingtones : Update { } - /// A pending voice message transcription » initiated with messages.transcribeAudio was updated. See + /// A pending voice message transcription » initiated with Messages_TranscribeAudio was updated. See [TLDef(0x0084CD5A)] public class UpdateTranscribedAudio : Update { @@ -4520,7 +4520,7 @@ namespace TL /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } - /// Too many updates, it is necessary to execute updates.getDifference. See + /// Too many updates, it is necessary to execute Updates_GetDifference. See [TLDef(0xE317AF7E)] public partial class UpdatesTooLong : UpdatesBase, IPeerResolver { @@ -4834,7 +4834,7 @@ namespace TL public Flags flags; /// Current date at the server public DateTime date; - /// Expiration date of this config: when it expires it'll have to be refetched using help.getConfig + /// Expiration date of this config: when it expires it'll have to be refetched using Help_GetConfig public DateTime expires; /// Whether we're connected to the test DCs public bool test_mode; @@ -4848,9 +4848,9 @@ namespace TL public int chat_size_max; /// Maximum member count for supergroups public int megagroup_size_max; - /// Maximum number of messages that can be forwarded at once using messages.forwardMessages. + /// Maximum number of messages that can be forwarded at once using Messages_ForwardMessages. public int forwarded_count_max; - /// The client should update its online status every N milliseconds + /// The client should Account_UpdateStatus every N milliseconds public int online_update_period_ms; /// Delay before offline status needs to be sent to the server public int offline_blur_timeout_ms; @@ -5214,7 +5214,7 @@ namespace TL /// File ID, value of id parameter from public override long ID => id; } - /// Assigns a new big encrypted file (over 10 MB in size), saved in parts using the method upload.saveBigFilePart. See + /// Assigns a new big encrypted file (over 10 MB in size), saved in parts using the method Upload_SaveBigFilePart. See [TLDef(0x2DC173C8)] public class InputEncryptedFileBigUploaded : InputEncryptedFileBase { @@ -6296,7 +6296,7 @@ namespace TL [IfFlag(4)] public int thumb_dc_id; /// Thumbnail version [IfFlag(4)] public int thumb_version; - /// Document ID of custom emoji thumbnail, fetch the document using messages.getCustomEmojiDocuments + /// Document ID of custom emoji thumbnail, fetch the document using Messages_GetCustomEmojiDocuments [IfFlag(8)] public long thumb_document_id; /// Number of stickers in pack public int count; @@ -6422,7 +6422,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Whether the user should verify his identity by entering his 2FA SRP parameters to the messages.getBotCallbackAnswer method. NOTE: telegram and the bot WILL NOT have access to the plaintext password, thanks to SRP. This button is mainly used by the official @botfather bot, for verifying the user's identity before transferring ownership of a bot to another user. + /// Whether the user should verify his identity by entering his 2FA SRP parameters to the Messages_GetBotCallbackAnswer method. NOTE: telegram and the bot WILL NOT have access to the plaintext password, thanks to SRP. This button is mainly used by the official @botfather bot, for verifying the user's identity before transferring ownership of a bot to another user. requires_password = 0x1, } @@ -6469,7 +6469,7 @@ namespace TL public class KeyboardButtonBuy : KeyboardButton { } - /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, messages.requestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call messages.acceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See + /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See [TLDef(0x10B78D29)] public class KeyboardButtonUrlAuth : KeyboardButtonBase { @@ -6481,7 +6481,7 @@ namespace TL [IfFlag(0)] public string fwd_text; /// An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.

NOTE: Services must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
public string url; - /// ID of the button to pass to messages.requestUrlAuth + /// ID of the button to pass to Messages_RequestUrlAuth public int button_id; [Flags] public enum Flags : uint @@ -6493,7 +6493,7 @@ namespace TL /// Button label public override string Text => text; } - /// Button to request a user to authorize via URL using Seamless Telegram Login. See + /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0xD02E7FD4)] public class InputKeyboardButtonUrlAuth : KeyboardButtonBase { @@ -6553,14 +6553,14 @@ namespace TL /// User ID public long user_id; } - /// Button to open a bot web app using messages.requestWebView, sending over user information after user confirmation. See + /// Button to open a bot web app using Messages_RequestWebView, sending over user information after user confirmation. See [TLDef(0x13767230, inheritBefore = true)] public class KeyboardButtonWebView : KeyboardButton { /// Web app url public string url; } - /// Button to open a bot web app using messages.requestSimpleWebView, without sending user information to the web app. See + /// Button to open a bot web app using Messages_RequestSimpleWebView, without sending user information to the web app. See [TLDef(0xA0C0505C)] public class KeyboardButtonSimpleWebView : KeyboardButtonWebView { @@ -6727,7 +6727,7 @@ namespace TL [TLDef(0xC8CF05F8, inheritBefore = true)] public class MessageEntityCustomEmoji : MessageEntity { - /// Document ID of the custom emoji, use messages.getCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. + /// Document ID of the custom emoji, use Messages_GetCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. public long document_id; } @@ -8172,7 +8172,7 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// Stickerset preview with all stickers of the stickerset included.
Currently used only for custom emoji stickersets, to avoid a further call to messages.getStickerSet. See
+ /// Stickerset preview with all stickers of the stickerset included.
Currently used only for
custom emoji stickersets, to avoid a further call to Messages_GetStickerSet. See
[TLDef(0x40D13C0E)] public class StickerSetFullCovered : StickerSetCoveredBase { @@ -8965,7 +8965,7 @@ namespace TL /// Map scale; 1-3 public int scale; } - /// Used to download an album cover for any music file using upload.getWebFile, see the webfile docs for more info ». See + /// Used to download an album cover for any music file using Upload_GetWebFile, see the webfile docs for more info ». See [TLDef(0xF46FE924)] public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase { @@ -9470,9 +9470,9 @@ namespace TL has_reason = 0x1, /// Field has a value has_duration = 0x2, - /// Whether the server required the user to rate the call + /// Whether the server required the user to Phone_SetCallRating the call need_rating = 0x4, - /// Whether the server required the client to send the libtgvoip call debug data + /// Whether the server required the client to Phone_SaveCallDebug the libtgvoip call debug data need_debug = 0x8, /// Whether the call was a video call video = 0x40, @@ -9573,7 +9573,7 @@ namespace TL public int min_layer; /// Maximum layer for remote libtgvoip public int max_layer; - /// When using phone.requestCall and phone.acceptCall, specify all library versions supported by the client.
The server will merge and choose the best library version supported by both peers, returning only the best value in the result of the callee's phone.acceptCall and in the update received by the caller.
+ /// When using Phone_RequestCall and Phone_AcceptCall, specify all library versions supported by the client.
The server will merge and choose the best library version supported by both peers, returning only the best value in the result of the callee's Phone_AcceptCall and in the update received by the caller.
public string[] library_versions; [Flags] public enum Flags : uint @@ -9862,7 +9862,7 @@ namespace TL /// New stickerset public InputStickerSet new_stickerset; } - /// The hidden prehistory setting was changed See + /// The hidden prehistory setting was Channels_TogglePreHistoryHidden See [TLDef(0x5F5C95F1)] public class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction { @@ -9903,7 +9903,7 @@ namespace TL /// New location public ChannelLocation new_value; } - /// Slow mode setting for supergroups was changed See + /// Channels_ToggleSlowMode See [TLDef(0x53909779)] public class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction { @@ -10115,33 +10115,33 @@ namespace TL [Flags] public enum Flags : uint { - /// + /// Join events join = 0x1, - /// + /// Leave events leave = 0x2, - /// + /// Invite events invite = 0x4, - /// + /// Ban events ban = 0x8, - /// + /// Unban events unban = 0x10, - /// + /// Kick events kick = 0x20, - /// + /// Unkick events unkick = 0x40, - /// + /// Admin promotion events promote = 0x80, - /// + /// Admin demotion events demote = 0x100, - /// Info change events (when , , , , , or data of a channel gets modified) + /// Info change events (when about, linked chat, location, photo, stickerset, title or username data of a channel gets modified) info = 0x200, - /// Settings change events (, , , ) + /// Settings change events (invites, hidden prehistory, signatures, default banned rights) settings = 0x400, - /// + /// Message pin events pinned = 0x800, - /// + /// Message edit events edit = 0x1000, - /// + /// Message deletion events delete = 0x2000, /// Group call events group_call = 0x4000, @@ -10228,7 +10228,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// A single media in an album or grouped media sent with messages.sendMultiMedia. See + /// A single media in an album or grouped media sent with Messages_SendMultiMedia. See [TLDef(0x1CC6E91F)] public class InputSingleMedia : IObject { @@ -10386,14 +10386,14 @@ namespace TL [TLDef(0xE3309F7F)] public class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase { - /// New TOS updates will have to be queried using help.getTermsOfServiceUpdate in expires seconds + /// New TOS updates will have to be queried using Help_GetTermsOfServiceUpdate in expires seconds public DateTime expires; } - /// Info about an update of telegram's terms of service. If the terms of service are declined, then the account.deleteAccount method should be called with the reason "Decline ToS update" See + /// Info about an update of telegram's terms of service. If the terms of service are declined, then the Account_DeleteAccount method should be called with the reason "Decline ToS update" See [TLDef(0x28ECF961)] public class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase { - /// New TOS updates will have to be queried using help.getTermsOfServiceUpdate in expires seconds + /// New TOS updates will have to be queried using Help_GetTermsOfServiceUpdate in expires seconds public DateTime expires; /// New terms of service public Help_TermsOfService terms_of_service; @@ -11143,7 +11143,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Indicates that not full page preview is available to the client and it will need to fetch full Instant View from the server using messages.getWebPagePreview. + /// Indicates that not full page preview is available to the client and it will need to fetch full Instant View from the server using Messages_GetWebPagePreview. part = 0x1, /// Whether the page contains RTL text rtl = 0x2, @@ -11183,7 +11183,7 @@ namespace TL { /// Textual representation of the answer public string text; - /// The param that has to be passed to messages.sendVote. + /// The param that has to be passed to Messages_SendVote. public byte[] option; } @@ -11197,7 +11197,7 @@ namespace TL public Flags flags; /// The question of the poll public string question; - /// The possible answers, vote using messages.sendVote. + /// The possible answers, vote using Messages_SendVote. public PollAnswer[] answers; /// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. [IfFlag(4)] public int close_period; @@ -11227,7 +11227,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// The param that has to be passed to messages.sendVote. + /// The param that has to be passed to Messages_SendVote. public byte[] option; /// How many users voted for this option public int voters; @@ -11260,7 +11260,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Similar to min objects, used for poll constructors that are the same for all users so they don't have the option chosen by the current user (you can use messages.getPollResults to get the full poll results). + /// Similar to min objects, used for poll constructors that are the same for all users so they don't have the option chosen by the current user (you can use Messages_GetPollResults to get the full poll results). min = 0x1, /// Field has a value has_results = 0x2, @@ -11381,7 +11381,7 @@ namespace TL /// Unique wallpaper ID public string slug; } - /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using account.saveWallPaper, specifying just the wallpaper ID. See + /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using Account_SaveWallPaper, specifying just the wallpaper ID. See [TLDef(0x967A462E)] public class InputWallPaperNoFile : InputWallPaperBase { @@ -11591,7 +11591,7 @@ namespace TL public int folder_id; } - /// Indicates how many results would be found by a messages.search call with the same parameters See + /// Indicates how many results would be found by a Messages_Search call with the same parameters See [TLDef(0xE844EBFF)] public class Messages_SearchCounter : IObject { @@ -11618,7 +11618,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Username of a bot, which will be used for user authorization. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. + /// Username of a bot, which will be used for user authorization. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. public UserBase bot; /// The domain name of the website on which the user will log in. public string domain; @@ -11850,7 +11850,7 @@ namespace TL [IfFlag(3)] public int outbox_accent_color; /// The fill to be used as a background for outgoing messages, in RGB24 format.
If just one or two equal colors are provided, describes a solid fill of a background.
If two different colors are provided, describes the top and bottom colors of a 0-degree gradient.
If three or four colors are provided, describes a freeform gradient fill of a background.
[IfFlag(0)] public int[] message_colors; - /// or when passing wallpaper files for image or pattern wallpapers, with id=0 otherwise. + /// or inputWallPaperSlug when passing wallpaper files for image or pattern wallpapers, with id=0 otherwise. [IfFlag(1)] public InputWallPaperBase wallpaper; /// Wallpaper settings. [IfFlag(1)] public WallPaperSettings wallpaper_settings; @@ -11944,7 +11944,7 @@ namespace TL /// When did the user cast the vote public override DateTime Date => date; } - /// How a user voted in a poll (reduced constructor, returned if an option was provided to messages.getPollVotes) See + /// How a user voted in a poll (reduced constructor, returned if an option was provided to Messages_GetPollVotes) See [TLDef(0x3CA5B0EC)] public class MessageUserVoteInputOption : MessageUserVoteBase { @@ -11981,13 +11981,13 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Total number of votes for all options (or only for the chosen option, if provided to messages.getPollVotes) + /// Total number of votes for all options (or only for the chosen option, if provided to Messages_GetPollVotes) public int count; /// Vote info for each user public MessageUserVoteBase[] votes; /// Info about users that voted in the poll public Dictionary users; - /// Offset to use with the next messages.getPollVotes request, empty string if no more results are available. + /// Offset to use with the next Messages_GetPollVotes request, empty string if no more results are available. [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint @@ -12102,7 +12102,7 @@ namespace TL /// Channel statistics graph See Derived classes: , , public abstract class StatsGraphBase : IObject { } - /// This channel statistics graph must be generated asynchronously using stats.loadAsyncGraph to reduce server load See + /// This channel statistics graph must be generated asynchronously using Stats_LoadAsyncGraph to reduce server load See [TLDef(0x4A27EB2D)] public class StatsGraphAsync : StatsGraphBase { @@ -12597,7 +12597,7 @@ namespace TL { /// Whether the user should be muted upon joining the call join_muted = 0x2, - /// Whether the current user can change the value of the join_muted flag using phone.toggleGroupCallSettings + /// Whether the current user can change the value of the join_muted flag using Phone_ToggleGroupCallSettings can_change_join_muted = 0x4, /// Field has a value has_title = 0x8, @@ -12619,7 +12619,7 @@ namespace TL record_video_active = 0x800, /// Whether RTMP streams are allowed rtmp_stream = 0x1000, - /// Whether the listeners list is hidden and cannot be fetched using phone.getGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. + /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, } @@ -12676,7 +12676,7 @@ namespace TL has_active_date = 0x8, /// Whether the participant has just joined just_joined = 0x10, - /// If set, and .version < locally stored call.version, info about this participant should be ignored. If (...), and .version > call.version+1, the participant list should be refetched using phone.getGroupParticipants. + /// If set, and .version < locally stored call.version, info about this participant should be ignored. If (...), and .version > call.version+1, the participant list should be refetched using Phone_GetGroupParticipants. versioned = 0x20, /// Field has a value has_video = 0x40, @@ -12709,7 +12709,7 @@ namespace TL public GroupCallBase call; /// A partial list of participants. public GroupCallParticipant[] participants; - /// Next offset to use when fetching the remaining participants using phone.getGroupParticipants + /// Next offset to use when fetching the remaining participants using Phone_GetGroupParticipants public string participants_next_offset; /// Chats mentioned in the participants vector public Dictionary chats; @@ -12727,7 +12727,7 @@ namespace TL public int count; /// List of participants public GroupCallParticipant[] participants; - /// If not empty, the specified list of participants is partial, and more participants can be fetched specifying this parameter as offset in phone.getGroupParticipants. + /// If not empty, the specified list of participants is partial, and more participants can be fetched specifying this parameter as offset in Phone_GetGroupParticipants. public string next_offset; /// Mentioned chats public Dictionary chats; @@ -12977,7 +12977,7 @@ namespace TL public string short_name; } - /// Represents a scope where the bot commands, specified using bots.setBotCommands will be valid. See Derived classes: , , , , , + /// Represents a scope where the bot commands, specified using Bots_SetBotCommands will be valid. See Derived classes: , , , , , /// a value means botCommandScopeDefault public abstract class BotCommandScope : IObject { } /// The specified bot commands will only be valid in all private chats with users. See @@ -13007,7 +13007,7 @@ namespace TL public InputUserBase user_id; } - /// Result of an account.resetPassword request. See Derived classes: , , + /// Result of an Account_ResetPassword request. See Derived classes: , , public abstract class Account_ResetPasswordResult : IObject { } /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset. See [TLDef(0xE3779861)] @@ -13027,7 +13027,7 @@ namespace TL [TLDef(0xE926D63E)] public class Account_ResetPasswordOk : Account_ResetPasswordResult { } - /// A sponsored message. See + /// A sponsored message. See [TLDef(0x3A836DF8)] public class SponsoredMessage : IObject { @@ -13254,11 +13254,11 @@ namespace TL [Flags] public enum Flags : uint { - /// Similar to min objects, used for message reaction » constructors that are the same for all users so they don't have the reactions sent by the current user (you can use messages.getMessagesReactions to get the full reaction info). + /// Similar to min objects, used for message reaction » constructors that are the same for all users so they don't have the reactions sent by the current user (you can use Messages_GetMessagesReactions to get the full reaction info). min = 0x1, /// Field has a value has_recent_reactions = 0x2, - /// Whether messages.getMessageReactionsList can be used to see how each specific peer reacted to the message + /// Whether Messages_GetMessageReactionsList can be used to see how each specific peer reacted to the message can_see_list = 0x4, } } @@ -13277,7 +13277,7 @@ namespace TL public Dictionary chats; /// Mentioned users public Dictionary users; - /// If set, indicates the next offset to use to load more results by invoking messages.getMessageReactionsList. + /// If set, indicates the next offset to use to load more results by invoking Messages_GetMessageReactionsList. [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint @@ -13446,7 +13446,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using messages.toggleBotInAttachMenu) + /// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using Messages_ToggleBotInAttachMenu) inactive = 0x1, /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, @@ -13560,7 +13560,7 @@ namespace TL [TLDef(0xFF6C8049)] public class NotificationSoundRingtone : NotificationSound { - /// Document ID of notification sound uploaded using account.uploadRingtone + /// Document ID of notification sound uploaded using Account_UploadRingtone public long id; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 66f7c00..dd0ed40 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -124,7 +124,7 @@ namespace TL /// Signs in a user with a validated phone number. See Possible codes: 400,406,500 (details) /// Phone number in the international format - /// SMS-message ID, obtained from auth.sendCode + /// SMS-message ID, obtained from Auth_SendCode /// Valid numerical code from the SMS-message /// Email verification code or token [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] @@ -209,7 +209,7 @@ namespace TL { }); - /// Reset the 2FA password using the recovery code sent using auth.requestPasswordRecovery. See Possible codes: 400 (details) + /// Reset the 2FA password using the recovery code sent using Auth_RequestPasswordRecovery. See Possible codes: 400 (details) /// Code received via email /// New password public static Task Auth_RecoverPassword(this Client client, string code, Account_PasswordInputSettings new_settings = null) @@ -222,7 +222,7 @@ namespace TL /// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See Possible codes: 400,406 (details) /// The phone number - /// The phone code hash obtained from auth.sendCode + /// The phone code hash obtained from Auth_SendCode [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResendCode @@ -233,7 +233,7 @@ namespace TL /// Cancel the login verification code See Possible codes: 400,406 (details) /// Phone number - /// Phone code hash from auth.sendCode + /// Phone code hash from Auth_SendCode [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_CancelCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_CancelCode @@ -278,7 +278,7 @@ namespace TL token = token, }); - /// Check if the 2FA recovery code sent using auth.requestPasswordRecovery is valid, before passing it to auth.recoverPassword. See Possible codes: 400 (details) + /// Check if the 2FA recovery code sent using Auth_RequestPasswordRecovery is valid, before passing it to Auth_RecoverPassword. See Possible codes: 400 (details) /// Code received via email public static Task Auth_CheckRecoveryPassword(this Client client, string code) => client.Invoke(new Auth_CheckRecoveryPassword @@ -462,8 +462,8 @@ namespace TL /// Change the phone number of the current account See Possible codes: 400,406 (details) /// New phone number - /// Phone code hash received when calling account.sendChangePhoneCode - /// Phone code received when calling account.sendChangePhoneCode + /// Phone code hash received when calling Account_SendChangePhoneCode + /// Phone code received when calling Account_SendChangePhoneCode public static Task Account_ChangePhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.Invoke(new Account_ChangePhone { @@ -555,7 +555,7 @@ namespace TL }); /// Log out an active web telegram login session See Possible codes: 400 (details) - /// hash + /// Session hash public static Task Account_ResetWebAuthorization(this Client client, long hash) => client.Invoke(new Account_ResetWebAuthorization { @@ -640,8 +640,8 @@ namespace TL /// Verify a phone number for telegram passport. See Possible codes: 400 (details) /// Phone number - /// Phone code hash received from the call to account.sendVerifyPhoneCode - /// Code received after the call to account.sendVerifyPhoneCode + /// Phone code hash received from the call to Account_SendVerifyPhoneCode + /// Code received after the call to Account_SendVerifyPhoneCode public static Task Account_VerifyPhone(this Client client, string phone_number, string phone_code_hash, string phone_code) => client.Invoke(new Account_VerifyPhone { @@ -976,7 +976,7 @@ namespace TL }); /// Change authorization settings See Possible codes: 400 (details) - /// Session ID from the , fetchable using account.getAuthorizations + /// Session ID from the , fetchable using Account_GetAuthorizations /// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed /// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) @@ -998,7 +998,7 @@ namespace TL }); /// Save or remove saved notification sound. See - /// Notification sound uploaded using account.uploadRingtone + /// Notification sound uploaded using Account_UploadRingtone /// Whether to add or delete the notification sound public static Task Account_SaveRingtone(this Client client, InputDocument id, bool unsave) => client.Invoke(new Account_SaveRingtone @@ -1007,7 +1007,7 @@ namespace TL unsave = unsave, }); - /// Upload notification sound, use account.saveRingtone to convert it and add it to the list of saved notification sounds. See + /// Upload notification sound, use Account_SaveRingtone to convert it and add it to the list of saved notification sounds. See /// Notification sound /// File name /// MIME type of file @@ -1910,7 +1910,7 @@ namespace TL /// Global search filter /// If a positive value was specified, the method will return only messages with date bigger than min_date /// If a positive value was transferred, the method will return only messages with date smaller than max_date - /// Initially 0, then set to the + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -2007,7 +2007,7 @@ namespace TL switch_pm = switch_pm, }); - /// Send a result obtained using messages.getInlineBotResults. See Possible codes: 400,403,420,500 (details) + /// Send a result obtained using Messages_GetInlineBotResults. See Possible codes: 400,403,420,500 (details) /// Whether to send the message silently (no notification will be triggered on the other client) /// Whether to send the message in background /// Whether to clear the draft @@ -2015,8 +2015,8 @@ namespace TL /// Destination /// ID of the message this message should reply to /// Random ID to avoid resending the same query - /// Query ID from messages.getInlineBotResults - /// Result ID from messages.getInlineBotResults + /// Query ID from Messages_GetInlineBotResults + /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) @@ -2088,7 +2088,7 @@ namespace TL /// Where was the inline keyboard sent /// ID of the Message with the inline keyboard /// Callback data - /// For buttons , the SRP payload generated using SRP. + /// For buttons requiring you to verify your identity with your 2FA password, the SRP payload generated using SRP. public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, bool game = false, byte[] data = null, InputCheckPasswordSRP password = null) => client.Invoke(new Messages_GetBotCallbackAnswer { @@ -2454,7 +2454,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat /// The message to reply to - /// The medias to send: note that they must be separately uploaded using messages.uploadMedia first, using raw inputMediaUploaded* constructors is not supported. + /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) @@ -2619,7 +2619,7 @@ namespace TL lang_code = lang_code, }); - /// Get the number of results that would be found by a messages.search call with the same parameters See Possible codes: 400 (details) + /// Get the number of results that would be found by a Messages_Search call with the same parameters See Possible codes: 400 (details) /// Peer where to search /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) @@ -2664,7 +2664,7 @@ namespace TL url = url, }); - /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the . See + /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the peer's settings. See /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) => client.Invoke(new Messages_HidePeerSettingsBar @@ -2867,7 +2867,7 @@ namespace TL /// Import chat history from a foreign chat app into a specific Telegram chat, click here for more info about imported chats ». See Possible codes: 400,406 (details) /// The Telegram chat where the history should be imported. /// File with messages to import. - /// Number of media files associated with the chat that will be uploaded using messages.uploadImportedMedia. + /// Number of media files associated with the chat that will be uploaded using Messages_UploadImportedMedia. public static Task Messages_InitHistoryImport(this Client client, InputPeer peer, InputFileBase file, int media_count) => client.Invoke(new Messages_InitHistoryImport { @@ -2878,7 +2878,7 @@ namespace TL /// Upload a media file associated with an imported chat, click here for more info ». See /// The Telegram chat where the media will be imported - /// Identifier of a history import session, returned by messages.initHistoryImport + /// Identifier of a history import session, returned by Messages_InitHistoryImport /// File name /// Media metadata /// a null value means messageMediaEmpty @@ -2891,9 +2891,9 @@ namespace TL media = media, }); - /// Complete the history import process, importing all messages into the chat.
To be called only after initializing the import with messages.initHistoryImport and uploading all files using messages.uploadImportedMedia. See Possible codes: 400 (details)
+ /// Complete the history import process, importing all messages into the chat.
To be called only after initializing the import with Messages_InitHistoryImport and uploading all files using Messages_UploadImportedMedia. See Possible codes: 400 (details)
/// The Telegram chat where the messages should be imported, click here for more info » - /// Identifier of a history import session, returned by messages.initHistoryImport. + /// Identifier of a history import session, returned by Messages_InitHistoryImport. public static Task Messages_StartHistoryImport(this Client client, InputPeer peer, long import_id) => client.Invoke(new Messages_StartHistoryImport { @@ -3017,7 +3017,7 @@ namespace TL /// Change the chat theme of a certain chat See Possible codes: 400 (details) /// Private chat where to change theme - /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using account.getChatThemes + /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using Account_GetChatThemes public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) => client.Invoke(new Messages_SetChatTheme { @@ -3168,7 +3168,7 @@ namespace TL hash = hash, }); - /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using help.getConfig, reactions_default field. See Possible codes: 400 (details) + /// Change default emoji reaction to use in the quick reaction menu: the value is synced across devices and can be fetched using Help_GetConfig. See Possible codes: 400 (details) /// New emoji reaction public static Task Messages_SetDefaultReaction(this Client client, Reaction reaction) => client.Invoke(new Messages_SetDefaultReaction @@ -3264,14 +3264,14 @@ namespace TL /// Open a bot web app, sending over user information after user confirmation. See /// Whether the webview was opened by clicking on the bot's menu button ». - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent silently (no notifications for the receivers). + /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). /// Bot that owns the web app /// Web app URL /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. + /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, 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, int? top_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_RequestWebView @@ -3289,11 +3289,11 @@ namespace TL }); /// Indicate to the server (from the user side) that the user is still using a web app. See - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent silently (no notifications for the receivers). + /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app was opened. /// Bot that owns the web app - /// Web app interaction ID obtained from messages.requestWebView - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is terminated should be sent in reply to this message ID. + /// Web app interaction ID obtained from Messages_RequestWebView + /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. /// Open the web app as the specified peer public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null) => client.Invoke(new Messages_ProlongWebView @@ -3322,8 +3322,8 @@ namespace TL platform = platform, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with messages.requestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
- /// Webview interaction ID obtained from messages.requestWebView + /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// Webview interaction ID obtained from Messages_RequestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) => client.Invoke(new Messages_SendWebViewResultMessage @@ -3502,7 +3502,7 @@ namespace TL }); /// Updates current user profile photo. See Possible codes: 400 (details) - /// File saved in parts by means of upload.saveFilePart method + /// File saved in parts by means of Upload_SaveFilePart method /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) @@ -3785,7 +3785,7 @@ namespace TL }); /// Dismiss a suggestion, see here for more info ». See - /// In the case of pending suggestions in , the channel ID. + /// In the case of pending suggestions in channels, the channel ID. /// Suggestion, see here for more info ». public static Task Help_DismissSuggestion(this Client client, InputPeer peer, string suggestion) => client.Invoke(new Help_DismissSuggestion @@ -3899,7 +3899,7 @@ namespace TL /// Create a supergroup/channel. See Possible codes: 400,406 (details) /// Whether to create a channel /// Whether to create a supergroup - /// Whether the supergroup is being created to import messages from a foreign chat service using messages.initHistoryImport + /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport /// Channel title /// Channel description /// Geogroup location @@ -4026,9 +4026,9 @@ namespace TL enabled = enabled, }); - /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) + /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) /// Get geogroups - /// If set and the user has reached the limit of owned public channels/supergroups/geogroups, instead of returning the channel list one of the specified errors will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in channels.checkUsername/channels.updateUsername. + /// If set and the user has reached the limit of owned public channels/supergroups/geogroups, instead of returning the channel list one of the specified errors will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in Channels_CheckUsername/Channels_UpdateUsername. public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) => client.Invoke(new Channels_GetAdminedPublicChannels { @@ -4422,7 +4422,7 @@ namespace TL button = button, }); - /// Gets the menu button action for a given user or for all users, previously set using bots.setBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details) + /// Gets the menu button action for a given user or for all users, previously set using Bots_SetBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details) /// User ID or empty for the default menu button. /// a null value means botMenuButtonDefault public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) @@ -4483,7 +4483,7 @@ namespace TL /// Send compiled payment form See Possible codes: 400 (details) /// Form ID /// Invoice - /// ID of saved and validated + /// ID of saved and validated order info /// 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). @@ -4974,7 +4974,7 @@ namespace TL call = call, }); - /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with phone.createGroupCall (the rtmp_stream flag must be set). See Possible codes: 400 (details) + /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with Phone_CreateGroupCall (the rtmp_stream flag must be set). See Possible codes: 400 (details) /// Peer to livestream into /// Whether to revoke the previous stream key or simply return the existing one public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke) @@ -5093,7 +5093,7 @@ namespace TL channel = channel, }); - /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of with peer_id equal to the public channel to which this message was forwarded. See Possible codes: 400 (details)
+ /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of messages with peer_id equal to the public channel to which this message was forwarded. See Possible codes: 400 (details)
/// Source channel /// Source message ID /// Initially 0, then set to the next_rate parameter of From e7ec282ac10afe4769b2af2d383efdf201af1348 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 12 Dec 2022 10:07:31 +0100 Subject: [PATCH 029/336] Signal wrong use of some params[] methods --- src/Encryption.cs | 4 +--- src/TL.Extensions.cs | 6 ++++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/src/Encryption.cs b/src/Encryption.cs index a3a3eaf..03b72c0 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -388,14 +388,12 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB internal static async Task Check2FA(Account_Password accountPassword, Func> getPassword) { - bool newPassword = false; if (accountPassword.current_algo is not PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow algo) if (accountPassword.current_algo == null && (algo = accountPassword.new_algo as PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow) != null) { int salt1len = algo.salt1.Length; Array.Resize(ref algo.salt1, salt1len + 32); RNG.GetBytes(algo.salt1, salt1len, 32); - newPassword = true; } else throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); @@ -431,7 +429,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var x = BigEndianInteger(sha256.Hash); var v = BigInteger.ModPow(g, x, p); - if (newPassword) + if (accountPassword.current_algo == null) // we're computing a new password { await validTask; return new InputCheckPasswordSRP { A = v.To256Bytes() }; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 2c6f5b8..be79d66 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -2,6 +2,7 @@ using System.Collections.Generic; using System.Linq; using System.Text; +using System.Threading.Tasks; using System.Web; namespace TL @@ -34,6 +35,11 @@ namespace TL /// The structure having a users public static void CollectUsersChats(this IPeerResolver structure, Dictionary users, Dictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + + public static Task Messages_GetChats(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Channels_GetChannels(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Users_GetUsers(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllDialogs"); + public static Task Messages_GetMessages(this WTelegram.Client _) => throw new ApplicationException("If you want to get the messages from a chat, use Messages_GetHistory"); } public static class Markdown From 389f110cfb13e5cc254135d17ba11dcf5577ffec Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 19 Dec 2022 14:14:17 +0100 Subject: [PATCH 030/336] Helper simplified method for Channels_GetAdminLog --- src/Client.Helpers.cs | 23 +++++++++++++++++++++++ src/TL.Helpers.cs | 5 +++++ src/TL.Schema.cs | 2 +- 3 files changed, 29 insertions(+), 1 deletion(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index f9adc37..115f05a 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -579,6 +579,29 @@ namespace WTelegram } } + /// Helper simplified method: Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) + /// Channel + /// Search query, can be empty + /// Event filter + /// Only show events from this admin + public async Task Channels_GetAdminLog(InputChannelBase channel, ChannelAdminLogEventsFilter.Flags events_filter = 0, string q = null, InputUserBase admin = null) + { + var admins = admin == null ? null : new[] { admin }; + var result = await this.Channels_GetAdminLog(channel, q, events_filter: events_filter, admins: admins); + if (result.events.Length < 100) return result; + var resultFull = result; + List events = new(result.events); + do + { + result = await this.Channels_GetAdminLog(channel, q, max_id: result.events[^1].id, events_filter: events_filter, admins: admins); + events.AddRange(result.events); + foreach (var kvp in result.chats) resultFull.chats[kvp.Key] = kvp.Value; + foreach (var kvp in result.users) resultFull.users[kvp.Key] = kvp.Value; + } while (result.events.Length >= 100); + resultFull.events = events.ToArray(); + return resultFull; + } + private const string OnlyChatChannel = "This method works on Chat & Channel only"; /// Generic helper: Adds a single user to a Chat or Channel See
and
Possible codes: 400,403
/// Chat/Channel diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 21adbde..625fdae 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -562,6 +562,11 @@ namespace TL partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class ChannelAdminLogEventsFilter + { + public static implicit operator ChannelAdminLogEventsFilter(Flags flags) => new() { flags = flags }; + } + partial class InputMessage { public static implicit operator InputMessage(int id) => new InputMessageID { id = id }; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 72c0a58..f747ec7 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -10108,7 +10108,7 @@ namespace TL /// Filter only certain admin log events See [TLDef(0xEA107AE4)] - public class ChannelAdminLogEventsFilter : IObject + public partial class ChannelAdminLogEventsFilter : IObject { /// Flags, see TL conditional fields public Flags flags; From 7fa4051e99148196574275b746473f5f9d16acac Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 29 Dec 2022 22:28:58 +0100 Subject: [PATCH 031/336] Changed the ordering of optional parameters: Moved bool parameters to the end of parameter list --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/TL.SchemaFuncs.cs | 132 +++++++++++++++++++++--------------------- 3 files changed, 68 insertions(+), 68 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index da0ac65..3b5849b 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.1.6-dev.$(Rev:r) +name: 3.2.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 180eb0e..8d4f504 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.1.$(Rev:r) +name: 3.2.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index dd0ed40..9fab31b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -678,10 +678,10 @@ 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, long? file_max_size = null) + public static Task Account_InitTakeoutSession(this Client client, long? file_max_size = null, bool contacts = false, bool message_users = false, bool message_chats = false, bool message_megagroups = false, bool message_channels = false, bool files = false) => 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)), + flags = (Account_InitTakeoutSession.Flags)((file_max_size != null ? 0x20 : 0) | (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 = file_max_size.GetValueOrDefault(), }); @@ -730,10 +730,10 @@ namespace TL /// Returns list of chats with non-default notification settings See /// If true, chats with non-default sound will also be returned /// If specified, only chats of the specified category will be returned - public static Task Account_GetNotifyExceptions(this Client client, bool compare_sound = false, InputNotifyPeerBase peer = null) + public static Task Account_GetNotifyExceptions(this Client client, InputNotifyPeerBase peer = null, bool compare_sound = false) => client.Invoke(new Account_GetNotifyExceptions { - flags = (Account_GetNotifyExceptions.Flags)((compare_sound ? 0x2 : 0) | (peer != null ? 0x1 : 0)), + flags = (Account_GetNotifyExceptions.Flags)((peer != null ? 0x1 : 0) | (compare_sound ? 0x2 : 0)), peer = peer, }); @@ -866,10 +866,10 @@ namespace TL /// Theme to install /// Theme format, a string that identifies the theming engines supported by the client /// Indicates a basic theme provided by all clients - public static Task Account_InstallTheme(this Client client, bool dark = false, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default) + public static Task Account_InstallTheme(this Client client, InputThemeBase theme = null, string format = null, BaseTheme base_theme = default, bool dark = false) => client.Invoke(new Account_InstallTheme { - flags = (Account_InstallTheme.Flags)((dark ? 0x1 : 0) | (theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0)), + flags = (Account_InstallTheme.Flags)((theme != null ? 0x2 : 0) | (format != null ? 0x4 : 0) | (base_theme != default ? 0x8 : 0) | (dark ? 0x1 : 0)), theme = theme, format = format, base_theme = base_theme, @@ -1263,10 +1263,10 @@ namespace TL /// While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown. /// Geolocation /// If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied. - public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, bool background = false, int? self_expires = null) + public static Task Contacts_GetLocated(this Client client, InputGeoPoint geo_point, int? self_expires = null, bool background = false) => client.Invoke(new Contacts_GetLocated { - flags = (Contacts_GetLocated.Flags)((background ? 0x2 : 0) | (self_expires != null ? 0x1 : 0)), + flags = (Contacts_GetLocated.Flags)((self_expires != null ? 0x1 : 0) | (background ? 0x2 : 0)), geo_point = geo_point, self_expires = self_expires.GetValueOrDefault(), }); @@ -1320,10 +1320,10 @@ namespace TL ///
Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here - public static Task Messages_GetDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false, int? folder_id = null) + public static Task Messages_GetDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, int? folder_id = null, bool exclude_pinned = false) => client.Invoke(new Messages_GetDialogs { - flags = (Messages_GetDialogs.Flags)((exclude_pinned ? 0x1 : 0) | (folder_id != null ? 0x2 : 0)), + flags = (Messages_GetDialogs.Flags)((folder_id != null ? 0x2 : 0) | (exclude_pinned ? 0x1 : 0)), folder_id = folder_id.GetValueOrDefault(), offset_date = offset_date, offset_id = offset_id, @@ -1404,10 +1404,10 @@ namespace TL /// Maximum ID of message to delete /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp - public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id = default, bool just_clear = false, bool revoke = false, DateTime? min_date = null, DateTime? max_date = null) + public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null, bool just_clear = false, bool revoke = false) => client.Invoke(new Messages_DeleteHistory { - flags = (Messages_DeleteHistory.Flags)((just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + flags = (Messages_DeleteHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0) | (just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0)), peer = peer, max_id = max_id, min_date = min_date.GetValueOrDefault(), @@ -1460,10 +1460,10 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -1490,10 +1490,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -1519,10 +1519,10 @@ namespace TL /// Destination peer /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1803,10 +1803,10 @@ namespace TL /// Expiration date /// Maximum number of users that can join using this link /// Description of the invite link, visible only to administrators - public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, bool legacy_revoke_permanent = false, bool request_needed = false, DateTime? expire_date = null, int? usage_limit = null, string title = null) + public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, DateTime? expire_date = null, int? usage_limit = null, string title = null, bool legacy_revoke_permanent = false, bool request_needed = false) => client.Invoke(new Messages_ExportChatInvite { - flags = (Messages_ExportChatInvite.Flags)((legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0)), + flags = (Messages_ExportChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0) | (legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0)), peer = peer, expire_date = expire_date.GetValueOrDefault(), usage_limit = usage_limit.GetValueOrDefault(), @@ -1996,10 +1996,10 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. /// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, bool gallery = false, bool private_ = false, string next_offset = null, InlineBotSwitchPM switch_pm = null) + public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { - flags = (Messages_SetInlineBotResults.Flags)((gallery ? 0x1 : 0) | (private_ ? 0x2 : 0) | (next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0)), + flags = (Messages_SetInlineBotResults.Flags)((next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0) | (gallery ? 0x1 : 0) | (private_ ? 0x2 : 0)), query_id = query_id, results = results, cache_time = cache_time, @@ -2019,10 +2019,10 @@ namespace TL /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -2052,10 +2052,10 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, bool no_webpage = false, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null) + public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, bool no_webpage = false) => client.Invoke(new Messages_EditMessage { - flags = (Messages_EditMessage.Flags)((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0)), + flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (no_webpage ? 0x2 : 0)), peer = peer, id = id, message = message, @@ -2072,10 +2072,10 @@ namespace TL /// Media /// Reply markup for inline keyboards /// Message entities for styled text - public static Task Messages_EditInlineBotMessage(this Client client, InputBotInlineMessageIDBase id, bool no_webpage = false, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null) + public static Task Messages_EditInlineBotMessage(this Client client, InputBotInlineMessageIDBase id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, bool no_webpage = false) => client.Invoke(new Messages_EditInlineBotMessage { - flags = (Messages_EditInlineBotMessage.Flags)((no_webpage ? 0x2 : 0) | (message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), + flags = (Messages_EditInlineBotMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (no_webpage ? 0x2 : 0)), id = id, message = message, media = media, @@ -2089,10 +2089,10 @@ namespace TL /// ID of the Message with the inline keyboard /// Callback data /// For buttons requiring you to verify your identity with your 2FA password, the SRP payload generated using SRP. - public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, bool game = false, byte[] data = null, InputCheckPasswordSRP password = null) + public static Task Messages_GetBotCallbackAnswer(this Client client, InputPeer peer, int msg_id, byte[] data = null, InputCheckPasswordSRP password = null, bool game = false) => client.Invoke(new Messages_GetBotCallbackAnswer { - flags = (Messages_GetBotCallbackAnswer.Flags)((game ? 0x2 : 0) | (data != null ? 0x1 : 0) | (password != null ? 0x4 : 0)), + flags = (Messages_GetBotCallbackAnswer.Flags)((data != null ? 0x1 : 0) | (password != null ? 0x4 : 0) | (game ? 0x2 : 0)), peer = peer, msg_id = msg_id, data = data, @@ -2105,10 +2105,10 @@ namespace TL /// Popup to show /// URL to open /// Cache validity - public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, bool alert = false, string message = null, string url = null) + public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, string message = null, string url = null, bool alert = false) => client.Invoke(new Messages_SetBotCallbackAnswer { - flags = (Messages_SetBotCallbackAnswer.Flags)((alert ? 0x2 : 0) | (message != null ? 0x1 : 0) | (url != null ? 0x4 : 0)), + flags = (Messages_SetBotCallbackAnswer.Flags)((message != null ? 0x1 : 0) | (url != null ? 0x4 : 0) | (alert ? 0x2 : 0)), query_id = query_id, message = message, url = url, @@ -2129,10 +2129,10 @@ namespace TL /// Destination of the message that should be sent /// The draft /// Message entities for styled text - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, bool no_webpage = false, int? reply_to_msg_id = null, int? top_msg_id = null, MessageEntity[] entities = null) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, int? reply_to_msg_id = null, int? top_msg_id = null, MessageEntity[] entities = null, bool no_webpage = false) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((no_webpage ? 0x2 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x4 : 0) | (entities != null ? 0x8 : 0)), + flags = (Messages_SaveDraft.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (no_webpage ? 0x2 : 0)), reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), peer = peer, @@ -2354,10 +2354,10 @@ namespace TL /// Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the error field, instead /// Unique identifier for the query to be answered /// Required if the success isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. - public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, bool success = false, string error = null) + public static Task Messages_SetBotPrecheckoutResults(this Client client, long query_id, string error = null, bool success = false) => client.Invoke(new Messages_SetBotPrecheckoutResults { - flags = (Messages_SetBotPrecheckoutResults.Flags)((success ? 0x2 : 0) | (error != null ? 0x1 : 0)), + flags = (Messages_SetBotPrecheckoutResults.Flags)((error != null ? 0x1 : 0) | (success ? 0x2 : 0)), query_id = query_id, error = error, }); @@ -2457,10 +2457,10 @@ namespace TL /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -2654,10 +2654,10 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_AcceptUrlAuth(this Client client, bool write_allowed = false, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) + public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false) => client.Invoke(new Messages_AcceptUrlAuth { - flags = (Messages_AcceptUrlAuth.Flags)((write_allowed ? 0x1 : 0) | (peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), + flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), peer = peer, msg_id = msg_id.GetValueOrDefault(), button_id = button_id.GetValueOrDefault(), @@ -2908,10 +2908,10 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id, int limit = int.MaxValue, bool revoked = false, DateTime? offset_date = null, string offset_link = null) + public static Task Messages_GetExportedChatInvites(this Client client, InputPeer peer, InputUserBase admin_id, int limit = int.MaxValue, DateTime? offset_date = null, string offset_link = null, bool revoked = false) => client.Invoke(new Messages_GetExportedChatInvites { - flags = (Messages_GetExportedChatInvites.Flags)((revoked ? 0x8 : 0) | (offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + flags = (Messages_GetExportedChatInvites.Flags)((offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0) | (revoked ? 0x8 : 0)), peer = peer, admin_id = admin_id, offset_date = offset_date.GetValueOrDefault(), @@ -2937,10 +2937,10 @@ namespace TL /// Maximum number of users that can join using this link /// Whether admin confirmation is required before admitting each separate user into the chat /// Description of the invite link, visible only to administrators - public static Task Messages_EditExportedChatInvite(this Client client, InputPeer peer, string link, bool revoked = false, DateTime? expire_date = null, int? usage_limit = null, bool? request_needed = default, string title = null) + public static Task Messages_EditExportedChatInvite(this Client client, InputPeer peer, string link, DateTime? expire_date = null, int? usage_limit = null, bool? request_needed = default, string title = null, bool revoked = false) => client.Invoke(new Messages_EditExportedChatInvite { - flags = (Messages_EditExportedChatInvite.Flags)((revoked ? 0x4 : 0) | (expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0)), + flags = (Messages_EditExportedChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0) | (revoked ? 0x4 : 0)), peer = peer, link = link, expire_date = expire_date.GetValueOrDefault(), @@ -2985,10 +2985,10 @@ namespace TL /// Offsets for pagination, for more info click here /// User ID for pagination /// Maximum number of results to return, see pagination - public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, bool requested = false, string link = null, string q = null) + public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false) => client.Invoke(new Messages_GetChatInviteImporters { - flags = (Messages_GetChatInviteImporters.Flags)((requested ? 0x1 : 0) | (link != null ? 0x2 : 0) | (q != null ? 0x4 : 0)), + flags = (Messages_GetChatInviteImporters.Flags)((link != null ? 0x2 : 0) | (q != null ? 0x4 : 0) | (requested ? 0x1 : 0)), peer = peer, link = link, q = q, @@ -3079,10 +3079,10 @@ namespace TL /// Whether to dismiss or approve all chat join requests » /// The chat or channel /// Only dismiss or approve join requests » initiated using this invite link - public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, bool approved = false, string link = null) + public static Task Messages_HideAllChatJoinRequests(this Client client, InputPeer peer, string link = null, bool approved = false) => client.Invoke(new Messages_HideAllChatJoinRequests { - flags = (Messages_HideAllChatJoinRequests.Flags)((approved ? 0x1 : 0) | (link != null ? 0x2 : 0)), + flags = (Messages_HideAllChatJoinRequests.Flags)((link != null ? 0x2 : 0) | (approved ? 0x1 : 0)), peer = peer, link = link, }); @@ -3113,10 +3113,10 @@ namespace TL /// Peer /// Message ID to react to /// Reaction (a UTF8 emoji) - public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, bool big = false, bool add_to_recent = false, Reaction[] reaction = null) + public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, Reaction[] reaction = null, bool big = false, bool add_to_recent = false) => client.Invoke(new Messages_SendReaction { - flags = (Messages_SendReaction.Flags)((big ? 0x2 : 0) | (add_to_recent ? 0x4 : 0) | (reaction != null ? 0x1 : 0)), + flags = (Messages_SendReaction.Flags)((reaction != null ? 0x1 : 0) | (big ? 0x2 : 0) | (add_to_recent ? 0x4 : 0)), peer = peer, msg_id = msg_id, reaction = reaction, @@ -3273,10 +3273,10 @@ namespace TL /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, 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, int? top_msg_id = null, InputPeer send_as = null) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => 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) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_RequestWebView.Flags)((url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), peer = peer, bot = bot, url = url, @@ -3295,10 +3295,10 @@ namespace TL /// Web app interaction ID obtained from Messages_RequestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. /// Open the web app as the specified peer - public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, bool silent = false, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView { - flags = (Messages_ProlongWebView.Flags)((silent ? 0x20 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0)), + flags = (Messages_ProlongWebView.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0)), peer = peer, bot = bot, query_id = query_id, @@ -3904,10 +3904,10 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - public static Task Channels_CreateChannel(this Client client, string title, string about, bool broadcast = false, bool megagroup = false, bool for_import = false, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null) + public static Task Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false) => client.Invoke(new Channels_CreateChannel { - flags = (Channels_CreateChannel.Flags)((broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0)), + flags = (Channels_CreateChannel.Flags)((geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0) | (broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0)), title = title, about = about, geo_point = geo_point, @@ -4569,10 +4569,10 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers /// a null value means messages.stickerSetNotModified - public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, bool masks = false, bool animated = false, bool videos = false, InputDocument thumb = null, string software = null) + public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, InputDocument thumb = null, string software = null, bool masks = false, bool animated = false, bool videos = false) => client.Invoke(new Stickers_CreateStickerSet { - flags = (Stickers_CreateStickerSet.Flags)((masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0) | (thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0)), + flags = (Stickers_CreateStickerSet.Flags)((thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0) | (masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0)), user_id = user_id, title = title, short_name = short_name, @@ -4751,10 +4751,10 @@ namespace TL /// Unique client message ID required to prevent creation of duplicate group calls /// Call title /// For scheduled group call or livestreams, the absolute date when the group call will start - public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, bool rtmp_stream = false, string title = null, DateTime? schedule_date = null) + public static Task Phone_CreateGroupCall(this Client client, InputPeer peer, int random_id, string title = null, DateTime? schedule_date = null, bool rtmp_stream = false) => client.Invoke(new Phone_CreateGroupCall { - flags = (Phone_CreateGroupCall.Flags)((rtmp_stream ? 0x4 : 0) | (title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0)), + flags = (Phone_CreateGroupCall.Flags)((title != null ? 0x1 : 0) | (schedule_date != null ? 0x2 : 0) | (rtmp_stream ? 0x4 : 0)), peer = peer, random_id = random_id, title = title, @@ -4768,10 +4768,10 @@ namespace TL /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. /// WebRTC parameters - public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, bool muted = false, bool video_stopped = false, string invite_hash = null) + public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall { - flags = (Phone_JoinGroupCall.Flags)((muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (invite_hash != null ? 0x2 : 0)), + flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), call = call, join_as = join_as, invite_hash = invite_hash, @@ -4810,10 +4810,10 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool reset_invite_hash = false, bool? join_muted = default) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool? join_muted = default, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings.Flags)((reset_invite_hash ? 0x2 : 0) | (join_muted != default ? 0x1 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, join_muted = join_muted.GetValueOrDefault(), }); @@ -4860,10 +4860,10 @@ namespace TL /// The group call or livestream /// Recording title /// If video stream recording is enabled, whether to record in portrait or landscape mode - public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, bool start = false, bool video = false, string title = null, bool? video_portrait = default) + public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, string title = null, bool? video_portrait = default, bool start = false, bool video = false) => client.Invoke(new Phone_ToggleGroupCallRecord { - flags = (Phone_ToggleGroupCallRecord.Flags)((start ? 0x1 : 0) | (video ? 0x4 : 0) | (title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0)), + flags = (Phone_ToggleGroupCallRecord.Flags)((title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0) | (start ? 0x1 : 0) | (video ? 0x4 : 0)), call = call, title = title, video_portrait = video_portrait.GetValueOrDefault(), From 8098f36932b1833f56518a52a5f9251bb89eb4bb Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 29 Dec 2022 22:33:28 +0100 Subject: [PATCH 032/336] API Layer 151: media spoiler flag, personal profile photo, UpdateUser... --- Examples/Program_ListenUpdates.cs | 2 +- README.md | 2 +- src/TL.Schema.cs | 87 +++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 72 ++++++++++++++++++++++--- src/TL.Table.cs | 11 ++-- src/WTelegramClient.csproj | 2 +- 6 files changed, 129 insertions(+), 47 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index e463eef..b94165e 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -51,7 +51,7 @@ namespace WTelegramClientTest case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {Chat(cp.chat_id)}"); break; case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; - case UpdateUserPhoto uup: Console.WriteLine($"{User(uup.user_id)} has changed profile photo"); break; + case UpdateUser uu: Console.WriteLine($"{User(uu.user_id)} has changed infos/photo"); break; default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above example cases } } diff --git a/README.md b/README.md index caa4f31..1c342a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-150-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-151-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f747ec7..92f176b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -199,6 +199,7 @@ namespace TL has_stickers = 0x1, /// Field has a value has_ttl_seconds = 0x2, + spoiler = 0x4, } } /// Forwarded photo See @@ -216,6 +217,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + spoiler = 0x2, } } /// Map. See @@ -269,6 +271,7 @@ namespace TL nosound_video = 0x8, /// Force the media file to be uploaded as document force_file = 0x10, + spoiler = 0x20, } } /// Forwarded document See @@ -290,6 +293,7 @@ namespace TL has_ttl_seconds = 0x1, /// Field has a value has_query = 0x2, + spoiler = 0x4, } } /// Can be used to send a venue geolocation. See @@ -324,6 +328,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + spoiler = 0x2, } } /// Document that will be downloaded by the telegram servers See @@ -341,6 +346,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + spoiler = 0x2, } } /// A game See @@ -819,6 +825,7 @@ namespace TL has_video = 0x1, /// Field has a value has_stripped_thumb = 0x2, + personal = 0x4, } } @@ -1345,6 +1352,7 @@ namespace TL /// Can we delete this channel? can_delete_channel = 0x1, antispam = 0x2, + participants_hidden = 0x4, } /// ID of the channel @@ -1708,6 +1716,7 @@ namespace TL has_photo = 0x1, /// Field has a value has_ttl_seconds = 0x4, + spoiler = 0x8, } } /// Attached map. See @@ -1754,6 +1763,7 @@ namespace TL has_ttl_seconds = 0x4, /// Whether this is a normal sticker, if not set this is a premium sticker and a premium sticker animation must be played. nopremium = 0x8, + spoiler = 0x10, } } /// Preview of webpage See @@ -2194,6 +2204,15 @@ namespace TL has_hidden = 0x8, } } + /// See + [TLDef(0x57DE635E)] + public class MessageActionSuggestProfilePhoto : MessageAction + { + public PhotoBase photo; + } + /// See + [TLDef(0xE7E75F97)] + public class MessageActionAttachMenuBotAllowed : MessageAction { } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2738,7 +2757,7 @@ namespace TL } /// Extended user info See - [TLDef(0xC4B1FC3F)] + [TLDef(0xF8D32AED)] public class UserFull : IObject { /// Flags, see TL conditional fields @@ -2749,8 +2768,10 @@ namespace TL [IfFlag(1)] public string about; /// Peer settings public PeerSettings settings; + [IfFlag(21)] public PhotoBase personal_photo; /// Profile photo [IfFlag(2)] public PhotoBase profile_photo; + [IfFlag(22)] public PhotoBase fallback_photo; /// Notification settings public PeerNotifySettings notify_settings; /// For bots, info about the bot (bot commands, etc) @@ -2812,6 +2833,10 @@ namespace TL has_premium_gifts = 0x80000, /// Whether this user doesn't allow sending voice messages in a private chat with them voice_messages_forbidden = 0x100000, + /// Field has a value + has_personal_photo = 0x200000, + /// Field has a value + has_fallback_photo = 0x400000, } } @@ -3167,11 +3192,9 @@ namespace TL public int pts_count; } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See - [TLDef(0xC01E857F)] - public class UpdateUserTyping : Update + [TLDef(0xC01E857F, inheritBefore = true)] + public class UpdateUserTyping : UpdateUser { - /// User id - public long user_id; /// Action type public SendMessageAction action; } @@ -3192,39 +3215,22 @@ namespace TL public ChatParticipantsBase participants; } /// Contact status update. See - [TLDef(0xE5BDF8DE)] - public class UpdateUserStatus : Update + [TLDef(0xE5BDF8DE, inheritBefore = true)] + public class UpdateUserStatus : UpdateUser { - /// User identifier - public long user_id; /// New status public UserStatus status; } /// Changes the user's first name, last name and username. See - [TLDef(0xA7848924)] - public class UpdateUserName : Update + [TLDef(0xA7848924, inheritBefore = true)] + public class UpdateUserName : UpdateUser { - /// User identifier - public long user_id; /// New first name. Corresponds to the new value of real_first_name field of the . public string first_name; /// New last name. Corresponds to the new value of real_last_name field of the . public string last_name; public Username[] usernames; } - /// Change of contact's profile photo. See - [TLDef(0xF227868C)] - public class UpdateUserPhoto : Update - { - /// User identifier - public long user_id; - /// Date of photo update. - public DateTime date; - /// New profile photo - public UserProfilePhoto photo; - /// (), if one of the previously used photos is set a profile photo. - public bool previous; - } /// New encrypted message. See [TLDef(0x12BCBD9A)] public class UpdateNewEncryptedMessage : Update @@ -3334,11 +3340,9 @@ namespace TL public PrivacyRule[] rules; } /// A user's phone number was changed See - [TLDef(0x05492A13)] - public class UpdateUserPhone : Update + [TLDef(0x05492A13, inheritBefore = true)] + public class UpdateUserPhone : UpdateUser { - /// User ID - public long user_id; /// New phone number public string phone; } @@ -4341,11 +4345,9 @@ namespace TL [TLDef(0xFB4C496C)] public class UpdateReadFeaturedEmojiStickers : Update { } /// The emoji status of a certain user has changed See - [TLDef(0x28373599)] - public class UpdateUserEmojiStatus : Update + [TLDef(0x28373599, inheritBefore = true)] + public class UpdateUserEmojiStatus : UpdateUser { - /// User ID - public long user_id; /// New emoji status public EmojiStatus emoji_status; } @@ -4406,6 +4408,12 @@ namespace TL has_order = 0x1, } } + /// See + [TLDef(0x20529438)] + public class UpdateUser : Update + { + public long user_id; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5791,6 +5799,7 @@ namespace TL { /// Whether this custom emoji can be sent by non-Premium users free = 0x1, + text_color = 0x2, } } @@ -6629,6 +6638,7 @@ namespace TL selective = 0x4, /// Field has a value has_placeholder = 0x8, + persistent = 0x10, } } /// Bot or inline keyboard See @@ -8187,6 +8197,14 @@ namespace TL /// Stickerset public override StickerSet Set => set; } + /// See + [TLDef(0x77B15D1C)] + public class StickerSetNoCovered : StickerSetCoveredBase + { + public StickerSet set; + + public override StickerSet Set => set; + } /// Position on a photo where a mask should be placed when attaching stickers to media » See [TLDef(0xAED6DBB2)] @@ -13450,6 +13468,7 @@ namespace TL inactive = 0x1, /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, + request_write_access = 0x4, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9fab31b..83fa378 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3255,9 +3255,10 @@ namespace TL /// Enable or disable web bot attachment menu » See /// Bot ID /// Toggle - public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled) + public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled, bool write_allowed = false) => client.Invoke(new Messages_ToggleBotInAttachMenu { + flags = (Messages_ToggleBotInAttachMenu.Flags)(write_allowed ? 0x1 : 0), bot = bot, enabled = enabled, }); @@ -3495,9 +3496,10 @@ namespace TL /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) /// Input photo - public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id) + public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id, bool fallback = false) => client.Invoke(new Photos_UpdateProfilePhoto { + flags = (Photos_UpdateProfilePhoto.Flags)(fallback ? 0x1 : 0), id = id, }); @@ -3505,10 +3507,10 @@ namespace TL /// File saved in parts by means of Upload_SaveFilePart method /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. - public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null) + public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool fallback = false) => client.Invoke(new Photos_UploadProfilePhoto { - flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0)), + flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (fallback ? 0x8 : 0)), file = file, video = video, video_start_ts = video_start_ts.GetValueOrDefault(), @@ -3536,6 +3538,17 @@ namespace TL limit = limit, }); + /// See + public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool suggest = false, bool save = false) + => client.Invoke(new Photos_UploadContactProfilePhoto + { + flags = (Photos_UploadContactProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (suggest ? 0x8 : 0) | (save ? 0x10 : 0)), + user_id = user_id, + file = file, + video = video, + video_start_ts = video_start_ts.GetValueOrDefault(), + }); + /// Saves a part of file for further sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part @@ -4360,6 +4373,14 @@ namespace TL msg_id = msg_id, }); + /// See + public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleParticipantsHidden + { + 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 @@ -7790,11 +7811,17 @@ namespace TL.Methods public InputUserBase bot; } - [TLDef(0x1AEE33AF)] + [TLDef(0x69F59D69)] public class Messages_ToggleBotInAttachMenu : IMethod { + public Flags flags; public InputUserBase bot; public bool enabled; + + [Flags] public enum Flags : uint + { + write_allowed = 0x1, + } } [TLDef(0x178B480B)] @@ -7983,10 +8010,16 @@ namespace TL.Methods } } - [TLDef(0x72D4742C)] + [TLDef(0x1C3D5956)] public class Photos_UpdateProfilePhoto : IMethod { + public Flags flags; public InputPhoto id; + + [Flags] public enum Flags : uint + { + fallback = 0x1, + } } [TLDef(0x89F30F69)] @@ -8002,6 +8035,7 @@ namespace TL.Methods has_file = 0x1, has_video = 0x2, has_video_start_ts = 0x4, + fallback = 0x8, } } @@ -8020,6 +8054,25 @@ namespace TL.Methods public int limit; } + [TLDef(0xB91A83BF)] + public class Photos_UploadContactProfilePhoto : IMethod + { + public Flags flags; + public InputUserBase user_id; + [IfFlag(0)] public InputFileBase file; + [IfFlag(1)] public InputFileBase video; + [IfFlag(2)] public double video_start_ts; + + [Flags] public enum Flags : uint + { + has_file = 0x1, + has_video = 0x2, + has_video_start_ts = 0x4, + suggest = 0x8, + save = 0x10, + } + } + [TLDef(0xB304A621)] public class Upload_SaveFilePart : IMethod { @@ -8657,6 +8710,13 @@ namespace TL.Methods public int msg_id; } + [TLDef(0x6A6E7854)] + public class Channels_ToggleParticipantsHidden : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f1f9db4..cc4740e 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 = 150; // fetched 07/12/2022 12:23:35 + public const int Version = 151; // fetched 29/12/2022 21:30:31 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -65,7 +65,7 @@ namespace TL [0x37982646] = typeof(IpPortSecret), [0x4679B65F] = typeof(AccessPointRule), [0x5A592A6C] = typeof(Help_ConfigSimple), - // from TL.Schema: + // from TL.SchemaExtensions: [0x3FEDD339] = typeof(True), [0xC4B9F9BB] = typeof(Error), [0x56730BCC] = null,//Null @@ -193,6 +193,8 @@ namespace TL [0xABA0F5C6] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), + [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), + [0xE7E75F97] = typeof(MessageActionAttachMenuBotAllowed), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -219,7 +221,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xC4B1FC3F] = typeof(UserFull), + [0xF8D32AED] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -264,7 +266,6 @@ namespace TL [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), [0xA7848924] = typeof(UpdateUserName), - [0xF227868C] = typeof(UpdateUserPhoto), [0x12BCBD9A] = typeof(UpdateNewEncryptedMessage), [0x1710F156] = typeof(UpdateEncryptedChatTyping), [0xB4A2E88D] = typeof(UpdateEncryption), @@ -365,6 +366,7 @@ namespace TL [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), [0xFE198602] = typeof(UpdateChannelPinnedTopics), + [0x20529438] = typeof(UpdateUser), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -622,6 +624,7 @@ namespace TL [0x6410A5D2] = typeof(StickerSetCovered), [0x3407E51B] = typeof(StickerSetMultiCovered), [0x40D13C0E] = typeof(StickerSetFullCovered), + [0x77B15D1C] = typeof(StickerSetNoCovered), [0xAED6DBB2] = typeof(MaskCoords), [0x4A992157] = typeof(InputStickeredMediaPhoto), [0x0438865B] = typeof(InputStickeredMediaDocument), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 5718f70..ce3ce87 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: 150 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 151 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2022 MIT https://github.com/wiz0u/WTelegramClient From d858411a879585594a5ff6c6ca347813e6ec6bfb Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:28:58 +0100 Subject: [PATCH 033/336] demonstrate doc.Filename in Program_DownloadSavedMedia --- .github/dev.yml | 2 +- Examples/Program_DownloadSavedMedia.cs | 6 +++--- FAQ.md | 1 + 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 3b5849b..27a4134 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.2.1-dev.$(Rev:r) +name: 3.2.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index d8ca67d..c65c13a 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -10,7 +10,7 @@ namespace WTelegramClientTest static class Program_DownloadSavedMedia { // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number - static async Task Main(string[] args) + static async Task Main(string[] _) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); @@ -30,8 +30,8 @@ namespace WTelegramClientTest if (message.media is MessageMediaDocument { document: Document document }) { - int slash = document.mime_type.IndexOf('/'); // quick & dirty conversion from MIME type to file extension - var filename = slash > 0 ? $"{document.id}.{document.mime_type[(slash + 1)..]}" : $"{document.id}.bin"; + var filename = document.Filename; // use document original filename, or build a name from document ID & MIME type: + filename ??= $"{document.id}.{document.mime_type[(document.mime_type.IndexOf('/') + 1)..]}"; Console.WriteLine("Downloading " + filename); using var fileStream = File.Create(filename); await client.DownloadFileAsync(document, fileStream); diff --git a/FAQ.md b/FAQ.md index 2363f45..1c1d382 100644 --- a/FAQ.md +++ b/FAQ.md @@ -299,6 +299,7 @@ Also, remember to add a `using TL;` at the top of your files to have access to a # Troubleshooting guide Here is a list of common issues and how to fix them so that your program work correctly: + 1) Are you using the Nuget package or the library source code? It is not recommended to copy/compile the source code of the library for a normal usage. When built in DEBUG mode, the source code connects to Telegram test servers (see also [FAQ #6](#wrong-server)). From 750dbef33b521cca0ebdc9232762be8b00c65a3b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 6 Jan 2023 13:29:33 +0100 Subject: [PATCH 034/336] default value for offset_topic arg --- src/TL.SchemaFuncs.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 83fa378..a940a30 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4298,7 +4298,7 @@ namespace TL }); /// See - public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, int offset_topic, DateTime offset_date = default, int offset_id = default, int limit = int.MaxValue, string q = null) + public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) => client.Invoke(new Channels_GetForumTopics { flags = (Channels_GetForumTopics.Flags)(q != null ? 0x1 : 0), From 014f563b899c539678f512be7f5e1641e5c2f1d3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Jan 2023 13:22:40 +0100 Subject: [PATCH 035/336] added Channel.MainUsername helper | simplified GetAllChats example --- Examples/Program_GetAllChats.cs | 4 ++-- README.md | 16 +++------------- src/TL.Helpers.cs | 1 + 3 files changed, 6 insertions(+), 15 deletions(-) diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index b39e31f..02fc287 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -34,10 +34,10 @@ namespace WTelegramClientTest foreach (var (id, chat) in chats.chats) switch (chat) { - case Chat smallgroup when (smallgroup.flags & Chat.Flags.deactivated) == 0: + case Chat smallgroup when smallgroup.IsActive: Console.WriteLine($"{id}: Small group: {smallgroup.title} with {smallgroup.participants_count} members"); break; - case Channel channel when (channel.flags & Channel.Flags.broadcast) != 0: + case Channel channel when channel.IsChannel: Console.WriteLine($"{id}: Channel {channel.username}: {channel.title}"); //Console.WriteLine($" → access_hash = {channel.access_hash:X}"); break; diff --git a/README.md b/README.md index 1c342a3..e40d404 100644 --- a/README.md +++ b/README.md @@ -129,18 +129,8 @@ using TL; var chats = await client.Messages_GetAllChats(); 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 basicChat when basicChat.IsActive: - Console.WriteLine($"{id}: Basic chat: {basicChat.title}"); - break; - case Channel group when group.IsGroup: - Console.WriteLine($"{id}: Group {group.username}: {group.title}"); - break; - case Channel channel: - Console.WriteLine($"{id}: Channel {channel.username}: {channel.title}"); - break; - } + if (chat.IsActive) + Console.WriteLine($"{id,10}: {chat}"); Console.Write("Type a chat ID to send a message: "); long chatId = long.Parse(Console.ReadLine()); var target = chats.chats[chatId]; @@ -149,7 +139,7 @@ await client.SendMessageAsync(target, "Hello, World"); ``` ➡️ You can find lots of useful code snippets in [EXAMPLES](https://wiz0u.github.io/WTelegramClient/EXAMPLES) -and in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). +and more detailed programs in the [Examples subdirectory](https://github.com/wiz0u/WTelegramClient/tree/master/Examples). ➡️ Check [the FAQ](https://wiz0u.github.io/WTelegramClient/FAQ#compile) if example codes don't compile correctly on your machine, or other troubleshooting. diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 625fdae..50689e1 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -216,6 +216,7 @@ namespace TL partial class Channel { public override bool IsActive => (flags & Flags.left) == 0; + public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); From 8f10df88497031db9713dbecc5b5b74c6ddeaa80 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 9 Jan 2023 13:22:35 +0100 Subject: [PATCH 036/336] made Peer.UserOrChat as protected internal to be user-overridable --- src/TL.Extensions.cs | 2 +- src/TL.Helpers.cs | 8 ++++---- src/WTelegramClient.csproj | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index be79d66..01fe82d 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -14,7 +14,7 @@ namespace TL public override long ID => 0; internal Dictionary _users; internal Dictionary _chats; - internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) { lock (_users) foreach (var user in users.Values) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 50689e1..62b48e2 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -117,25 +117,25 @@ namespace TL partial class Peer { public abstract long ID { get; } - internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); + protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); } partial class PeerUser { public override string ToString() => "user " + user_id; public override long ID => user_id; - internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; } partial class PeerChat { public override string ToString() => "chat " + chat_id; public override long ID => chat_id; - internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; } partial class PeerChannel { public override string ToString() => "channel " + channel_id; public override long ID => channel_id; - internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; } partial class UserBase : IPeerInfo diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ce3ce87..6eedad4 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -14,7 +14,7 @@ 0.0.0 Wizou Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 151 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - Copyright © Olivier Marcoux 2021-2022 + Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient logo.png From 66d8b7546354f228b592dcd60d7759cb8775ed2e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 12 Jan 2023 01:37:12 +0100 Subject: [PATCH 037/336] deprecate the experimental CollectAccessHash system --- EXAMPLES.md | 38 +++++++++++-- Examples/Program_CollectAccessHash.cs | 82 --------------------------- src/Client.Helpers.cs | 5 +- src/TL.Extensions.cs | 11 ++-- src/TL.cs | 2 + 5 files changed, 45 insertions(+), 93 deletions(-) delete mode 100644 Examples/Program_CollectAccessHash.cs diff --git a/EXAMPLES.md b/EXAMPLES.md index de51ccf..933e51e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -76,7 +76,7 @@ var sent2 = await client.SendMessageAsync(InputPeer.Self, text2, entities: entit text2 = client.EntitiesToMarkdown(sent2.message, sent2.entities); ``` See [HTML formatting style](https://core.telegram.org/bots/api/#html-style) and [MarkdownV2 formatting style](https://core.telegram.org/bots/api/#markdownv2-style) for details. -*Note: For the `tg://user?id=` notation to work, that user's access hash must have been collected first ([see below](#collect-access-hash))* +*Note: For the `tg://user?id=` notation to work, you need to pass the _users dictionary in arguments ([see below](#collect-users-chats))* ## List all dialogs (chats/groups/channels/user chat) we are currently in @@ -442,13 +442,39 @@ finally ``` -## Collect Access Hash and save them for later use + + +## Collect Users/Chats description structures and access hash -You can automate the collection of `access_hash` for the various resources obtained in response to API calls or Updates, -so that you don't have to remember them by yourself or ask the API about them each time. +Many API calls return a structure with a `users` and a `chats` field at the root of the structure. +This is also the case for updates passed to `client.OnUpdate`. -This is done by activating the experimental `client.CollectAccessHash` system. -See [Examples/Program_CollectAccessHash.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_CollectAccessHash.cs?ts=4#L22) for how to enable it, and save/restore them for later use. +These two dictionaries give details about the various users/chats that will be typically referenced in subobjects deeper in the structure, +typically in the form of a `Peer` object or a `user_id` field. + +In such case, the root structure inherits the `IPeerResolver` interface, and you can use the `UserOrChat(peer)` method to resolve a `Peer` +into either a `User` or `ChatBase` (`Chat`,`Channel`...) description structure *(depending what kind of peer it was describing)* + +You can also use the `CollectUsersChats` helper method to collect these 2 fields into 2 aggregate dictionaries to remember details +*(including access hashes)* about all the users/chats you've encountered so far. + +Example of usage for `CollectUsersChats`: +```csharp +static Dictionary _users = new(); +static Dictionary _chats = new(); +... +var dialogs = await client.Messages_GetAllDialogs(); +dialogs.CollectUsersChats(_users, _chats); +... +private static async Task OnUpdate(IObject arg) +{ + if (arg is not UpdatesBase updates) return; + updates.CollectUsersChats(_users, _chats); + ... +} +``` + +*Note: If you need to save/restore those dictionaries between runs of your program, it's up to you to serialize their content to disk* ## Use a proxy or MTProxy to connect to Telegram diff --git a/Examples/Program_CollectAccessHash.cs b/Examples/Program_CollectAccessHash.cs deleted file mode 100644 index 9537987..0000000 --- a/Examples/Program_CollectAccessHash.cs +++ /dev/null @@ -1,82 +0,0 @@ -using System; -using System.Collections.Generic; -using System.IO; -using System.Linq; -using System.Text.Json; -using System.Threading.Tasks; -using TL; - -namespace WTelegramClientTest -{ - static class Program_CollectAccessHash - { - private const string StateFilename = "SavedState.json"; - private const long DurovID = 1006503122; // known ID for Durov's Channel - private static SavedState savedState = new(); - - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number - static async Task Main(string[] _) - { - Console.WriteLine("The program demonstrate how to load/save/use collected access hash."); - WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); - using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); - client.CollectAccessHash = true; - - if (File.Exists(StateFilename)) - { - Console.WriteLine("Loading previously saved access hashes from disk..."); - using (var stateStream = File.OpenRead(StateFilename)) - savedState = await JsonSerializer.DeserializeAsync(stateStream); - foreach (var id_hash in savedState.Channels) client.SetAccessHashFor(id_hash.Key, id_hash.Value); - foreach (var id_hash in savedState.Users) client.SetAccessHashFor(id_hash.Key, id_hash.Value); - } - - Console.WriteLine("Connecting to Telegram..."); - await client.LoginUserIfNeeded(); - - var durovAccessHash = client.GetAccessHashFor(DurovID); - if (durovAccessHash != 0) - { - // we already know the access hash for Durov's Channel, so we can directly use it - Console.WriteLine($"Channel @durov has ID {DurovID} and access hash was already collected: {durovAccessHash:X}"); - } - else - { - // Zero means the access hash for Durov's Channel was not collected yet. - // So we need to obtain it through Client API calls whose results contains the access_hash field, such as: - // - Messages_GetAllChats (see Program_GetAllChats.cs for an example on how to use it) - // - Messages_GetAllDialogs (see Program_ListenUpdates.cs for an example on how to use it) - // - Contacts_ResolveUsername (see below for an example on how to use it) - // and many more API methods... - // The access_hash fields can be found inside instance of User, Channel, Photo, Document, etc.. - // usually listed through their base class UserBase, ChatBase, PhotoBase, DocumentBase, etc... - Console.WriteLine("Resolving channel @durov to get its ID, access hash and other infos..."); - var durovResolved = await client.Contacts_ResolveUsername("durov"); // @durov = Durov's Channel - if (durovResolved.peer.ID != DurovID) - throw new Exception("@durov has changed channel ID ?!"); - durovAccessHash = client.GetAccessHashFor(DurovID); // should have been collected from the previous API result - if (durovAccessHash == 0) - throw new Exception("No access hash was automatically collected !? (shouldn't happen)"); - Console.WriteLine($"Channel @durov has ID {DurovID} and access hash was automatically collected: {durovAccessHash:X}"); - } - - Console.WriteLine("With the access hash, we can now join the channel for example."); - await client.Channels_JoinChannel(new InputChannel(DurovID, durovAccessHash)); - - Console.WriteLine("Channel joined. Press any key to save and exit"); - Console.ReadKey(true); - - Console.WriteLine("Saving all collected access hashes to disk for next run..."); - savedState.Channels = client.AllAccessHashesFor().ToList(); - savedState.Users = client.AllAccessHashesFor().ToList(); - using (var stateStream = File.Create(StateFilename)) - await JsonSerializer.SerializeAsync(stateStream, savedState); - } - - class SavedState - { - public List> Channels { get; set; } = new(); - public List> Users { get; set; } = new(); - } - } -} diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 115f05a..ce1580d 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -16,7 +16,9 @@ namespace WTelegram partial class Client { #region Collect Access Hash system - /// Enable the collection of id/access_hash pairs (experimental)
See
+ #pragma warning disable CS0618 // Type or member is obsolete + /// Enable the collection of id/access_hash pairs (deprecated) + [Obsolete("This system will be removed in a future version. You should use CollectUsersChats helper on API results or updates instead. See https://wiz0u.github.io/WTelegramClient/EXAMPLES#collect-users-chats")] public bool CollectAccessHash { get; set; } public IEnumerable> AllAccessHashesFor() where T : IObject => _accessHashes.GetValueOrDefault(typeof(T)); private readonly Dictionary> _accessHashes = new(); @@ -53,6 +55,7 @@ namespace WTelegram lock (_accessHashes) _accessHashes.GetOrCreate(type)[id] = accessHash; } + #pragma warning restore CS0618 // Type or member is obsolete #endregion #region Client TL Helpers diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 01fe82d..9139778 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -4,6 +4,7 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; +using WTelegram; // for GetValueOrDefault namespace TL { @@ -48,8 +49,9 @@ namespace TL /// Client, used for getting access_hash for tg://user?id= URLs /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation /// Generate premium entities if any + /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text, bool premium = false) + public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text, bool premium = false, Dictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -119,7 +121,7 @@ namespace TL else if (c == ')') break; } textUrl.url = sb.ToString(offset + 2, offset2 - offset - 3); - if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && client.GetAccessHashFor(id) is long hash) + if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && (users?.GetValueOrDefault(id)?.access_hash ?? client.GetAccessHashFor(id)) is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(id, hash) }; else if ((textUrl.url.StartsWith("tg://emoji?id=") || textUrl.url.StartsWith("emoji?id=")) && long.TryParse(textUrl.url[(textUrl.url.IndexOf('=') + 1)..], out id)) if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; @@ -247,8 +249,9 @@ namespace TL /// Client, used for getting access_hash for tg://user?id= URLs /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags /// Generate premium entities if any + /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] HtmlToEntities(this WTelegram.Client client, ref string text, bool premium = false) + public static MessageEntity[] HtmlToEntities(this WTelegram.Client client, ref string text, bool premium = false, Dictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -303,7 +306,7 @@ namespace TL else if (tag.StartsWith("a href=\"") && tag.EndsWith("\"")) { tag = tag[8..^1]; - if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && client.GetAccessHashFor(user_id) is long hash) + if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && (users?.GetValueOrDefault(user_id)?.access_hash ?? client.GetAccessHashFor(user_id)) is long hash) entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser(user_id, hash) }); else entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); diff --git a/src/TL.cs b/src/TL.cs index c7b1767..b5544b4 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -95,7 +95,9 @@ namespace TL if (field.FieldType.IsEnum) if (field.Name == "flags") flags = (uint)value; else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; +#pragma warning disable CS0618 // Type or member is obsolete if (reader.Client?.CollectAccessHash == true) reader.Client.CollectField(field, obj, value); +#pragma warning restore CS0618 // Type or member is obsolete } return (IObject)obj; } From 553934c5ad11a630454eb4ffb229b795908adbbf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 26 Jan 2023 14:42:50 +0100 Subject: [PATCH 038/336] add GetAllDialogs to WinForms example app --- EXAMPLES.md | 19 ++++++++++++------- Examples/WinForms_app.zip | Bin 10412 -> 10502 bytes FAQ.md | 30 +++++++++++++++++------------- README.md | 2 +- 4 files changed, 30 insertions(+), 21 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 933e51e..c871113 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -12,7 +12,7 @@ await client.LoginUserIfNeeded(); In this case, environment variables are used for configuration so make sure to go to your **Project Properties > Debug > Environment variables** -and add at least these variables with adequate value: **api_id, api_hash, phone_number** +and add at least these variables with adequate values: **api_id, api_hash, phone_number** Remember that these are just simple example codes that you should adjust to your needs. In real production code, you might want to properly test the success of each operation or handle exceptions, @@ -453,25 +453,30 @@ These two dictionaries give details about the various users/chats that will be t typically in the form of a `Peer` object or a `user_id` field. In such case, the root structure inherits the `IPeerResolver` interface, and you can use the `UserOrChat(peer)` method to resolve a `Peer` -into either a `User` or `ChatBase` (`Chat`,`Channel`...) description structure *(depending what kind of peer it was describing)* +into either a `User` or `ChatBase` (`Chat`,`Channel`...) description structure *(depending on the kind of peer it was describing)* You can also use the `CollectUsersChats` helper method to collect these 2 fields into 2 aggregate dictionaries to remember details *(including access hashes)* about all the users/chats you've encountered so far. -Example of usage for `CollectUsersChats`: +Example of usage: ```csharp -static Dictionary _users = new(); -static Dictionary _chats = new(); +private Dictionary _users = new(); +private Dictionary _chats = new(); ... var dialogs = await client.Messages_GetAllDialogs(); dialogs.CollectUsersChats(_users, _chats); -... -private static async Task OnUpdate(IObject arg) + +private async Task OnUpdate(IObject arg) { if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(_users, _chats); ... } + +// example of UserOrChat usage: +var firstPeer = dialogs.UserOrChat(dialogs.dialogs[0].Peer); +if (firstPeer is User firstUser) Console.WriteLine($"First dialog is with user {firstUser}"); +else if (firstPeer is ChatBase firstChat) Console.WriteLine($"First dialog is {firstChat}"); ``` *Note: If you need to save/restore those dictionaries between runs of your program, it's up to you to serialize their content to disk* diff --git a/Examples/WinForms_app.zip b/Examples/WinForms_app.zip index b92e8323ffc1454655a318c82c93514a1e9511a1..e04d6b7ff5859af685d2de9da48dad18d1a6c8b2 100644 GIT binary patch delta 5475 zcmZ`-cQ{;I*B?E4XY?`{H6e&jj38QcqSsNQ6Nz@TA$pk!i7skHbP|TBA$p1EoiJL| zh!#G%-@Whq-9Ns4p7We%pJ%P#T6>*!*52z^t{bICrlWy_O9T2ds(q!6QpkkK-UNvn z;h%FJPGf;U>$u2DI%Xsp7ZLE@VAOp^m?k*44yd}6P8&%`H1am(Fg>aAgFyt6UaH-; zUY=U0Cxu%nKt(v;m&F)rS+2a>UiBH45#%dBIp~aYn@wg!Pd6OW)=NA%Ai_?@%L?BhE z`9zbRQH1Unk+=nL0$E?KrIc>F$kwc4wjcU{K`Uf#9ceAMBL=t!5FlZl!csM{Q@drE z8=ZwvXz5W&-Ak~ddshT6AK_HE#sPuKy{-Wp3`Qkge8$f$UiiAh!Ur7^XkR-)#EPn< z3x&S13buAWI#}V`J-~7q#=^cGLn=NP?e@{1- z0e|=Bs zq0{J(o>oJ~@&IDMxARaldzFnNb4aQL>>^{uNsc{q(${4se z1=MboNP%ZyXM1G!BC7fzfo^H_TE=1eW6Eg-HVuFoS_JH$Sq^wIN|DI9D5qxU0$Cujpm zu0Q>>4UL)m}$rOR3-Qgw&a3c*Wo{SgYSLp|i)A z(rW+Jw7I8i{%-A~SE;KMobyVtb>(!2*q3^v@_eprMf~HvyYAX=!ykN{7dhDp1z((A zQtGo4;fuCtB9oeIkNTP<$ElsmS9^C!?nK%!D9$n^fM*gZg5L4UUX9~OJ_rWTAR8BM zEwNAcY8f=PF{hq{CeKbU*<*V9^p|UDDZw zQvU{`1b!`DNn7SeAqfOOe&(8*mu5+t)RLooL}>8DZQT`clx?)>g}xx=oP|WC4!oJ& z0(WD)WcgrBxAI?R_V@nj39HBn0ua`O}sa1H5k+h$YF`W~Iu*vz+KgtOkwe0=;o zMw4%fOFk*mcddZ7U3pR+eX=o6e!E4>p7*pa{&<3`9|H(0!dOHKwWO8$Z@;RE?*hFMO#0$BH^CXBw1N#kyUTjY6%w|+^LDrUHI|4h zNm=mFPwym;9j1+6!&d3Hqa@kYA~$eb0=0r_;=MfA^r;Rfxt8}>t(s1E$37ENCQ5yl z&$y6O8zC%Swxc7^;o!e>d=cymH30~)5+#1ch8wS~W^{Kcv8rM2a*3Qr+QmA`S8F_K zeH3eZPUsU}oEeF1lebmuf?;|Hk6w7Nu~jE4p{*S)$GI@Ki6%b*7h}q95{W_KN_B}8 zWD>kQgl0WHsd)_f%T({FSNH<-)7q-MLc2)j>t!<@2x6uACH1(5W3cfgy8sQa4g8)- zb^TtLAF8AM(yi+>wky{eb~1{6L0G+atdBm+V}SaQsZ2qsdd49b>H^jb`{RXp5w@3F zdsy6=hr}a6m4d3qm2WKFOm90L)j;?0mSKh-^b^0_OAHmpT1B&x-xS}?Rt&Kh4dUj} z=z|?6MzLOGv2$RH@m-?1fPMP7>VbB6`t1e{2z$_H**a@4IJb!^Wt>z~qHGkbTenTN zX^O`Dm8LM;p>Ng`tX5~esWZ(peu6exsw8i^JsLCl=^hT+tzs)Rz9vhzGG*$MCxcSN zxz*gHh^;Rhu#z+LDcjpr7dAu@G4l@c9G6ar=VK{5Un3Rlt)5or0PtiU(%~0-JNAT; z170%TPNy6~^J)V3y?r_p2V+tpp6(KiP^&JIdP*xtVZ>1}*D)@-;E0o%>bgCvGj)3N zS2{Ly*cGingevZb_SV=XX}r%#wpLlGa2bT2e~(3EJ4$cJzrg5cl|LGm&++}97LjwG z!n(gAq9SlQrviBkaJXVvs1mPi7ZayQkG*!qD(2NwVY^_+v>Sa~n~4MiQJ!wC_B3xM z_xC;7NPA2KYGO7dDXywr;A!~Mh|OifXitJ7W>O3GFhmxo)Fqx8={ zMelR%?ClI@Mm87qGG6F^I_OoBz4q)1qQkM0MT&Dx4Gky&d9DeHvgf#pSA1l0xm_)8 z-4`ehbSXnG{EqncATyr(n1Z0Xs(74`Q2sXyocuVZbGmI-CMVsZuX&(BfB(1dhKVep zA85IXBFKh)Q-G|C z)-07Qx4h{GXcuSocSQBX)|qjScxeLtDm{@Ta#2P(R5nDyL!=Bgb)W~Ao>|pz?i8IK zEvAt;BQKm}@f*nvCbnVz=4!&z`05iHMr2=Uyy0kPtzqf>qgUKd+DBp;STIWg%3nPRbj-OjCspJ`LoY*=~}+^foC!)F@jt<0SJ!*ahzwZjX@6 zT>8{e8(E!DwMG(LL5NT%S!+iiU~>J3(tgACmu3|mq)Web6y!W7;Dca2*gOF|cO-~E z`H*DjSs^MSkVopHmej{IT**vkbF|-2f$vKb-l#gyPh`b} zpePN1?n0SU0+DtZhrF)iERJ}`a#`tzB7hl84=0$yFRmhsQ2o+Y)th`0S7e(kqt={w@40~0zS=snjeIlnn3mz9Nm*`AjC(eTjk zp2EqEj8D3p47O_@`437@EDSwlr63y)DLtw0#nwwqp70U!)QUYF3rb5{l$0Rzt#UDJrY)Pr zTznOmOFgvrz=UNV^5UtbtG?Zkh64nXt}>1Wri$H!FI!*HImbV24vT+HE;vk$bb7hf9}|3n|xrdWNY9Q4lS{3gnX(L@O}S~|ULfB$?)?7$~4d#0Q7saW2` zGvh|j9+44oDT1bXvhWJYiljnF>RH&erzDMuL_OXaFGd~uT9kDWL0AB3mH`-Dv?JWN zy+*_($(v>gVD1EkR+fm+wVmIQox9O!R^nwubpTJF({+3Z`zDi9?vU-X$sjhCuvFfx zy``Eq0uf_ySpK-8i++g=ThsMM=+q0JvW+zRtGt_%4>My6v$5_n2_qC0sw{AXR=mlyfxmIHe#U z?G>%0lu+=!&a3xkeQ~xY{jZd9D`F@;!OODZ3LM1EC(Bj#MGS~vCV&c-X3X@oaYM$5 zN5(=)0QGYUZ|yFg6XjQ#i*52;<}l&0IT^`~9@waIZ9$SKqrnDjTBR{{3z5b+7l83n zk$6{|uUT1{!^Eih$@@_yCAxw_ZE<8kgYsiO%n7J-z94{_$!|`BA_wU?BDLD!)4kx?#E8Lk$T| z%2HpbiP4+;3DY2OCti-woMLQh#!3|dRL94WTrJr=DexAA@T_}N#ni9ere5Qr{ilc` zXtp!@b*59Z&BSWPtk!Uz>->jIhT5a2q6M1`ncwL_snFUdKo9eUJq(A6hco3(Zhwzl zwPiL_Qa;{vhg!g@5v_H@{Y|P$lP||J85lnsz;IZ|qo}noGMSYRs#8C;1%D_bXqC0w zwnLkfQteyYKyAWuMat-xz&Mzjfq%lRAJ~Ir`LdOf9y2^9lk2xcNa|cgHiIk1{GuOT z&k{iE5&KgY5L$P6FVR_cIN705qS+xg6?@Cy5bDRUX@8!5^tplEWbn@U_s!XPNo5Cgb{gQQ zJICz?UGpDgl4*Ks)O2`w5uH8aF4Kh3^)YEU>MOL-e|dC|-Oz%mq2OJGp-ox#%X-~N zeVh&>QHMfvVZ%s?f}&i%ajVx1F9cm(WE3Y~zACw%F)>RNN9j(a)xF1g^SE>K?iJ3z zPk6OC6nX@>7SWFlYme!#vFV9!ded8=dw$YJBbp6JPiznfeslg4M`D4wkhhs=0Rt_M zulFfhjJJTtXKS~byqpmaOq11Nlmrx<`Emw^^_JQ@DHG_4kV17`fPo-{3J9C#@k-?> z3q8Sy^jG^kE_{0Kk(Ij$_@V=~8PPKHw`J(sGh3*{9xvxV^Z5X_Gsw3aqiL%^*tuc% zmuL!m#ILw*rRT{_v<4I&RlPOPL)~2(`pvel z@D>@^#km}B(}e8htGsGWOt?jXUR?*uD`)wm@)7NTBvmRRZ7qJr%U{DoTWI-5BAxh0 zm50_F5FH&;-CwlfClJr8OBB#hjJ2JTan*pPHmO{=qYn4Z4`^8)e_nb9m}@LZ_$iG| zaZC}ad+v5zD9b<>%myN&>wFqn-f8!dXwIh{Hr)FmxQ$HWeedP4bH>obK0XqSO$r$2 zNlYAYJWFcw#qoSh1w#uLW`^r`BVOw)(nQ0_HTR1!`1<8z7cUWqh?59x=Q=jgUQ#{I6~ zG&5p9y|0klv8{@$+{ydTG5L(iIk#ERV zh$8vtDpUxy;5612?xp$PQtW@Ix_`4YTz?q6o56l_YhWW4!C+)47d`nD_WzoQvh>XQ zNBQ5)5(vZ(`oGGg1b-_NA}?Rv~Nsd%}0hNME`G`kSRQ@SUJcl9t)oTrwaUo{uhoD(;v{AqCkU8gz{qx zu>L(IM6N@Hk$1RnvHyuXSph+%6k z$;3ljRUWNoa*1nhO7$UNGJ1JJhhda(8m)@gKkb?YPVYdwOi#Ykq^r9~XwiMMR;HrZ z&~KNMKLVbnj{jW&=W^Qu2-cLUQPxQlV}KpPzJ;CxEQ6%sHVfqou9_h0@t(pnZHmQX zNWE_e62HV&!b}eSbvv@8vX8@yv_X?D&U*u7iJ7XMx_P17M2vYa=Xr5){JkIWkZ!=Q z9jMO7o3l@C8Qwvv0yp-}Vm&ZfRf|lDsfUqi#$AZYxRC$J3$d?wuDzY9CA?U(PoR4J z%8CPj_W=^i*;2_+gt#3^grd`I2q1*Gs%b-pQf&2R? z&i6-FR|dO8vI}NqW%#Bo?Z>br3=uG~Xxp-Fyl;`S&A>gydDiL;Bt+1;YD??h3C@@H z@kT67kg6u{OZAhgN?OJ`8lBjZFAZ z2s{u{rGJuu%Y*-`D*8;5NgkOYC`7;s`;i)M9nss`N@fg(^gYeTMQqFIcJy(Z?jCJp z)h7f={|z2=ous6bYJUTKstS2})D!!(@4^gp&dK!qt<`2+mfkn|^{}(u^Nsg5i2aVz zPa~#PaB{rw#66yf@MSbGkbUjG_cn8`*hmcWdu8dH4;a+*;qKI_4$&YQercH)A68}P zlZtpUy!E(z6z~SJ)*et=UaCx3iMybZZ zU6Wl9W7%a?+~^x5-cmPLQKsvbU1Vn~oMCYn$1qv_=q{~iK|z%v5-{X7Z&y8-CvFcB z&sYEl+Z9KK&Ly@V_$e7RZ|TdYWv}6NSjTjIFr9^#BiH}3n z^g5-2U)hrLD{53p2b#Uzp*yGiMRC@vIyZKeWSGC+*pf20kHCW@K(bZC*>p%g7G&{m z$YFR7VEL{H5XlYtlD>aGR8L^ts3`yeGm?WhXkpeZ9(OWCIO`3!8xAh*bI`;$RLh?D zVs4MAggQtJmx6d>(k>avlimEAzEliHzNPF}$VQ6}@%c*CSedlujEzE-T5x*}Y}#=9 zB-+b4ST8dQ#Uu#`{VvbrFJH4RpIz`sG_1I^-|Dx>8LC+h8Y@ouGvY(0f8=p$ z=JbB&QY%ba6CNTQ)_(A}^C3-XS^!FKS$FB8zn>(l2~(Ohq=cPW*EMS6v&*-a(`xUKcI;i$AC82KdsKzJn3v8aKEW(BosHw8AAz5>n}}iNV|GLf=2v?P z`Pv3^6U0>GXwHm!ny%rOh=gAsx-XS@Q|^n<6&u&Ssw+*qc0wHB^D<60@F_|J8>ukd zXn&bWr{4A?ko0?I!{pVme}qBb=eHjz;^fgz7*V;i=!jx2PBL-0;&#EwkO)Vl3al#G6NS#f<+?w z@^+T-B=4)S2{daHxl5n=9l|mk8 zsC@wRz~-u=G0CH4TJrZVxWB(VxiS2D8jGYZUZ?@)1RfQtjEn(UO_=4z z4tfy{;g*&$tt(P%QyDj{{q`9b80F>n(ru@SP>CFuh&i2WCsgAr5wY0aid(WN_BcY> zt%&t77<8cuJNwYhX^QSCm5efl>VKE@!-iyMYowHZw??UNQ@qRjVzoGyh?X226U2Y# znfwt?wSSl$^P{Y{*}>h<1NF}kOn7ql({C6xBf|pm(UG9!X+ znyR=>3H$WYd@}tE#!LgVuo8#R;UPF&Ht)qt2i!VD!v%558q@+H{uVZbYa3Oiel(^k z2&<9~75SE80flL2jDMZw=xNWw*e56C)#x3CvHLLcf&JW^PzjI3jB8ohOZc z#Bn$>>ncd>i%u-`5jrO=VKJZ+`efgSofi`9DJgu`!26vTv^?k!Nt5}`52EX;hcaNZ z4xfzVZzC_aLDSyNZAVZ<;&CW!t-0~5cSR96(RQg@lJ2W19iaLs?8^z$|9&SD$x%Oh z#)YJAx@ZU4W$sVWNVXj&Au<-H>5UsOozLR99wz{b)p!pDVb7Eb8|CH&fey#2+D7xL zp(tsmBpbB?H9hDMacsj&2pbNq`B9l;yTQcW!R_)sLF{rwtQNvPS*vgZK~PKdmJ)GKWsB46pqbJnA?oQdqP zj^a_$pE_L^qq3kUkAXl!1oIAE40_@BFv*Y3jgh|Bs0G&$9ddt(=z!I@yX5?~GRhb| zuKAye-zUKZ^kMcky&C-ia_MYc z&7~sDiu`*Ja>OfU{76@>H&8V32(3I^OEm6D41yUags30e!qyY7&@Sw|IS9Vc-_7`< zdr=)!8ib#=#8`a6ODs=sSP!nCTB|=x17Gc#&SdrAoi&}n-Wu@1IGnfk3;x}$a{*5g!8e7zy zJg4f7*Yuq{hv=%z*7yzwtBwX6@q3o9zplhz$W{1}In%;oMP+5M_sZHcg`(N{ zLz=gcI9$4D&lP#trJ$O-hbS9|iz_za1aG|{$E+t^H9fc2p`H#Xas4Gd!l0>8&n2hf zo?sE;vNgW&K}&IVOb#TE2eq^>*`K4{B?)q3R;(Ur9&%iFtAEra8fBM!6)O|UC`H&v zst1x=^h=A(FlP%VkBi8Z*F~^Tj^@^6E_SH%uB|_mGjvFUaYN(As>B$u# zvjRa};O zQ+t+Y(|Vvzc!Sp~qnx>))yM9g!gTv~W~@3@a|@*#E{>?K`i{pV$(c#!Dr(4#hOKNH zX!EYHt3%_^B+xvWokgj(nmTW)Q~5WD?tJh3#-v=fyyj8Xgn4DhT%KZJaa<-A`_!ta zLo0=1BWbX`nNhbShThz^>VS`cmKH84hALysiJ@!5_12Jo89O!wae7k|9tA=fk3%Xa zKYc*F-dp%Nj&-n{wuClr{;lJ$Z4c&hus_hLZ=dykj0Ea!S)f;Nnh>#)qcI9uh%|l~ zTRF9^{~4SA#_AzLLztYTARr4 zA&Q*^gf0?;CjenXhOvSB) z&aZ>}Lq>fj4+X3Y2nr6`gE3y}`F1`@I)a`!&ugx8#n|F2=k(oGrLBdydPHO*et(Gxk2H}R$FcdIgz7HrO)lB{ zZ5llw(Hkv)i&0|auiz`L`4<^{09Ap^wIDd_QS zMJ1FZpG&C&5IY8;SYf1Nt$Bc8SpbWlegT5hg?_wQSF1J~?OczCE=p%RF5moojIiRP zX@C1F;7O={cXHgV@wH6*#6h6^jq5UuO&VrucO`y;$NIx1paA}ir&XJv&d>ldX-LY1+pHA!@LB2uW?>Gwv=B>Gq9WWUdVEg+ zjrNMHo}P1n)%%8x##=f)DG&)VWwe0>Ig|RAu$bhv1A4E8cE0XkQ<0ZP!&B<}7Nt$y zi-$cbBpo6nnuV#9vx~D6W0PR7#0>mxeNhK;>bwv{_c+}6qy3NK1Smuf6eR0ngb-8D zIdRcInuHIp+t8Bf?GG{lU2T>x(ee}V6m2|EitwyC7%8n_-!kHmKIybD6#F8l zcv3p>m-4_n$E$u`io$>Gl-s!GW8U{moCD}xtcuM!rDbVnJ7W;G@}cl5-To_7fWcTJ z=eqemhH!E78~8kjMJx{d|lAX;@!9B&ILta?qO-H1>R}8F?gt7^#H`th*i1d z$Zv$~(8G8klS99_n5PtN5-jz(g>EnjeXM&i@MEiE4Ry?3;U8 z-_=)yjmzqS$~2RC`9iiFMk*Fmj@rt8_4M8k9$=YUea z_;H;(`;icvlK7pq9AXRd&*+d7g+exC0e=XxksdGGgz8YZuBG4G3MCV+YFmv&hIP${ z+GKexinWAt$xjvf6Aq@$tJ&r4+|8M7Xxm9-^^e2yt`54Krd>f5tYes2dX~She8gKz z&28QIHx4uh9GZ`oc^${QI0`AJ#eQ#}x&IxXf1*%VTc#dF=?sVX@Jw&jS5S!{qDun) zCcL2MbW&IoS&!QuQ%i9FlF&MO0*wD+!JwA((pdOC&CBMaOK_rZEwKD`MiZiBIsXRfU+`D z!lx5Hn~_0n8HN6l$VO$bx=#@=b22D@C?NNP_7eW zK`ohBp*{33sQ;bv@Bo1AbMYqdUkf=SeV!onmoZd;5*PD7*I7mJtY(KwF?0XRJ1BrZ z{(=TFlfqL`J?n^}wam<%a>3-1p3jc@OG< -## 4. How to use IDs? Where to get the access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? +## 4. How to use IDs and access_hash? Why the error `CHANNEL_INVALID` or `USER_ID_INVALID`? -Having only the ID is **not enough**: An `access_hash` is required by Telegram when dealing with a channel, user, photo, document, etc... -This serves as a proof that the logged-in user is entitled to access it (otherwise, anybody with the ID could access it) +⚠️ In Telegram Client API *(contrary to Bot API)*, you **cannot** interact with channels/users/etc. with only their IDs. + +You also need to obtain their `access_hash` which is specific to the resource you want to access AND to the currently logged-in user. +This serves as a proof that the logged-in user is entitled to access that channel/user/photo/document/... +(otherwise, anybody with the ID could access it) > A small private `Chat` don't need an access_hash and can be queried using their `chat_id` only. However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. The `access_hash` must usually be provided within the `Input...` structure you pass in argument to an API method (`InputPeer`, `InputChannel`, `InputUser`, etc...). -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...` 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)` +You obtain the `access_hash` through TL **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... -⚠️ *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).* +You can use the [`UserOrChat` and `CollectUsersChats` methods](EXAMPLES.md#collect-users-chats) to help you in obtaining/collecting +the description structures you receive via API calls or updates. + +Once you obtained the description structure, there are 2 methods for building your `Input...` request structure: +* **Recommended:** Just pass that description structure you already have, in place of the `Input...` argument, it will work! +*The implicit conversion operators on base classes like `ChatBase/UserBase` will create the `Input...` structure for you automatically.* +* Alternatively, you can manually create the `Input...` structure yourself by extracting the `access_hash` from the description structure + +*Note: 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 recently developed but seems not available in my program diff --git a/README.md b/README.md index e40d404..4a2b470 100644 --- a/README.md +++ b/README.md @@ -89,7 +89,7 @@ Its `int` argument is the log severity, compatible with the [LogLevel enum](http Since version 3.0.0, a new approach to login/configuration has been added. Some people might find it easier to deal with: ```csharp -WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH"); +WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH"); // this constructor doesn't need a Config method await DoLogin("+12025550156"); // initial call with user's phone_number async Task DoLogin(string loginInfo) // (add this method to your code) From f86291117f2c6fbb9659f3434226a2d49e659326 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 4 Feb 2023 10:36:19 +0100 Subject: [PATCH 039/336] API Layer 152: emoji pfp, autosave medias, auto-translations, media permissions, Firebase... --- EXAMPLES.md | 1 + README.md | 2 +- src/Client.cs | 102 +++++++------- src/TL.Schema.cs | 248 ++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 275 +++++++++++++++++++++++++++++++------ src/TL.Table.cs | 34 ++++- src/WTelegramClient.csproj | 2 +- 7 files changed, 547 insertions(+), 117 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index c871113..ff7700d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -373,6 +373,7 @@ var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get await client.Messages_ImportChatInvite("HASH"); // join the channel/group // Note: This works also with HASH invite links from public channel/group ``` +Note: `CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite) ## Add/Invite/Remove someone in a chat diff --git a/README.md b/README.md index 4a2b470..edd746b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-151-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-152-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/Client.cs b/src/Client.cs index 7918d1f..b0c76b0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1016,29 +1016,31 @@ namespace WTelegram User = null; } phone_number ??= Config("phone_number"); - Auth_SentCode sentCode; + Auth_SentCodeBase sentCodeBase; #pragma warning disable CS0618 // Auth_* methods are marked as obsolete try { - sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash ??= Config("api_hash"), settings ??= new()); + sentCodeBase = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash ??= Config("api_hash"), settings ??= new()); } catch (RpcException ex) when (ex.Code == 500 && ex.Message == "AUTH_RESTART") { - sentCode = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings); + sentCodeBase = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings); } Auth_AuthorizationBase authorization = null; + string phone_code_hash = null; try { - if (sentCode.type is Auth_SentCodeTypeSetUpEmailRequired setupEmail) + if (sentCodeBase is Auth_SentCode { type: Auth_SentCodeTypeSetUpEmailRequired setupEmail } setupSentCode) { + phone_code_hash = setupSentCode.phone_code_hash; Helpers.Log(3, "A login email is required"); - RaiseUpdate(sentCode); + RaiseUpdate(sentCodeBase); var email = _config("email"); if (string.IsNullOrEmpty(email)) - sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash); + sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); else { - var purpose = new EmailVerifyPurposeLoginSetup { phone_number = phone_number, phone_code_hash = sentCode.phone_code_hash }; + var purpose = new EmailVerifyPurposeLoginSetup { phone_number = phone_number, phone_code_hash = phone_code_hash }; if (email is not "Google" and not "Apple") { var sentEmail = await this.Account_SendVerifyEmailCode(purpose, email); @@ -1063,55 +1065,61 @@ namespace WTelegram if (retry >= MaxCodePwdAttempts) throw; } if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) - sentCode = verifiedLogin.sent_code; + sentCodeBase = verifiedLogin.sent_code; } } resent: - var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); - Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); - RaiseUpdate(sentCode); - for (int retry = 1; authorization == null; retry++) - try - { - var verification_code = await ConfigAsync("verification_code"); - if (verification_code == "" && sentCode.next_type != 0) + if (sentCodeBase is Auth_SentCodeSuccess success) + authorization = success.authorization; + else if (sentCodeBase is Auth_SentCode sentCode) + { + phone_code_hash = sentCode.phone_code_hash; + var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); + Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); + RaiseUpdate(sentCode); + for (int retry = 1; authorization == null; retry++) + try { - var mustWait = timeout - DateTime.UtcNow; - if (mustWait.Ticks > 0) + var verification_code = await ConfigAsync("verification_code"); + if (verification_code == "" && sentCode.next_type != 0) { - Helpers.Log(3, $"You must wait {(int)(mustWait.TotalSeconds + 0.5)} more seconds before requesting the code to be sent via {sentCode.next_type}"); - continue; + var mustWait = timeout - DateTime.UtcNow; + if (mustWait.Ticks > 0) + { + Helpers.Log(3, $"You must wait {(int)(mustWait.TotalSeconds + 0.5)} more seconds before requesting the code to be sent via {sentCode.next_type}"); + continue; + } + sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); + goto resent; } - sentCode = await this.Auth_ResendCode(phone_number, sentCode.phone_code_hash); - goto resent; + authorization = await this.Auth_SignIn(phone_number, phone_code_hash, verification_code); } - authorization = await this.Auth_SignIn(phone_number, sentCode.phone_code_hash, verification_code); - } - catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID") - { - Helpers.Log(4, "Wrong verification code!"); - if (retry >= MaxCodePwdAttempts) throw; - } - catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") - { - for (int pwdRetry = 1; authorization == null; pwdRetry++) - try - { - var accountPassword = await this.Account_GetPassword(); - RaiseUpdate(accountPassword); - var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); - authorization = await this.Auth_CheckPassword(checkPasswordSRP); - } - catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID") - { - Helpers.Log(4, "Wrong password!"); - if (pwdRetry >= MaxCodePwdAttempts) throw; - } - } + catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID") + { + Helpers.Log(4, "Wrong verification code!"); + if (retry >= MaxCodePwdAttempts) throw; + } + catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") + { + for (int pwdRetry = 1; authorization == null; pwdRetry++) + try + { + var accountPassword = await this.Account_GetPassword(); + RaiseUpdate(accountPassword); + var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); + authorization = await this.Auth_CheckPassword(checkPasswordSRP); + } + catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID") + { + Helpers.Log(4, "Wrong password!"); + if (pwdRetry >= MaxCodePwdAttempts) throw; + } + } + } } catch (Exception ex) when (ex is not RpcException { Message: "FLOOD_WAIT_X" }) { - try { await this.Auth_CancelCode(phone_number, sentCode.phone_code_hash); } catch { } + try { await this.Auth_CancelCode(phone_number, phone_code_hash); } catch { } throw; } if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) @@ -1122,7 +1130,7 @@ namespace WTelegram var last_name = Config("last_name"); var wait = waitUntil - DateTime.UtcNow; if (wait > TimeSpan.Zero) await Task.Delay(wait); // we get a FLOOD_WAIT_3 if we SignUp too fast - authorization = await this.Auth_SignUp(phone_number, sentCode.phone_code_hash, first_name, last_name); + authorization = await this.Auth_SignUp(phone_number, phone_code_hash, first_name, last_name); } #pragma warning restore CS0618 LoginAlreadyDone(authorization); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 92f176b..a62ef21 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -452,7 +452,7 @@ namespace TL /// a value means inputChatPhotoEmpty public abstract class InputChatPhotoBase : IObject { } /// New photo to be set as group profile photo. See - [TLDef(0xC642724E)] + [TLDef(0xBDCDAEC0)] public class InputChatUploadedPhoto : InputChatPhotoBase { /// Flags, see TL conditional fields @@ -463,6 +463,7 @@ namespace TL [IfFlag(1)] public InputFileBase video; /// Timestamp that should be shown as static preview to the user (seconds) [IfFlag(2)] public double video_start_ts; + [IfFlag(3)] public VideoSizeBase video_emoji_markup; [Flags] public enum Flags : uint { @@ -472,6 +473,8 @@ namespace TL has_video = 0x2, /// Field has a value has_video_start_ts = 0x4, + /// Field has a value + has_video_emoji_markup = 0x8, } } /// Existing photo to be set as a chat profile photo. See @@ -1169,6 +1172,7 @@ namespace TL has_requests_pending = 0x20000, /// Field has a value has_available_reactions = 0x40000, + translations_disabled = 0x80000, } /// ID of the chat @@ -1353,6 +1357,7 @@ namespace TL can_delete_channel = 0x1, antispam = 0x2, participants_hidden = 0x4, + translations_disabled = 0x8, } /// ID of the channel @@ -2213,6 +2218,13 @@ namespace TL /// See [TLDef(0xE7E75F97)] public class MessageActionAttachMenuBotAllowed : MessageAction { } + /// See + [TLDef(0xFE77345D)] + public class MessageActionRequestedPeer : MessageAction + { + public int button_id; + public Peer peer; + } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2332,7 +2344,7 @@ namespace TL /// Available sizes for download public PhotoSizeBase[] sizes; /// For animated profiles, the MPEG4 videos - [IfFlag(1)] public VideoSize[] video_sizes; + [IfFlag(1)] public VideoSizeBase[] video_sizes; /// DC ID to use for download public int dc_id; @@ -2457,9 +2469,11 @@ namespace TL } } + /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: + public abstract class Auth_SentCodeBase : IObject { } /// Contains info about a sent verification code. See [TLDef(0x5E002502)] - public class Auth_SentCode : IObject + public class Auth_SentCode : Auth_SentCodeBase { /// Flags, see TL conditional fields public Flags flags; @@ -2480,11 +2494,17 @@ namespace TL has_timeout = 0x4, } } + /// See + [TLDef(0x2390FE44)] + public class Auth_SentCodeSuccess : Auth_SentCodeBase + { + public Auth_AuthorizationBase authorization; + } /// Object contains info on user authorization. See Derived classes: , public abstract class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See - [TLDef(0x33FB7BB8)] + [TLDef(0x2EA2C0D4)] public class Auth_Authorization : Auth_AuthorizationBase { /// Flags, see TL conditional fields @@ -2493,6 +2513,7 @@ namespace TL [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; + [IfFlag(2)] public byte[] future_auth_token; /// Info on authorized user public UserBase user; @@ -2502,6 +2523,8 @@ namespace TL has_tmp_sessions = 0x1, /// Suggests the user to set up a 2-step verification password to be able to log in again setup_password_required = 0x2, + /// Field has a value + has_future_auth_token = 0x4, } } /// An account with this phone number doesn't exist on telegram: the user has to enter basic information and sign up See @@ -2837,6 +2860,7 @@ namespace TL has_personal_photo = 0x200000, /// Field has a value has_fallback_photo = 0x400000, + translations_disabled = 0x800000, } } @@ -4414,6 +4438,9 @@ namespace TL { public long user_id; } + /// See + [TLDef(0xEC05B097)] + public class UpdateAutoSaveSettings : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -5377,7 +5404,7 @@ namespace TL /// Thumbnails [IfFlag(0)] public PhotoSizeBase[] thumbs; /// Video thumbnails - [IfFlag(1)] public VideoSize[] video_thumbs; + [IfFlag(1)] public VideoSizeBase[] video_thumbs; /// DC ID public int dc_id; /// Attributes @@ -6574,6 +6601,13 @@ namespace TL public class KeyboardButtonSimpleWebView : KeyboardButtonWebView { } + /// See + [TLDef(0x0D0B468C, inheritBefore = true)] + public class KeyboardButtonRequestPeer : KeyboardButton + { + public int button_id; + public RequestPeerType peer_type; + } /// Inline keyboard row See [TLDef(0x77608B83)] @@ -7863,6 +7897,21 @@ namespace TL { public string url; } + /// See + [TLDef(0xE57B1432)] + public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms + { + public Flags flags; + [IfFlag(0)] public byte[] nonce; + [IfFlag(1)] public string receipt; + [IfFlag(1)] public int push_timeout; + + [Flags] public enum Flags : uint + { + has_nonce = 0x1, + has_receipt = 0x2, + } + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -11378,6 +11427,13 @@ namespace TL /// If set, does not allow any user to pin messages in a supergroup/chat pin_messages = 0x20000, manage_topics = 0x40000, + send_photos = 0x80000, + send_videos = 0x100000, + send_roundvideos = 0x200000, + send_audios = 0x400000, + send_voices = 0x800000, + send_docs = 0x1000000, + send_plain = 0x2000000, } } @@ -11419,13 +11475,15 @@ namespace TL } /// Settings used by telegram servers for sending the confirm code. See - [TLDef(0x8A6469C2)] + [TLDef(0xAD253D78)] public class CodeSettings : IObject { /// Flags, see TL conditional fields public Flags flags; /// Previously stored logout tokens, see the documentation for more info » [IfFlag(6)] public byte[][] logout_tokens; + [IfFlag(8)] public string token; + [IfFlag(8)] public bool app_sandbox; [Flags] public enum Flags : uint { @@ -11439,6 +11497,9 @@ namespace TL allow_missed_call = 0x20, /// Field has a value has_logout_tokens = 0x40, + allow_firebase = 0x80, + /// Field has a value + has_token = 0x100, } } @@ -12241,9 +12302,11 @@ namespace TL public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } + /// Represents an animated video thumbnail See Derived classes: + public abstract class VideoSizeBase : IObject { } /// Animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] - public class VideoSize : IObject + public class VideoSize : VideoSizeBase { /// Flags, see TL conditional fields public Flags flags; @@ -12264,6 +12327,21 @@ namespace TL has_video_start_ts = 0x1, } } + /// See + [TLDef(0xF85C413C)] + public class VideoSizeEmojiMarkup : VideoSizeBase + { + public long emoji_id; + public int[] background_colors; + } + /// See + [TLDef(0x0DA082FE)] + public class VideoSizeStickerMarkup : VideoSizeBase + { + public InputStickerSet stickerset; + public long sticker_id; + public int[] background_colors; + } /// Information about an active user in a supergroup See [TLDef(0x9D04AF9B)] @@ -13354,19 +13432,6 @@ namespace TL public AvailableReaction[] reactions; } - /// Translated text, or no result See Derived classes: , - public abstract class Messages_TranslatedText : IObject { } - /// No translation is available See - [TLDef(0x67CA4737)] - public class Messages_TranslateNoResult : Messages_TranslatedText { } - /// Translated text See - [TLDef(0xA214F7D0)] - public class Messages_TranslateResultText : Messages_TranslatedText - { - /// Translated text - public string text; - } - /// How a certain peer reacted to the message See [TLDef(0xB156FE9C)] public class MessagePeerReaction : IObject @@ -13685,6 +13750,7 @@ namespace TL { /// Pass true if this is a restore of a Telegram Premium purchase; only for the App Store restore = 0x1, + upgrade = 0x2, } } /// Info about a gifted Telegram Premium purchase See @@ -13867,15 +13933,16 @@ namespace TL public class Account_EmailVerifiedLogin : Account_EmailVerified { /// Info about the sent login code - public Auth_SentCode sent_code; + public Auth_SentCodeBase sent_code; } /// Describes a Telegram Premium subscription option See - [TLDef(0xB6F11EBE)] + [TLDef(0x5F2D1DF2)] public class PremiumSubscriptionOption : IObject { /// Flags, see TL conditional fields public Flags flags; + [IfFlag(3)] public string transaction; /// Duration of subscription in months public int months; /// Three-letter ISO 4217 currency code @@ -13893,6 +13960,8 @@ namespace TL has_store_product = 0x1, current = 0x2, can_purchase_upgrade = 0x4, + /// Field has a value + has_transaction = 0x8, } } @@ -14041,4 +14110,139 @@ namespace TL public string url; public DateTime expires; } + + /// See + public abstract class RequestPeerType : IObject { } + /// See + [TLDef(0x5F3B8A00)] + public class RequestPeerTypeUser : RequestPeerType + { + public Flags flags; + [IfFlag(0)] public bool bot; + [IfFlag(1)] public bool premium; + + [Flags] public enum Flags : uint + { + has_bot = 0x1, + has_premium = 0x2, + } + } + /// See + [TLDef(0xC9F06E1B)] + public class RequestPeerTypeChat : RequestPeerType + { + public Flags flags; + [IfFlag(3)] public bool has_username; + [IfFlag(4)] public bool forum; + [IfFlag(1)] public ChatAdminRights user_admin_rights; + [IfFlag(2)] public ChatAdminRights bot_admin_rights; + + [Flags] public enum Flags : uint + { + creator = 0x1, + has_user_admin_rights = 0x2, + has_bot_admin_rights = 0x4, + has_has_username = 0x8, + has_forum = 0x10, + bot_participant = 0x20, + } + } + /// See + [TLDef(0x339BEF6C)] + public class RequestPeerTypeBroadcast : RequestPeerType + { + public Flags flags; + [IfFlag(3)] public bool has_username; + [IfFlag(1)] public ChatAdminRights user_admin_rights; + [IfFlag(2)] public ChatAdminRights bot_admin_rights; + + [Flags] public enum Flags : uint + { + creator = 0x1, + has_user_admin_rights = 0x2, + has_bot_admin_rights = 0x4, + has_has_username = 0x8, + } + } + + /// See + /// a value means emojiListNotModified + [TLDef(0x7A1E11D1)] + public class EmojiList : IObject + { + public long hash; + public long[] document_id; + } + + /// See + [TLDef(0x7A9ABDA9)] + public class EmojiGroup : IObject + { + public string title; + public long icon_emoji_id; + public string[] emoticons; + } + + /// See + /// a value means messages.emojiGroupsNotModified + [TLDef(0x881FB94B)] + public class Messages_EmojiGroups : IObject + { + public int hash; + public EmojiGroup[] groups; + } + + /// See + [TLDef(0x751F3146)] + public class TextWithEntities : IObject + { + public string text; + public MessageEntity[] entities; + } + + /// Translated text, or no result See Derived classes: , + public abstract class Messages_TranslatedText : IObject { } + /// See + [TLDef(0x33DB32F8)] + public class Messages_TranslateResult : Messages_TranslatedText + { + public TextWithEntities[] result; + } + + /// See + [TLDef(0xC84834CE)] + public class AutoSaveSettings : IObject + { + public Flags flags; + [IfFlag(2)] public long video_max_size; + + [Flags] public enum Flags : uint + { + photos = 0x1, + videos = 0x2, + has_video_max_size = 0x4, + } + } + + /// See + [TLDef(0x81602D47)] + public class AutoSaveException : IObject + { + public Peer peer; + public AutoSaveSettings settings; + } + + /// See + [TLDef(0x4C3E069D)] + public class Account_AutoSaveSettings : IObject, IPeerResolver + { + public AutoSaveSettings users_settings; + public AutoSaveSettings chats_settings; + public AutoSaveSettings broadcasts_settings; + public AutoSaveException[] exceptions; + 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 a940a30..de02856 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -98,7 +98,7 @@ namespace TL /// Application secret hash (see App configuration) /// Settings for the code type to send [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] - public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) + public static Task Auth_SendCode(this Client client, string phone_number, int api_id, string api_hash, CodeSettings settings) => client.Invoke(new Auth_SendCode { phone_number = phone_number, @@ -224,7 +224,7 @@ namespace TL /// The phone number /// The phone code hash obtained from Auth_SendCode [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] - public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) + public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResendCode { phone_number = phone_number, @@ -295,6 +295,17 @@ namespace TL web_auth_token = web_auth_token, }); + /// See + public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) + => client.Invoke(new Auth_RequestFirebaseSms + { + flags = (Auth_RequestFirebaseSms.Flags)((safety_net_token != null ? 0x1 : 0) | (ios_push_secret != null ? 0x2 : 0)), + phone_number = phone_number, + phone_code_hash = phone_code_hash, + safety_net_token = safety_net_token, + ios_push_secret = ios_push_secret, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -453,7 +464,7 @@ namespace TL /// Verify a new phone number to associate to the current account See Possible codes: 400,406 (details) /// New phone number /// Phone code settings - public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) + public static Task Account_SendChangePhoneCode(this Client client, string phone_number, CodeSettings settings) => client.Invoke(new Account_SendChangePhoneCode { phone_number = phone_number, @@ -521,7 +532,7 @@ namespace TL /// Send confirmation code to cancel account deletion, for more info click here » See Possible codes: 400 (details) /// The hash from the service notification, for more info click here » /// Phone code settings - public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) + public static Task Account_SendConfirmPhoneCode(this Client client, string hash, CodeSettings settings) => client.Invoke(new Account_SendConfirmPhoneCode { hash = hash, @@ -631,7 +642,7 @@ namespace TL /// Send the verification phone code for telegram passport. See Possible codes: 400 (details) /// The phone number to verify /// Phone code settings - public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) + public static Task Account_SendVerifyPhoneCode(this Client client, string phone_number, CodeSettings settings) => client.Invoke(new Account_SendVerifyPhoneCode { phone_number = phone_number, @@ -1066,6 +1077,43 @@ namespace TL active = active, }); + /// See + /// a null value means emojiListNotModified + public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) + => client.Invoke(new Account_GetDefaultProfilePhotoEmojis + { + hash = hash, + }); + + /// See + /// a null value means emojiListNotModified + public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) + => client.Invoke(new Account_GetDefaultGroupPhotoEmojis + { + hash = hash, + }); + + /// See + public static Task Account_GetAutoSaveSettings(this Client client) + => client.Invoke(new Account_GetAutoSaveSettings + { + }); + + /// See + public static Task Account_SaveAutoSaveSettings(this Client client, AutoSaveSettings settings, InputPeer peer = null, bool users = false, bool chats = false, bool broadcasts = false) + => client.Invoke(new Account_SaveAutoSaveSettings + { + flags = (Account_SaveAutoSaveSettings.Flags)((peer != null ? 0x8 : 0) | (users ? 0x1 : 0) | (chats ? 0x2 : 0) | (broadcasts ? 0x4 : 0)), + peer = peer, + settings = settings, + }); + + /// See + public static Task Account_DeleteAutoSaveExceptions(this Client client) + => client.Invoke(new Account_DeleteAutoSaveExceptions + { + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1455,7 +1503,7 @@ namespace TL /// The destination where the message will be sent /// The message ID to which this message will reply to /// The message - /// Unique client message ID required to prevent message resending + /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages @@ -1485,7 +1533,7 @@ namespace TL /// Message ID to which this message should reply to /// Attached media /// Caption - /// Random ID to avoid resending the same message + /// Random ID to avoid resending the same message You can use /// Reply markup for bot keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages @@ -1515,7 +1563,7 @@ namespace TL /// Only for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Source of messages /// IDs of messages - /// Random ID to prevent resending of messages + /// Random ID to prevent resending of messages You can use /// Destination peer /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer @@ -1701,7 +1749,7 @@ namespace TL /// Sends a text message to a secret chat. See Possible codes: 400,403 (details) /// Send encrypted message without a notification /// Secret chat ID - /// Unique client message ID, necessary to avoid message resending + /// Unique client message ID, necessary to avoid message resending You can use /// TL-serialization of type, encrypted with a key that was created during chat initialization public static Task Messages_SendEncrypted(this Client client, InputEncryptedChat peer, long random_id, byte[] data, bool silent = false) => client.Invoke(new Messages_SendEncrypted @@ -1715,7 +1763,7 @@ namespace TL /// Sends a message with a file attachment to a secret chat See Possible codes: 400 (details) /// Whether to send the file without triggering a notification /// Secret chat ID - /// Unique client message ID necessary to prevent message resending + /// Unique client message ID necessary to prevent message resending You can use /// TL-serialization of type, encrypted with a key generated during chat initialization /// File attachment for the secret chat public static Task Messages_SendEncryptedFile(this Client client, InputEncryptedChat peer, long random_id, byte[] data, InputEncryptedFileBase file, bool silent = false) @@ -1730,7 +1778,7 @@ namespace TL /// Sends a service message to a secret chat. See Possible codes: 400,403 (details) /// Secret chat ID - /// Unique client message ID required to prevent message resending + /// Unique client message ID required to prevent message resending You can use /// TL-serialization of type, encrypted with a key generated during chat initialization public static Task Messages_SendEncryptedService(this Client client, InputEncryptedChat peer, long random_id, byte[] data) => client.Invoke(new Messages_SendEncryptedService @@ -1861,7 +1909,7 @@ namespace TL /// Start a conversation with a bot using a deep linking parameter See Possible codes: 400,403,500 (details) /// The bot /// The chat where to start the bot, can be the bot's private chat or a group - /// Random ID to avoid resending the same message + /// Random ID to avoid resending the same message You can use /// Deep linking parameter public static Task Messages_StartBot(this Client client, InputUserBase bot, InputPeer peer, long random_id, string start_param) => client.Invoke(new Messages_StartBot @@ -2014,7 +2062,7 @@ namespace TL /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination /// ID of the message this message should reply to - /// Random ID to avoid resending the same query + /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages @@ -2376,7 +2424,7 @@ namespace TL /// Notify the other user in a private chat that a screenshot of the chat was taken See Possible codes: 400 (details) /// Other user /// ID of message that was screenshotted, can be 0 - /// Random ID to avoid message resending + /// Random ID to avoid message resending You can use public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) => client.Invoke(new Messages_SendScreenshotNotification { @@ -3178,18 +3226,15 @@ namespace TL /// Translate a given text See Possible codes: 400 (details) /// If the text is a chat message, the peer ID - /// If the text is a chat message, the message ID /// The text to translate - /// Two-letter ISO 639-1 language code of the language from which the message is translated, if not set will be autodetected /// Two-letter ISO 639-1 language code of the language to which the message is translated - public static Task Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int? msg_id = null, string text = null, string from_lang = null) + public static Task Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int[] id = null, TextWithEntities[] text = null) => client.Invoke(new Messages_TranslateText { - flags = (Messages_TranslateText.Flags)((peer != null ? 0x1 : 0) | (msg_id != null ? 0x1 : 0) | (text != null ? 0x2 : 0) | (from_lang != null ? 0x4 : 0)), + flags = (Messages_TranslateText.Flags)((peer != null ? 0x1 : 0) | (id != null ? 0x1 : 0) | (text != null ? 0x2 : 0)), peer = peer, - msg_id = msg_id.GetValueOrDefault(), + id = id, text = text, - from_lang = from_lang, to_lang = to_lang, }); @@ -3335,7 +3380,7 @@ namespace TL /// Used by the user to relay data from an opened reply keyboard bot web app to the bot that owns it. See /// Bot that owns the web app - /// Unique client message ID to prevent duplicate sending of the same event + /// Unique client message ID to prevent duplicate sending of the same event You can use /// Text of the that was pressed to open the web app. /// Data to relay to the bot, obtained from a web_app_data_send JS event. public static Task Messages_SendWebViewData(this Client client, InputUserBase bot, long random_id, string button_text, string data) @@ -3457,6 +3502,57 @@ namespace TL { }); + /// See + public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer) + => client.Invoke(new Messages_SendBotRequestedPeer + { + peer = peer, + msg_id = msg_id, + button_id = button_id, + requested_peer = requested_peer, + }); + + /// See + /// a null value means messages.emojiGroupsNotModified + public static Task Messages_GetEmojiGroups(this Client client, int hash = default) + => client.Invoke(new Messages_GetEmojiGroups + { + hash = hash, + }); + + /// See + /// a null value means messages.emojiGroupsNotModified + public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) + => client.Invoke(new Messages_GetEmojiStatusGroups + { + hash = hash, + }); + + /// See + /// a null value means messages.emojiGroupsNotModified + public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) + => client.Invoke(new Messages_GetEmojiProfilePhotoGroups + { + hash = hash, + }); + + /// See + /// a null value means emojiListNotModified + public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) + => client.Invoke(new Messages_SearchCustomEmoji + { + emoticon = emoticon, + hash = hash, + }); + + /// See + public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) + => client.Invoke(new Messages_TogglePeerTranslations + { + flags = (Messages_TogglePeerTranslations.Flags)(disabled ? 0x1 : 0), + peer = peer, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3507,13 +3603,14 @@ namespace TL /// File saved in parts by means of Upload_SaveFilePart method /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. - public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool fallback = false) + public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool fallback = false) => client.Invoke(new Photos_UploadProfilePhoto { - flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (fallback ? 0x8 : 0)), + flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x10 : 0) | (fallback ? 0x8 : 0)), file = file, video = video, video_start_ts = video_start_ts.GetValueOrDefault(), + video_emoji_markup = video_emoji_markup, }); /// Deletes profile photos. The method returns a list of successfully deleted photo IDs. See @@ -3539,14 +3636,15 @@ namespace TL }); /// See - public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, bool suggest = false, bool save = false) + public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false) => client.Invoke(new Photos_UploadContactProfilePhoto { - flags = (Photos_UploadContactProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (suggest ? 0x8 : 0) | (save ? 0x10 : 0)), + flags = (Photos_UploadContactProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x20 : 0) | (suggest ? 0x8 : 0) | (save ? 0x10 : 0)), user_id = user_id, file = file, video = video, video_start_ts = video_start_ts.GetValueOrDefault(), + video_emoji_markup = video_emoji_markup, }); /// Saves a part of file for further sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) @@ -3917,10 +4015,10 @@ namespace TL /// Channel description /// Geogroup location /// Geogroup address - public static Task Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false) + public static Task Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false, bool forum = false) => client.Invoke(new Channels_CreateChannel { - flags = (Channels_CreateChannel.Flags)((geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0) | (broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0)), + flags = (Channels_CreateChannel.Flags)((geo_point != null ? 0x4 : 0) | (address != null ? 0x4 : 0) | (ttl_period != null ? 0x10 : 0) | (broadcast ? 0x1 : 0) | (megagroup ? 0x2 : 0) | (for_import ? 0x8 : 0) | (forum ? 0x20 : 0)), title = title, about = about, geo_point = geo_point, @@ -5212,7 +5310,7 @@ namespace TL.Methods } [TLDef(0xA677244F)] - public class Auth_SendCode : IMethod + public class Auth_SendCode : IMethod { public string phone_number; public int api_id; @@ -5305,7 +5403,7 @@ namespace TL.Methods } [TLDef(0x3EF1A9BF)] - public class Auth_ResendCode : IMethod + public class Auth_ResendCode : IMethod { public string phone_number; public string phone_code_hash; @@ -5358,6 +5456,22 @@ namespace TL.Methods public string web_auth_token; } + [TLDef(0x89464B50)] + public class Auth_RequestFirebaseSms : IMethod + { + public Flags flags; + public string phone_number; + public string phone_code_hash; + [IfFlag(0)] public string safety_net_token; + [IfFlag(1)] public string ios_push_secret; + + [Flags] public enum Flags : uint + { + has_safety_net_token = 0x1, + has_ios_push_secret = 0x2, + } + } + [TLDef(0xEC86017A)] public class Account_RegisterDevice : IMethod { @@ -5482,7 +5596,7 @@ namespace TL.Methods } [TLDef(0x82574AE5)] - public class Account_SendChangePhoneCode : IMethod + public class Account_SendChangePhoneCode : IMethod { public string phone_number; public CodeSettings settings; @@ -5528,7 +5642,7 @@ namespace TL.Methods } [TLDef(0x1B3FAA88)] - public class Account_SendConfirmPhoneCode : IMethod + public class Account_SendConfirmPhoneCode : IMethod { public string hash; public CodeSettings settings; @@ -5601,7 +5715,7 @@ namespace TL.Methods } [TLDef(0xA5A356F9)] - public class Account_SendVerifyPhoneCode : IMethod + public class Account_SendVerifyPhoneCode : IMethod { public string phone_number; public CodeSettings settings; @@ -5954,6 +6068,40 @@ namespace TL.Methods public bool active; } + [TLDef(0xE2750328)] + public class Account_GetDefaultProfilePhotoEmojis : IMethod + { + public long hash; + } + + [TLDef(0x915860AE)] + public class Account_GetDefaultGroupPhotoEmojis : IMethod + { + public long hash; + } + + [TLDef(0xADCBBCDA)] + public class Account_GetAutoSaveSettings : IMethod { } + + [TLDef(0xD69B8361)] + public class Account_SaveAutoSaveSettings : IMethod + { + public Flags flags; + [IfFlag(3)] public InputPeer peer; + public AutoSaveSettings settings; + + [Flags] public enum Flags : uint + { + users = 0x1, + chats = 0x2, + broadcasts = 0x4, + has_peer = 0x8, + } + } + + [TLDef(0x53BC0020)] + public class Account_DeleteAutoSaveExceptions : IMethod { } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -7742,21 +7890,19 @@ namespace TL.Methods public Reaction reaction; } - [TLDef(0x24CE6DEE)] + [TLDef(0x63183030)] public class Messages_TranslateText : IMethod { public Flags flags; [IfFlag(0)] public InputPeer peer; - [IfFlag(0)] public int msg_id; - [IfFlag(1)] public string text; - [IfFlag(2)] public string from_lang; + [IfFlag(0)] public int[] id; + [IfFlag(1)] public TextWithEntities[] text; public string to_lang; [Flags] public enum Flags : uint { has_peer = 0x1, has_text = 0x2, - has_from_lang = 0x4, } } @@ -7977,6 +8123,52 @@ namespace TL.Methods [TLDef(0x658B7188)] public class Messages_GetDefaultHistoryTTL : IMethod { } + [TLDef(0xFE38D01B)] + public class Messages_SendBotRequestedPeer : IMethod + { + public InputPeer peer; + public int msg_id; + public int button_id; + public InputPeer requested_peer; + } + + [TLDef(0x7488CE5B)] + public class Messages_GetEmojiGroups : IMethod + { + public int hash; + } + + [TLDef(0x2ECD56CD)] + public class Messages_GetEmojiStatusGroups : IMethod + { + public int hash; + } + + [TLDef(0x21A548F3)] + public class Messages_GetEmojiProfilePhotoGroups : IMethod + { + public int hash; + } + + [TLDef(0x2C11C0D7)] + public class Messages_SearchCustomEmoji : IMethod + { + public string emoticon; + public long hash; + } + + [TLDef(0xE47CB579)] + public class Messages_TogglePeerTranslations : IMethod + { + public Flags flags; + public InputPeer peer; + + [Flags] public enum Flags : uint + { + disabled = 0x1, + } + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8022,13 +8214,14 @@ namespace TL.Methods } } - [TLDef(0x89F30F69)] + [TLDef(0x093C9A51)] public class Photos_UploadProfilePhoto : IMethod { public Flags flags; [IfFlag(0)] public InputFileBase file; [IfFlag(1)] public InputFileBase video; [IfFlag(2)] public double video_start_ts; + [IfFlag(4)] public VideoSizeBase video_emoji_markup; [Flags] public enum Flags : uint { @@ -8036,6 +8229,7 @@ namespace TL.Methods has_video = 0x2, has_video_start_ts = 0x4, fallback = 0x8, + has_video_emoji_markup = 0x10, } } @@ -8054,7 +8248,7 @@ namespace TL.Methods public int limit; } - [TLDef(0xB91A83BF)] + [TLDef(0xE14C4A71)] public class Photos_UploadContactProfilePhoto : IMethod { public Flags flags; @@ -8062,6 +8256,7 @@ namespace TL.Methods [IfFlag(0)] public InputFileBase file; [IfFlag(1)] public InputFileBase video; [IfFlag(2)] public double video_start_ts; + [IfFlag(5)] public VideoSizeBase video_emoji_markup; [Flags] public enum Flags : uint { @@ -8070,6 +8265,7 @@ namespace TL.Methods has_video_start_ts = 0x4, suggest = 0x8, save = 0x10, + has_video_emoji_markup = 0x20, } } @@ -8330,6 +8526,7 @@ namespace TL.Methods has_geo_point = 0x4, for_import = 0x8, has_ttl_period = 0x10, + forum = 0x20, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index cc4740e..f7e6dbe 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 = 151; // fetched 29/12/2022 21:30:31 + public const int Version = 152; // fetched 03/02/2023 21:46:20 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -99,7 +99,7 @@ namespace TL [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), [0x1CA48F57] = null,//InputChatPhotoEmpty - [0xC642724E] = typeof(InputChatUploadedPhoto), + [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), [0xE4C123D6] = null,//InputGeoPointEmpty [0x48222FAF] = typeof(InputGeoPoint), @@ -195,6 +195,7 @@ namespace TL [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0xE7E75F97] = typeof(MessageActionAttachMenuBotAllowed), + [0xFE77345D] = typeof(MessageActionRequestedPeer), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -208,7 +209,8 @@ namespace TL [0x1117DD5F] = null,//GeoPointEmpty [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), - [0x33FB7BB8] = typeof(Auth_Authorization), + [0x2390FE44] = typeof(Auth_SentCodeSuccess), + [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), [0xB8BC5B0C] = typeof(InputNotifyPeer), @@ -367,6 +369,7 @@ namespace TL [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), + [0xEC05B097] = typeof(UpdateAutoSaveSettings), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -515,6 +518,7 @@ namespace TL [0x308660C1] = typeof(KeyboardButtonUserProfile), [0x13767230] = typeof(KeyboardButtonWebView), [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), + [0x0D0B468C] = typeof(KeyboardButtonRequestPeer), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -601,6 +605,7 @@ namespace TL [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), + [0xE57B1432] = typeof(Auth_SentCodeTypeFirebaseSms), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -868,7 +873,7 @@ namespace TL [0x967A462E] = typeof(InputWallPaperNoFile), [0x1C199183] = null,//Account_WallPapersNotModified [0xCDC3858C] = typeof(Account_WallPapers), - [0x8A6469C2] = typeof(CodeSettings), + [0xAD253D78] = typeof(CodeSettings), [0x1DC1BCA4] = typeof(WallPaperSettings), [0x8EFAB953] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), @@ -922,6 +927,8 @@ namespace TL [0x98F6AC75] = typeof(Help_PromoDataEmpty), [0x8C39793F] = typeof(Help_PromoData), [0xDE33B094] = typeof(VideoSize), + [0xF85C413C] = typeof(VideoSizeEmojiMarkup), + [0x0DA082FE] = typeof(VideoSizeStickerMarkup), [0x9D04AF9B] = typeof(StatsGroupTopPoster), [0xD7584C87] = typeof(StatsGroupTopAdmin), [0x535F779D] = typeof(StatsGroupTopInviter), @@ -987,8 +994,6 @@ namespace TL [0xC077EC01] = typeof(AvailableReaction), [0x9F071957] = null,//Messages_AvailableReactionsNotModified [0x768E3AAD] = typeof(Messages_AvailableReactions), - [0x67CA4737] = typeof(Messages_TranslateNoResult), - [0xA214F7D0] = typeof(Messages_TranslateResultText), [0xB156FE9C] = typeof(MessagePeerReaction), [0x80EB48AF] = typeof(GroupCallStreamChannel), [0xD0E482B2] = typeof(Phone_GroupCallStreamChannels), @@ -1043,7 +1048,7 @@ namespace TL [0x96D074FD] = typeof(EmailVerificationApple), [0x2B96CD1B] = typeof(Account_EmailVerified), [0xE1BB0D61] = typeof(Account_EmailVerifiedLogin), - [0xB6F11EBE] = typeof(PremiumSubscriptionOption), + [0x5F2D1DF2] = typeof(PremiumSubscriptionOption), [0xB81C7034] = typeof(SendAsPeer), [0xAD628CC8] = typeof(MessageExtendedMediaPreview), [0xEE479C64] = typeof(MessageExtendedMedia), @@ -1054,6 +1059,19 @@ namespace TL [0x367617D3] = typeof(Messages_ForumTopics), [0x43B46B20] = typeof(DefaultHistoryTTL), [0x41BF109B] = typeof(ExportedContactToken), + [0x5F3B8A00] = typeof(RequestPeerTypeUser), + [0xC9F06E1B] = typeof(RequestPeerTypeChat), + [0x339BEF6C] = typeof(RequestPeerTypeBroadcast), + [0x481EADFA] = null,//EmojiListNotModified + [0x7A1E11D1] = typeof(EmojiList), + [0x7A9ABDA9] = typeof(EmojiGroup), + [0x6FB4AD87] = null,//Messages_EmojiGroupsNotModified + [0x881FB94B] = typeof(Messages_EmojiGroups), + [0x751F3146] = typeof(TextWithEntities), + [0x33DB32F8] = typeof(Messages_TranslateResult), + [0xC84834CE] = typeof(AutoSaveSettings), + [0x81602D47] = typeof(AutoSaveException), + [0x4C3E069D] = typeof(Account_AutoSaveSettings), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1170,6 +1188,8 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: + [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified + [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6eedad4..f65b2bf 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: 151 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 152 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From bf7207fa7d2b082211ec03c95e605034e0da8df1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 5 Feb 2023 15:43:49 +0100 Subject: [PATCH 040/336] Support for Firebase SMS --- src/Client.cs | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index b0c76b0..452a82d 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1074,6 +1074,21 @@ namespace WTelegram else if (sentCodeBase is Auth_SentCode sentCode) { phone_code_hash = sentCode.phone_code_hash; + if (sentCode.type is Auth_SentCodeTypeFirebaseSms firebaseSms) + { + var token = await ConfigAsync("firebase:" + Convert.ToHexString(firebaseSms.nonce)); + int index = token?.IndexOf(':') ?? -1; + if (!(index > 0 && token[..index] switch + { + "safety_net_token" => await this.Auth_RequestFirebaseSms(phone_number, phone_code_hash, safety_net_token: token[(index + 1)..]), + "ios_push_secret" => await this.Auth_RequestFirebaseSms(phone_number, phone_code_hash, ios_push_secret: token[(index + 1)..]), + _ => false + })) + { + sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); + goto resent; + } + } var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); RaiseUpdate(sentCode); From b5d7ef311de4dbc618395628301aee31c01dd8a8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 13 Feb 2023 11:29:02 +0100 Subject: [PATCH 041/336] Small change to support Firebase SMS --- src/Client.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 452a82d..a9db6c5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1074,9 +1074,12 @@ namespace WTelegram else if (sentCodeBase is Auth_SentCode sentCode) { phone_code_hash = sentCode.phone_code_hash; + var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); + Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); + RaiseUpdate(sentCode); if (sentCode.type is Auth_SentCodeTypeFirebaseSms firebaseSms) { - var token = await ConfigAsync("firebase:" + Convert.ToHexString(firebaseSms.nonce)); + var token = await ConfigAsync("firebase"); int index = token?.IndexOf(':') ?? -1; if (!(index > 0 && token[..index] switch { @@ -1089,9 +1092,6 @@ namespace WTelegram goto resent; } } - var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); - Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); - RaiseUpdate(sentCode); for (int retry = 1; authorization == null; retry++) try { From 08a0802ed3c6685695e0d71e2d1594ce9677e5f9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 13 Feb 2023 11:32:45 +0100 Subject: [PATCH 042/336] Small change to support Firebase SMS --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 27a4134..ca7837f 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.2.2-dev.$(Rev:r) +name: 3.2.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest From 7948dbd8e3d1b68636d7ebc8c15a334578f4c8aa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 14 Feb 2023 11:14:17 +0100 Subject: [PATCH 043/336] Remove deprecated CollectAccessHash system --- src/Client.Helpers.cs | 43 ------------------------------------------- src/Client.cs | 10 +++++----- src/Encryption.cs | 2 +- src/SecretChats.cs | 4 ++-- src/TL.Extensions.cs | 28 ++++++++++++++-------------- src/TL.cs | 11 +---------- 6 files changed, 23 insertions(+), 75 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index ce1580d..430bbde 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -15,49 +15,6 @@ namespace WTelegram { partial class Client { - #region Collect Access Hash system - #pragma warning disable CS0618 // Type or member is obsolete - /// Enable the collection of id/access_hash pairs (deprecated) - [Obsolete("This system will be removed in a future version. You should use CollectUsersChats helper on API results or updates instead. See https://wiz0u.github.io/WTelegramClient/EXAMPLES#collect-users-chats")] - public bool CollectAccessHash { get; set; } - public IEnumerable> AllAccessHashesFor() where T : IObject => _accessHashes.GetValueOrDefault(typeof(T)); - private readonly Dictionary> _accessHashes = new(); - private static readonly FieldInfo userFlagsField = typeof(User).GetField("flags"); - private static readonly FieldInfo channelFlagsField = typeof(Channel).GetField("flags"); - - /// Retrieve the access_hash associated with this id (for a TL class) if it was collected - /// This requires to be set to first. - /// See Examples/Program_CollectAccessHash.cs for how to use this - /// a TL object class. For example User, Channel or Photo - public long GetAccessHashFor(long id) where T : IObject - { - if (!CollectAccessHash) Helpers.Log(4, "GetAccessHashFor doesn't do what you think. See https://github.com/wiz0u/WTelegramClient/blob/master/FAQ.md#access-hash"); - lock (_accessHashes) - return _accessHashes.GetOrCreate(typeof(T)).TryGetValue(id, out var access_hash) ? access_hash : 0; - } - public void SetAccessHashFor(long id, long access_hash) where T : IObject - { - lock (_accessHashes) - _accessHashes.GetOrCreate(typeof(T))[id] = access_hash; - } - internal void CollectField(FieldInfo fieldInfo, object obj, object access_hash) - { - if (fieldInfo.Name != "access_hash") return; - if (access_hash is not long accessHash) return; - var type = fieldInfo.ReflectedType; - if ((type == typeof(User) && ((User.Flags)userFlagsField.GetValue(obj)).HasFlag(User.Flags.min)) || - (type == typeof(Channel) && ((Channel.Flags)channelFlagsField.GetValue(obj)).HasFlag(Channel.Flags.min))) - return; // access_hash from Min constructors are mostly useless. see https://core.telegram.org/api/min - if (type.GetField("id") is not FieldInfo idField) return; - if (idField.GetValue(obj) is not long id) - if (idField.GetValue(obj) is not int idInt) return; - else id = idInt; - lock (_accessHashes) - _accessHashes.GetOrCreate(type)[id] = accessHash; - } - #pragma warning restore CS0618 // Type or member is obsolete - #endregion - #region Client TL Helpers /// Used to indicate progression of file download/upload /// transmitted bytes diff --git a/src/Client.cs b/src/Client.cs index a9db6c5..2b24c02 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -384,7 +384,7 @@ namespace WTelegram throw new ApplicationException($"Received a packet encrypted with unexpected key {authKeyId:X}"); if (authKeyId == 0) // Unencrypted message { - using var reader = new TL.BinaryReader(new MemoryStream(data, 8, dataLen - 8), this); + using var reader = new BinaryReader(new MemoryStream(data, 8, dataLen - 8)); long msgId = _lastRecvMsgId = reader.ReadInt64(); if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); int length = reader.ReadInt32(); @@ -407,7 +407,7 @@ namespace WTelegram if (!data.AsSpan(8, 16).SequenceEqual(_sha256Recv.Hash.AsSpan(8, 16))) throw new ApplicationException("Mismatch between MsgKey & decrypted SHA256"); _sha256Recv.Initialize(); - using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data), this); + using var reader = new BinaryReader(new MemoryStream(decrypted_data)); var serverSalt = reader.ReadInt64(); // int64 salt var sessionId = reader.ReadInt64(); // int64 session_id var msgId = reader.ReadInt64(); // int64 message_id @@ -470,7 +470,7 @@ namespace WTelegram }; } - internal MsgContainer ReadMsgContainer(TL.BinaryReader reader) + internal MsgContainer ReadMsgContainer(BinaryReader reader) { int count = reader.ReadInt32(); var array = new _Message[count]; @@ -502,7 +502,7 @@ namespace WTelegram return new MsgContainer { messages = array }; } - private RpcResult ReadRpcResult(TL.BinaryReader reader) + private RpcResult ReadRpcResult(BinaryReader reader) { long msgId = reader.ReadInt64(); var rpc = PullPendingRequest(msgId); @@ -519,7 +519,7 @@ namespace WTelegram if (peek == Layer.RpcErrorCtor) result = reader.ReadTLObject(Layer.RpcErrorCtor); else if (peek == Layer.GZipedCtor) - using (var gzipReader = new TL.BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress), reader.Client)) + using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress))) result = gzipReader.ReadTLValue(rpc.type); else { diff --git a/src/Encryption.cs b/src/Encryption.cs index 03b72c0..01f8cc9 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -97,7 +97,7 @@ namespace WTelegram var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(resPQ.server_nonce, pqInnerData.new_nonce); var answer = AES_IGE_EncryptDecrypt(serverDHparamsOk.encrypted_answer, tmp_aes_key, tmp_aes_iv, false); - using var answerReader = new TL.BinaryReader(new MemoryStream(answer), client); + using var answerReader = new BinaryReader(new MemoryStream(answer)); var answerHash = answerReader.ReadBytes(20); var answerObj = answerReader.ReadTLObject(); if (answerObj is not ServerDHInnerData serverDHinnerData) throw new ApplicationException("not server_DH_inner_data"); diff --git a/src/SecretChats.cs b/src/SecretChats.cs index b857422..53bdec0 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -94,7 +94,7 @@ namespace WTelegram } public void Load(Stream input) { - using var reader = new TL.BinaryReader(input, null, true); + using var reader = new BinaryReader(input, Encoding.UTF8, true); if (reader.ReadInt32() != 0) throw new ApplicationException("Unrecognized Secrets format"); dh = (Messages_DhConfig)reader.ReadTLObject(); if (dh?.p != null) dh_prime = BigEndianInteger(dh.p); @@ -359,7 +359,7 @@ namespace WTelegram } if (!success) throw new ApplicationException("Could not decrypt message"); if (length % 4 != 0) throw new ApplicationException($"Invalid message_data_length: {length}"); - using var reader = new TL.BinaryReader(new MemoryStream(decrypted_data, 4, length), null); + using var reader = new BinaryReader(new MemoryStream(decrypted_data, 4, length)); return reader.ReadTLObject(); } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 9139778..c9205f8 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -37,21 +37,21 @@ namespace TL public static void CollectUsersChats(this IPeerResolver structure, Dictionary users, Dictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); - public static Task Messages_GetChats(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); - public static Task Channels_GetChannels(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); - public static Task Users_GetUsers(this WTelegram.Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllDialogs"); - public static Task Messages_GetMessages(this WTelegram.Client _) => throw new ApplicationException("If you want to get the messages from a chat, use Messages_GetHistory"); + public static Task Messages_GetChats(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Channels_GetChannels(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); + public static Task Users_GetUsers(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllDialogs"); + public static Task Messages_GetMessages(this Client _) => throw new ApplicationException("If you want to get the messages from a chat, use Messages_GetHistory"); } public static class Markdown { /// Converts a Markdown text into the (plain text + entities) format used by Telegram messages - /// Client, used for getting access_hash for tg://user?id= URLs + /// not used anymore, you can pass null /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation /// Generate premium entities if any /// Dictionary used for tg://user?id= notation - /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] MarkdownToEntities(this WTelegram.Client client, ref string text, bool premium = false, Dictionary users = null) + /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync + public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, Dictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -121,7 +121,7 @@ namespace TL else if (c == ')') break; } textUrl.url = sb.ToString(offset + 2, offset2 - offset - 3); - if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && (users?.GetValueOrDefault(id)?.access_hash ?? client.GetAccessHashFor(id)) is long hash) + if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && users?.GetValueOrDefault(id)?.access_hash is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(id, hash) }; else if ((textUrl.url.StartsWith("tg://emoji?id=") || textUrl.url.StartsWith("emoji?id=")) && long.TryParse(textUrl.url[(textUrl.url.IndexOf('=') + 1)..], out id)) if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; @@ -154,7 +154,7 @@ namespace TL /// The array of formatting entities, typically obtained from /// Convert premium entities (might lead to non-standard markdown) /// The message text with MarkdownV2 formattings - public static string EntitiesToMarkdown(this WTelegram.Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToMarkdown(this Client client, string message, MessageEntity[] entities, bool premium = false) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string md)>(); @@ -246,12 +246,12 @@ namespace TL public static class HtmlText { /// Converts an HTML-formatted text into the (plain text + entities) format used by Telegram messages - /// Client, used for getting access_hash for tg://user?id= URLs + /// not used anymore, you can pass null /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags /// Generate premium entities if any /// Dictionary used for tg://user?id= notation - /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] HtmlToEntities(this WTelegram.Client client, ref string text, bool premium = false, Dictionary users = null) + /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync + public static MessageEntity[] HtmlToEntities(this Client _, ref string text, bool premium = false, Dictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -306,7 +306,7 @@ namespace TL else if (tag.StartsWith("a href=\"") && tag.EndsWith("\"")) { tag = tag[8..^1]; - if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && (users?.GetValueOrDefault(user_id)?.access_hash ?? client.GetAccessHashFor(user_id)) is long hash) + if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && users?.GetValueOrDefault(user_id)?.access_hash is long hash) entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser(user_id, hash) }); else entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); @@ -342,7 +342,7 @@ namespace TL /// The array of formatting entities, typically obtained from /// Convert premium entities /// The message text with HTML formatting tags - public static string EntitiesToHtml(this WTelegram.Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToHtml(this Client client, string message, MessageEntity[] entities, bool premium = false) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string tag)>(); diff --git a/src/TL.cs b/src/TL.cs index b5544b4..4ec4923 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -42,12 +42,6 @@ namespace TL public Exception Exception; } - internal class BinaryReader : System.IO.BinaryReader - { - public readonly WTelegram.Client Client; - public BinaryReader(Stream stream, WTelegram.Client client, bool leaveOpen = false) : base(stream, Encoding.UTF8, leaveOpen) => Client = client; - } - internal static class Serialization { internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject @@ -76,7 +70,7 @@ namespace TL { if (ctorNb == 0) ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.GZipedCtor) - using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress), reader.Client)) + using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress))) return ReadTLObject(gzipReader); if (!Layer.Table.TryGetValue(ctorNb, out var type)) throw new ApplicationException($"Cannot find type for ctor #{ctorNb:x}"); @@ -95,9 +89,6 @@ namespace TL if (field.FieldType.IsEnum) if (field.Name == "flags") flags = (uint)value; else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; -#pragma warning disable CS0618 // Type or member is obsolete - if (reader.Client?.CollectAccessHash == true) reader.Client.CollectField(field, obj, value); -#pragma warning restore CS0618 // Type or member is obsolete } return (IObject)obj; } From 514015639d82d909d4f6f1945c06373d1ba04e49 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 15 Feb 2023 18:42:52 +0100 Subject: [PATCH 044/336] ToString use MainUsername rather than username --- README.md | 2 +- src/TL.Helpers.cs | 5 ++--- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/README.md b/README.md index edd746b..1456e40 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. -The other configuration items that you can override include: **session_pathname, email, email_verification_code, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, user_id, bot_token** +The other configuration items that you can override include: **session_pathname, email, email_verification_code, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length). Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment). diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 62b48e2..1acaff5 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -161,7 +161,7 @@ namespace TL public override bool IsActive => (flags & Flags.deleted) == 0; public bool IsBot => (flags & Flags.bot) != 0; public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; - public override string ToString() => username != null ? '@' + username : last_name == null ? first_name : $"{first_name} {last_name}"; + public override string ToString() => MainUsername is string uname ? '@' + uname : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser(id, access_hash); protected override InputUser ToInputUser() => new(id, access_hash); /// An estimation of the number of days ago the user was last seen (Online=0, Recently=1, LastWeek=5, LastMonth=20, LongTimeAgo=150) @@ -221,8 +221,7 @@ namespace TL public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); public static implicit operator InputChannel(Channel channel) => new(channel.id, channel.access_hash); - public override string ToString() => - (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (username != null ? '@' + username : $"\"{title}\""); + public override string ToString() => (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (MainUsername is string uname ? '@' + uname : $"\"{title}\""); public bool IsChannel => (flags & Flags.broadcast) != 0; public bool IsGroup => (flags & Flags.broadcast) == 0; } From 5d0fd6452fe8a6aea72eb0142c0d7b0d07895e8b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 17 Feb 2023 19:31:01 +0100 Subject: [PATCH 045/336] Added helpers AnalyzeInviteLink & GetMessageByLink --- src/Client.Helpers.cs | 98 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 98 insertions(+) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 430bbde..961934e 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -675,6 +675,104 @@ namespace WTelegram /// If a positive value is passed, only messages with identifiers less or equal than the given one will be marked read public async Task ReadHistory(InputPeer peer, int max_id = default) => peer is InputPeerChannel channel ? await this.Channels_ReadHistory(channel, max_id) : (await this.Messages_ReadHistory(peer, max_id)) != null; + + private static readonly char[] QueryOrFragment = new[] { '?', '#' }; + + /// Return information about a chat/channel based on Invite Link + /// Channel or Invite Link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname + /// to also join the chat/channel + /// a Chat or Channel, possibly partial Channel information only (with flag ) + public async Task AnalyzeInviteLink(string url, bool join = false) + { + int start = url.IndexOf("//"); + start = url.IndexOf('/', start + 2) + 1; + int end = url.IndexOfAny(QueryOrFragment, start); + if (end == -1) end = url.Length; + if (start == 0 || end == start) throw new ArgumentException("Invalid URI"); + string hash; + if (url[start] == '+') + hash = url[(start + 1)..end]; + else if (string.Compare(url, start, "joinchat/", 0, 9, StringComparison.OrdinalIgnoreCase) == 0) + hash = url[(start + 9)..end]; + else + { + var resolved = await this.Contacts_ResolveUsername(url[start..end]); + var chat = resolved.Chat; + if (join && chat != null) + { + var res = await this.Channels_JoinChannel((Channel)chat); + chat = res.Chats[chat.ID]; + } + return chat; + } + var chatInvite = await this.Messages_CheckChatInvite(hash); + if (join) + try + { + var res = await this.Messages_ImportChatInvite(hash); + if (res.Chats.Values.FirstOrDefault() is ChatBase chat) return chat; + } + catch (RpcException ex) when (ex.Code == 400 && ex.Message == "INVITE_REQUEST_SENT") { } + switch (chatInvite) + { + case ChatInviteAlready cia: return cia.chat; + case ChatInvitePeek cip: return cip.chat; + case ChatInvite ci: + ChatPhoto chatPhoto = null; + if (ci.photo is Photo photo) + { + var stripped_thumb = photo.sizes.OfType().FirstOrDefault()?.bytes; + chatPhoto = new ChatPhoto + { + dc_id = photo.dc_id, + photo_id = photo.id, + stripped_thumb = stripped_thumb, + flags = (stripped_thumb != null ? ChatPhoto.Flags.has_stripped_thumb : 0) | + (photo.flags.HasFlag(Photo.Flags.has_video_sizes) ? ChatPhoto.Flags.has_video : 0), + }; + } + var rrAbout = ci.about == null ? null : new RestrictionReason[] { new() { text = ci.about } }; + return !ci.flags.HasFlag(ChatInvite.Flags.channel) + ? new Chat { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count } + : new Channel { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count, + restriction_reason = rrAbout, + flags = (ci.flags.HasFlag(ChatInvite.Flags.broadcast) ? Channel.Flags.broadcast | Channel.Flags.min : Channel.Flags.min) | + (ci.flags.HasFlag(ChatInvite.Flags.public_) ? Channel.Flags.has_username : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.megagroup) ? Channel.Flags.megagroup : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.request_needed) ? Channel.Flags.join_request : 0) }; + } + return null; + } + + /// Return chat and message details based on a message URL + /// Message Link, like https://t.me/c/1234567890/1234 or https://t.me/channelname/1234 + /// Structure containing the message, chat and user details + /// If link is for private group (t.me/c/..), user must have joined the group + public async Task GetMessageByLink(string url) + { + int start = url.IndexOf("//"); + start = url.IndexOf('/', start + 2) + 1; + int slash = url.IndexOf('/', start + 2); + if (start == 0 || slash == -1) throw new ArgumentException("Invalid URI"); + int end = url.IndexOfAny(QueryOrFragment, slash + 1); + if (end == -1) end = url.Length; + ChatBase chat; + if (url[start] is 'c' or 'C' && url[start + 1] == '/') + { + long chatId = long.Parse(url[(start + 2)..slash]); + var chats = await this.Channels_GetChannels(new InputChannel(chatId, 0)); + if (!chats.chats.TryGetValue(chatId, out chat)) + throw new ApplicationException($"Channel {chatId} not found"); + } + else + { + var resolved = await this.Contacts_ResolveUsername(url[start..slash]); + chat = resolved.Chat; + if (chat is null) throw new ApplicationException($"@{url[start..slash]} is not a Chat/Channel"); + } + int msgId = int.Parse(url[(slash + 1)..end]); + return await this.Channels_GetMessages((Channel)chat, msgId) as Messages_ChannelMessages; + } #endregion } } From 86796ebf0c5f8bc3ff1bcf27aa20c8bf1ca2a8e5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 26 Feb 2023 17:09:45 +0100 Subject: [PATCH 046/336] Correctly dispose session store on ctor exception (#128) --- README.md | 2 +- src/Client.cs | 12 ++---------- src/Session.cs | 14 +++++++------- 3 files changed, 10 insertions(+), 18 deletions(-) diff --git a/README.md b/README.md index 1456e40..26656db 100644 --- a/README.md +++ b/README.md @@ -166,7 +166,7 @@ See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. -The other configuration items that you can override include: **session_pathname, email, email_verification_code, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** +The other configuration items that you can provide include: **session_pathname, email, email_verification_code, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length). Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment). diff --git a/src/Client.cs b/src/Client.cs index 2b24c02..edf2018 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -96,8 +96,8 @@ namespace WTelegram public Client(Func configProvider = null, Stream sessionStore = null) { _config = configProvider ?? DefaultConfigOrAsk; - sessionStore ??= new SessionStore(Config("session_pathname")); var session_key = _config("session_key") ?? (_apiHash = Config("api_hash")); + sessionStore ??= new SessionStore(Config("session_pathname")); _session = Session.LoadOrCreate(sessionStore, Convert.FromHexString(session_key)); if (_session.ApiId == 0) _session.ApiId = int.Parse(Config("api_id")); if (_session.MainDC != 0) _session.DCSessions.TryGetValue(_session.MainDC, out _dcSession); @@ -699,15 +699,7 @@ namespace WTelegram static async Task DefaultTcpHandler(string host, int port) { var tcpClient = new TcpClient(); - try - { - await tcpClient.ConnectAsync(host, port); - } - catch - { - tcpClient.Dispose(); - throw; - } + await tcpClient.ConnectAsync(host, port); return tcpClient; } diff --git a/src/Session.cs b/src/Session.cs index e5a8f12..76580ec 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -113,19 +113,19 @@ namespace WTelegram session = JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); Helpers.Log(2, "Loaded previous session"); } + session ??= new Session(); + session._store = store; + Encryption.RNG.GetBytes(session._encrypted, 0, 16); + session._encryptor = aes.CreateEncryptor(rgbKey, session._encrypted); + if (!session._encryptor.CanReuseTransform) session._reuseKey = rgbKey; + session._jsonWriter = new Utf8JsonWriter(session._jsonStream, default); + return session; } catch (Exception ex) { store.Dispose(); throw new ApplicationException($"Exception while reading session file: {ex.Message}\nUse the correct api_hash/id/key, or delete the file to start a new session", ex); } - session ??= new Session(); - session._store = store; - Encryption.RNG.GetBytes(session._encrypted, 0, 16); - session._encryptor = aes.CreateEncryptor(rgbKey, session._encrypted); - if (!session._encryptor.CanReuseTransform) session._reuseKey = rgbKey; - session._jsonWriter = new Utf8JsonWriter(session._jsonStream, default); - return session; } internal void Save() // must be called with lock(session) From 22ea4c6de8972f0630c6a5e4c33b7393c5e69c50 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:10:09 +0100 Subject: [PATCH 047/336] update doc --- .github/dev.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 5 +++-- FAQ.md | 2 +- src/TL.Schema.cs | 8 ++++---- 5 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ca7837f..e53e55a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.2.3-dev.$(Rev:r) +name: 3.3.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 8d4f504..c5423ff 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.2.$(Rev:r) +name: 3.3.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ff7700d..34ab979 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -160,10 +160,10 @@ foreach (var participant in participants.participants) // This is the better way *Note: It is not possible to list only the Deleted Accounts. Those will be automatically removed by Telegram from your group after a while* -## Fetch all messages (history) from a chat +## Fetch all messages (history) from a chat/user ```csharp var chats = await client.Messages_GetAllChats(); -InputPeer peer = chats.chats[1234567890]; // the chat we want +InputPeer peer = chats.chats[1234567890]; // the chat (or User) we want for (int offset_id = 0; ;) { var messages = await client.Messages_GetHistory(peer, offset_id); @@ -180,6 +180,7 @@ for (int offset_id = 0; ;) } ``` Notes: +- `peer` can also be a User, obtained through methods like [`Messages_GetAllDialogs`](#list-dialogs) - To stop at a specific msg ID, use Messages_GetHistory `min_id` argument. For example, `min_id: dialog.read_inbox_max_id` - To mark the message history as read, use: `await client.ReadHistory(peer);` diff --git a/FAQ.md b/FAQ.md index 42b6f8e..c879365 100644 --- a/FAQ.md +++ b/FAQ.md @@ -202,7 +202,7 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is This should be transparent and pending API calls should automatically be resent upon reconnection. You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable. -3) If you reach `MaxAutoReconnects` disconnections, then the **OnUpdate** event handler will receive a `ReactorError` object to notify you of the problem. +3) If you reach `MaxAutoReconnects` disconnections, then the **OnUpdate** event handler will receive a `ReactorError` object to notify you of the problem, and pending API calls throw the network IOException. In this case, the recommended action would be to dispose the client and recreate one diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a62ef21..977e840 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -114,17 +114,17 @@ namespace TL /// Object defines a contact from the user's phone book. See Derived classes: public abstract class InputContact : IObject { } - /// Phone contact. The client_id is just an arbitrary contact ID: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully. See + /// Phone contact. See [TLDef(0xF392B7F4)] public class InputPhoneContact : InputContact { - /// User identifier on the client + /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; /// Phone number public string phone; - /// Contact's first name + /// Contact's first name public string first_name; - /// Contact's last name + /// Contact's last name public string last_name; } From c646cac7385fbfdc3d4fec361831a1d5bbb540c1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 8 Mar 2023 20:47:10 +0100 Subject: [PATCH 048/336] API Layer 154: bot app/webview stuff, modifying stickers... --- EXAMPLES.md | 2 +- README.md | 2 +- src/TL.Schema.cs | 141 ++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 194 ++++++++++++++++++++++++++++++++++--- src/TL.Table.cs | 25 +++-- src/WTelegramClient.csproj | 2 +- 6 files changed, 317 insertions(+), 49 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 34ab979..ae0f20e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -301,7 +301,7 @@ await client.SendMediaAsync(InputPeer.Self, null, inputFile); // • Send a random dice/game-of-chance effect from the list of available "dices", see https://core.telegram.org/api/dice var appConfig = await client.Help_GetAppConfig(); -var emojies_send_dice = appConfig["emojies_send_dice"] as string[]; +var emojies_send_dice = appConfig.config["emojies_send_dice"] as string[]; var dice_emoji = emojies_send_dice[new Random().Next(emojies_send_dice.Length)]; var diceMsg = await client.SendMessageAsync(InputPeer.Self, null, new InputMediaDice { emoticon = dice_emoji }); Console.WriteLine("Dice result:" + ((MessageMediaDice)diceMsg.media).value); diff --git a/README.md b/README.md index 26656db..b80b190 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-152-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-154-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 977e840..bd9cfd1 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2056,11 +2056,22 @@ namespace TL public string message; } /// The domain name of the website on which the user has logged in. More about Telegram Login » See - [TLDef(0xABE9AFFE)] + [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { + public Flags flags; /// The domain name of the website on which the user has logged in. - public string domain; + [IfFlag(0)] public string domain; + [IfFlag(2)] public BotApp app; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_domain = 0x1, + attach_menu = 0x2, + /// Field has a value + has_app = 0x4, + } } /// Secure telegram passport values were received See [TLDef(0x1B287353)] @@ -2215,9 +2226,6 @@ namespace TL { public PhotoBase photo; } - /// See - [TLDef(0xE7E75F97)] - public class MessageActionAttachMenuBotAllowed : MessageAction { } /// See [TLDef(0xFE77345D)] public class MessageActionRequestedPeer : MessageAction @@ -4862,7 +4870,7 @@ namespace TL } /// Current configuration See - [TLDef(0x232566AC)] + [TLDef(0xCC1A241E)] public class Config : IObject { /// Flags, see TL conditional fields @@ -4901,8 +4909,6 @@ namespace TL public int push_chat_period_ms; /// Not for client use public int push_chat_limit; - /// Maximum count of saved gifs - public int saved_gifs_limit; /// Only messages with age smaller than the one specified can be edited public int edit_time_limit; /// Only channel/supergroup messages with age smaller than the specified can be deleted @@ -4913,16 +4919,10 @@ namespace TL public int rating_e_decay; /// Maximum number of recent stickers public int stickers_recent_limit; - /// Maximum number of faved stickers - public int stickers_faved_limit; /// Indicates that round videos (video notes) and voice messages sent in channels and older than the specified period must be marked as read public int channels_read_media_period; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; - /// Maximum count of pinned dialogs - public int pinned_dialogs_count_max; - /// Maximum count of dialogs per folder - public int pinned_infolder_count_max; /// Maximum allowed outgoing ring time in VoIP calls: if the user we're calling doesn't reply within the specified time (in milliseconds), we should hang up the call public int call_receive_timeout_ms; /// Maximum allowed incoming ring time in VoIP calls: if the current user doesn't reply within the specified time (in milliseconds), the call will be automatically refused @@ -4957,21 +4957,18 @@ namespace TL [IfFlag(2)] public int base_lang_pack_version; /// Default message reaction [IfFlag(15)] public Reaction reactions_default; + [IfFlag(16)] public string autologin_token; [Flags] public enum Flags : uint { /// Field has a value has_tmp_sessions = 0x1, - /// Whether phone calls can be used - phonecalls_enabled = 0x2, /// Field has a value has_suggested_lang_code = 0x4, /// Whether the client should use P2P by default for phone calls with contacts default_p2p_contacts = 0x8, /// Whether the client should preload featured stickers preload_featured_stickers = 0x10, - /// Whether the client should ignore phone entities - ignore_phone_entities = 0x20, /// Whether incoming private messages can be deleted for both participants revoke_pm_inbox = 0x40, /// Field has a value @@ -4986,12 +4983,12 @@ namespace TL has_img_search_username = 0x800, /// Field has a value has_static_maps_provider = 0x1000, - /// Whether pfs was used - pfs_enabled = 0x2000, /// Whether to forcefully connect using IPv6 , even if the client knows that IPv4 is available. force_try_ipv6 = 0x4000, /// Field has a value has_reactions_default = 0x8000, + /// Field has a value + has_autologin_token = 0x10000, } } @@ -7720,7 +7717,7 @@ namespace TL } /// Result of a query to an inline bot See - [TLDef(0x947CA848)] + [TLDef(0xE021F2F6)] public class Messages_BotResults : IObject { /// Flags, see TL conditional fields @@ -7731,6 +7728,7 @@ namespace TL [IfFlag(1)] public string next_offset; /// Whether the bot requested the user to message them in private [IfFlag(2)] public InlineBotSwitchPM switch_pm; + [IfFlag(3)] public InlineBotWebView switch_webview; /// The results public BotInlineResultBase[] results; /// Caching validity of the results @@ -7746,6 +7744,8 @@ namespace TL has_next_offset = 0x2, /// Field has a value has_switch_pm = 0x4, + /// Field has a value + has_switch_webview = 0x8, } } @@ -9293,7 +9293,7 @@ namespace TL } /// Sticker in a stickerset See - [TLDef(0xFFA0A496)] + [TLDef(0x32DA9E9C)] public class InputStickerSetItem : IObject { /// Flags, see TL conditional fields @@ -9304,11 +9304,14 @@ namespace TL public string emoji; /// Coordinates for mask sticker [IfFlag(0)] public MaskCoords mask_coords; + [IfFlag(1)] public string keywords; [Flags] public enum Flags : uint { /// Field has a value has_mask_coords = 0x1, + /// Field has a value + has_keywords = 0x2, } } @@ -13124,7 +13127,7 @@ namespace TL public class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0x3A836DF8)] + [TLDef(0xFC25B828)] public class SponsoredMessage : IObject { /// Flags, see TL conditional fields @@ -13145,6 +13148,8 @@ namespace TL public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + [IfFlag(7)] public string sponsor_info; + [IfFlag(8)] public string additional_info; [Flags] public enum Flags : uint { @@ -13161,6 +13166,10 @@ namespace TL /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, show_peer_photo = 0x40, + /// Field has a value + has_sponsor_info = 0x80, + /// Field has a value + has_additional_info = 0x100, } } @@ -14245,4 +14254,90 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + /// a value means help.appConfigNotModified + [TLDef(0xDD18782E)] + public class Help_AppConfig : IObject + { + public int hash; + public JsonObject config; + } + + /// See + public abstract class InputBotApp : IObject { } + /// See + [TLDef(0xA920BD7A)] + public class InputBotAppID : InputBotApp + { + public long id; + public long access_hash; + } + /// See + [TLDef(0x908C0407)] + public class InputBotAppShortName : InputBotApp + { + public InputUserBase bot_id; + public string short_name; + } + + /// See + /// a value means botAppNotModified + [TLDef(0x95FCD1D6)] + public class BotApp : IObject + { + public Flags flags; + public long id; + public long access_hash; + public string short_name; + public string title; + public string description; + public PhotoBase photo; + [IfFlag(0)] public DocumentBase document; + public long hash; + + [Flags] public enum Flags : uint + { + has_document = 0x1, + } + } + + /// See + [TLDef(0xEB50ADF5)] + public class Messages_BotApp : IObject + { + public Flags flags; + public BotApp app; + + [Flags] public enum Flags : uint + { + inactive = 0x1, + request_write_access = 0x2, + } + } + + /// See + public abstract class AppWebViewResult : IObject { } + /// See + [TLDef(0x3C1B4F0D)] + public class AppWebViewResultUrl : AppWebViewResult + { + public string url; + } + + /// See + [TLDef(0xB57295D5)] + public class InlineBotWebView : IObject + { + public string text; + public string url; + } + + /// See + [TLDef(0x4A4FF172)] + public class ReadParticipantDate : IObject + { + public long user_id; + public DateTime date; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index de02856..ac8210d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2044,15 +2044,16 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. /// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, bool gallery = false, bool private_ = false) + public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { - flags = (Messages_SetInlineBotResults.Flags)((next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0) | (gallery ? 0x1 : 0) | (private_ ? 0x2 : 0)), + flags = (Messages_SetInlineBotResults.Flags)((next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0) | (switch_webview != null ? 0x10 : 0) | (gallery ? 0x1 : 0) | (private_ ? 0x2 : 0)), query_id = query_id, results = results, cache_time = cache_time, next_offset = next_offset, switch_pm = switch_pm, + switch_webview = switch_webview, }); /// Send a result obtained using Messages_GetInlineBotResults. See Possible codes: 400,403,420,500 (details) @@ -3076,7 +3077,7 @@ namespace TL /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details) /// Dialog /// Message ID - public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) + public static Task Messages_GetMessageReadParticipants(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_GetMessageReadParticipants { peer = peer, @@ -3358,10 +3359,10 @@ namespace TL /// Web app URL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null, bool from_switch_webview = false) => client.Invoke(new Messages_RequestSimpleWebView { - flags = (Messages_RequestSimpleWebView.Flags)(theme_params != null ? 0x1 : 0), + flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (from_switch_webview ? 0x2 : 0)), bot = bot, url = url, theme_params = theme_params, @@ -3553,6 +3554,26 @@ namespace TL peer = peer, }); + /// See + public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) + => client.Invoke(new Messages_GetBotApp + { + app = app, + hash = hash, + }); + + /// See + public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) + => client.Invoke(new Messages_RequestAppWebView + { + flags = (Messages_RequestAppWebView.Flags)((start_param != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), + peer = peer, + app = app, + start_param = start_param, + theme_params = theme_params, + platform = platform, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3831,9 +3852,11 @@ namespace TL }); /// Get app-specific configuration, see client configuration for more info on the result. See - public static Task Help_GetAppConfig(this Client client) + /// a null value means help.appConfigNotModified + public static Task Help_GetAppConfig(this Client client, int hash = default) => client.Invoke(new Help_GetAppConfig { + hash = hash, }); /// Saves logs of application on the server. See @@ -4566,6 +4589,23 @@ namespace TL admin_rights = admin_rights, }); + /// See + public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null) + => client.Invoke(new Bots_SetBotInfo + { + flags = (Bots_SetBotInfo.Flags)((about != null ? 0x1 : 0) | (description != null ? 0x2 : 0)), + lang_code = lang_code, + about = about, + description = description, + }); + + /// See + public static Task Bots_GetBotInfo(this Client client, string lang_code) + => client.Invoke(new Bots_GetBotInfo + { + lang_code = lang_code, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -4688,10 +4728,10 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers /// a null value means messages.stickerSetNotModified - public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, InputDocument thumb = null, string software = null, bool masks = false, bool animated = false, bool videos = false) + public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, InputDocument thumb = null, string software = null, bool masks = false, bool animated = false, bool videos = false, bool emojis = false, bool text_color = false) => client.Invoke(new Stickers_CreateStickerSet { - flags = (Stickers_CreateStickerSet.Flags)((thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0) | (masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0)), + flags = (Stickers_CreateStickerSet.Flags)((thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0) | (masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0) | (emojis ? 0x20 : 0) | (text_color ? 0x40 : 0)), user_id = user_id, title = title, short_name = short_name, @@ -4735,11 +4775,13 @@ namespace TL /// Stickerset /// Thumbnail /// a null value means messages.stickerSetNotModified - public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb) + public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb = null, long? thumb_document_id = null) => client.Invoke(new Stickers_SetStickerSetThumb { + flags = (Stickers_SetStickerSetThumb.Flags)((thumb != null ? 0x1 : 0) | (thumb_document_id != null ? 0x2 : 0)), stickerset = stickerset, thumb = thumb, + thumb_document_id = thumb_document_id.GetValueOrDefault(), }); /// Check whether the given short name is available See Possible codes: 400 (details) @@ -4758,6 +4800,34 @@ namespace TL title = title, }); + /// See + /// a null value means messages.stickerSetNotModified + public static Task Stickers_ChangeSticker(this Client client, InputDocument sticker, string emoji = null, MaskCoords mask_coords = null, string keywords = null) + => client.Invoke(new Stickers_ChangeSticker + { + flags = (Stickers_ChangeSticker.Flags)((emoji != null ? 0x1 : 0) | (mask_coords != null ? 0x2 : 0) | (keywords != null ? 0x4 : 0)), + sticker = sticker, + emoji = emoji, + mask_coords = mask_coords, + keywords = keywords, + }); + + /// See + /// a null value means messages.stickerSetNotModified + public static Task Stickers_RenameStickerSet(this Client client, InputStickerSet stickerset, string title) + => client.Invoke(new Stickers_RenameStickerSet + { + stickerset = stickerset, + title = title, + }); + + /// See + public static Task Stickers_DeleteStickerSet(this Client client, InputStickerSet stickerset) + => client.Invoke(new Stickers_DeleteStickerSet + { + stickerset = stickerset, + }); + /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) => client.Invoke(new Phone_GetCallConfig @@ -6861,7 +6931,7 @@ namespace TL.Methods } } - [TLDef(0xEB5EA206)] + [TLDef(0xBB12A419)] public class Messages_SetInlineBotResults : IMethod { public Flags flags; @@ -6870,6 +6940,7 @@ namespace TL.Methods public DateTime cache_time; [IfFlag(2)] public string next_offset; [IfFlag(3)] public InlineBotSwitchPM switch_pm; + [IfFlag(4)] public InlineBotWebView switch_webview; [Flags] public enum Flags : uint { @@ -6877,6 +6948,7 @@ namespace TL.Methods private_ = 0x2, has_next_offset = 0x4, has_switch_pm = 0x8, + has_switch_webview = 0x10, } } @@ -7765,8 +7837,8 @@ namespace TL.Methods public string emoticon; } - [TLDef(0x2C6F97B7)] - public class Messages_GetMessageReadParticipants : IMethod + [TLDef(0x31C1C44F)] + public class Messages_GetMessageReadParticipants : IMethod { public InputPeer peer; public int msg_id; @@ -8029,6 +8101,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { has_theme_params = 0x1, + from_switch_webview = 0x2, } } @@ -8169,6 +8242,31 @@ namespace TL.Methods } } + [TLDef(0x34FDC5C3)] + public class Messages_GetBotApp : IMethod + { + public InputBotApp app; + public long hash; + } + + [TLDef(0x8C5A3B3C)] + public class Messages_RequestAppWebView : IMethod + { + public Flags flags; + public InputPeer peer; + public InputBotApp app; + [IfFlag(1)] public string start_param; + [IfFlag(2)] public DataJSON theme_params; + public string platform; + + [Flags] public enum Flags : uint + { + write_allowed = 0x1, + has_start_param = 0x2, + has_theme_params = 0x4, + } + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8393,8 +8491,11 @@ namespace TL.Methods public string path; } - [TLDef(0x98914110)] - public class Help_GetAppConfig : IMethod { } + [TLDef(0x61E3F854)] + public class Help_GetAppConfig : IMethod + { + public int hash; + } [TLDef(0x6F02F748)] public class Help_SaveAppLog : IMethod @@ -8975,6 +9076,27 @@ namespace TL.Methods public ChatAdminRights admin_rights; } + [TLDef(0xA365DF7A)] + public class Bots_SetBotInfo : IMethod + { + public Flags flags; + public string lang_code; + [IfFlag(0)] public string about; + [IfFlag(1)] public string description; + + [Flags] public enum Flags : uint + { + has_about = 0x1, + has_description = 0x2, + } + } + + [TLDef(0x75EC12E6)] + public class Bots_GetBotInfo : IMethod + { + public string lang_code; + } + [TLDef(0x37148DBB)] public class Payments_GetPaymentForm : IMethod { @@ -9092,6 +9214,8 @@ namespace TL.Methods has_thumb = 0x4, has_software = 0x8, videos = 0x10, + emojis = 0x20, + text_color = 0x40, } } @@ -9115,11 +9239,19 @@ namespace TL.Methods public InputStickerSetItem sticker; } - [TLDef(0x9A364E30)] + [TLDef(0xA76A5392)] public class Stickers_SetStickerSetThumb : IMethod { + public Flags flags; public InputStickerSet stickerset; - public InputDocument thumb; + [IfFlag(0)] public InputDocument thumb; + [IfFlag(1)] public long thumb_document_id; + + [Flags] public enum Flags : uint + { + has_thumb = 0x1, + has_thumb_document_id = 0x2, + } } [TLDef(0x284B3639)] @@ -9134,6 +9266,36 @@ namespace TL.Methods public string title; } + [TLDef(0xF5537EBC)] + public class Stickers_ChangeSticker : IMethod + { + public Flags flags; + public InputDocument sticker; + [IfFlag(0)] public string emoji; + [IfFlag(1)] public MaskCoords mask_coords; + [IfFlag(2)] public string keywords; + + [Flags] public enum Flags : uint + { + has_emoji = 0x1, + has_mask_coords = 0x2, + has_keywords = 0x4, + } + } + + [TLDef(0x124B1C00)] + public class Stickers_RenameStickerSet : IMethod + { + public InputStickerSet stickerset; + public string title; + } + + [TLDef(0x87704394)] + public class Stickers_DeleteStickerSet : IMethod + { + public InputStickerSet stickerset; + } + [TLDef(0x55451FA9)] public class Phone_GetCallConfig : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f7e6dbe..9cb6716 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 = 152; // fetched 03/02/2023 21:46:20 + public const int Version = 154; // fetched 08/03/2023 19:08:02 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -177,7 +177,7 @@ namespace TL [0x80E11A7F] = typeof(MessageActionPhoneCall), [0x4792929B] = typeof(MessageActionScreenshotTaken), [0xFAE69F56] = typeof(MessageActionCustomAction), - [0xABE9AFFE] = typeof(MessageActionBotAllowed), + [0xC516D679] = typeof(MessageActionBotAllowed), [0x1B287353] = typeof(MessageActionSecureValuesSentMe), [0xD95C6154] = typeof(MessageActionSecureValuesSent), [0xF3F25F76] = typeof(MessageActionContactSignUp), @@ -194,7 +194,6 @@ namespace TL [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), - [0xE7E75F97] = typeof(MessageActionAttachMenuBotAllowed), [0xFE77345D] = typeof(MessageActionRequestedPeer), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), @@ -388,7 +387,7 @@ namespace TL [0x096A18D5] = typeof(Upload_File), [0xF18CDA44] = typeof(Upload_FileCdnRedirect), [0x18B7A10D] = typeof(DcOption), - [0x232566AC] = typeof(Config), + [0xCC1A241E] = typeof(Config), [0x8E1A1775] = typeof(NearestDc), [0xCCBBCE30] = typeof(Help_AppUpdate), [0xC45A6536] = null,//Help_NoAppUpdate @@ -594,7 +593,7 @@ namespace TL [0x354A9B09] = typeof(BotInlineMessageMediaInvoice), [0x11965F3A] = typeof(BotInlineResult), [0x17DB940B] = typeof(BotInlineMediaResult), - [0x947CA848] = typeof(Messages_BotResults), + [0xE021F2F6] = typeof(Messages_BotResults), [0x5DAB1AF4] = typeof(ExportedMessageLink), [0x5F777DCE] = typeof(MessageFwdHeader), [0x3DBB5986] = typeof(Auth_SentCodeTypeApp), @@ -709,7 +708,7 @@ namespace TL [0x8AC32801] = typeof(InputPaymentCredentialsGooglePay), [0xDB64FD34] = typeof(Account_TmpPassword), [0xB6213CDF] = typeof(ShippingOption), - [0xFFA0A496] = typeof(InputStickerSetItem), + [0x32DA9E9C] = typeof(InputStickerSetItem), [0x1E36FDED] = typeof(InputPhoneCall), [0x5366C915] = typeof(PhoneCallEmpty), [0xC5226F17] = typeof(PhoneCallWaiting), @@ -977,7 +976,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0x3A836DF8] = typeof(SponsoredMessage), + [0xFC25B828] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1072,6 +1071,16 @@ namespace TL [0xC84834CE] = typeof(AutoSaveSettings), [0x81602D47] = typeof(AutoSaveException), [0x4C3E069D] = typeof(Account_AutoSaveSettings), + [0x7CDE641D] = null,//Help_AppConfigNotModified + [0xDD18782E] = typeof(Help_AppConfig), + [0xA920BD7A] = typeof(InputBotAppID), + [0x908C0407] = typeof(InputBotAppShortName), + [0x5DA674B7] = null,//BotAppNotModified + [0x95FCD1D6] = typeof(BotApp), + [0xEB50ADF5] = typeof(Messages_BotApp), + [0x3C1B4F0D] = typeof(AppWebViewResultUrl), + [0xB57295D5] = typeof(InlineBotWebView), + [0x4A4FF172] = typeof(ReadParticipantDate), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1190,6 +1199,8 @@ namespace TL // from TL.Secret: [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified + [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified + [typeof(BotApp)] = 0x5DA674B7, //botAppNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index f65b2bf..889d922 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: 152 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 154 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From b63829393e4acffe30eae21a5b083e914d9dd7d8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:32:57 +0100 Subject: [PATCH 049/336] Don't raise ReactorError for alt DCs --- .github/dev.yml | 2 +- src/Client.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e53e55a..d4810da 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.3.1-dev.$(Rev:r) +name: 3.3.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index edf2018..3bcfc31 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -347,7 +347,8 @@ namespace WTelegram } catch { - RaiseUpdate(reactorError); + if (IsMainDC) + RaiseUpdate(reactorError); lock (_pendingRpcs) // abort all pending requests { foreach (var rpc in _pendingRpcs.Values) From fd9177f8059de6748454da2a30d62a46b21b198c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 9 Mar 2023 22:41:07 +0100 Subject: [PATCH 050/336] API Layer 155: timestamp of reactions --- README.md | 2 +- src/TL.Schema.cs | 9 ++++++++- src/TL.Table.cs | 5 +++-- src/WTelegramClient.csproj | 2 +- 4 files changed, 13 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b80b190..d60fb32 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-154-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-155-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bd9cfd1..7e3fd02 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4449,6 +4449,12 @@ namespace TL /// See [TLDef(0xEC05B097)] public class UpdateAutoSaveSettings : Update { } + /// See + [TLDef(0xCCF08AD6)] + public class UpdateGroupInvitePrivacyForbidden : Update + { + public long user_id; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -13442,13 +13448,14 @@ namespace TL } /// How a certain peer reacted to the message See - [TLDef(0xB156FE9C)] + [TLDef(0x8C79B63C)] public class MessagePeerReaction : IObject { /// Flags, see TL conditional fields public Flags flags; /// Peer that reacted to the message public Peer peer_id; + public DateTime date; /// Reaction emoji public Reaction reaction; diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9cb6716..57e224f 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 = 154; // fetched 08/03/2023 19:08:02 + public const int Version = 155; // fetched 09/03/2023 20:45:49 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -369,6 +369,7 @@ namespace TL [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), + [0xCCF08AD6] = typeof(UpdateGroupInvitePrivacyForbidden), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -993,7 +994,7 @@ namespace TL [0xC077EC01] = typeof(AvailableReaction), [0x9F071957] = null,//Messages_AvailableReactionsNotModified [0x768E3AAD] = typeof(Messages_AvailableReactions), - [0xB156FE9C] = typeof(MessagePeerReaction), + [0x8C79B63C] = typeof(MessagePeerReaction), [0x80EB48AF] = typeof(GroupCallStreamChannel), [0xD0E482B2] = typeof(Phone_GroupCallStreamChannels), [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 889d922..68efad0 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: 154 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 155 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 2f3106fe693220676fdf8249fa0cc39bcd07fcd2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 16 Mar 2023 13:43:18 +0100 Subject: [PATCH 051/336] MainUsername property on IPeerInfo --- .github/FUNDING.yml | 3 +- .github/dev.yml | 2 +- EXAMPLES.md | 3 +- README.md | 4 +- src/TL.Helpers.cs | 10 ++- src/TL.Schema.cs | 68 +++++++++++++++--- src/TL.SchemaFuncs.cs | 160 +++++++++++++++++++++--------------------- src/TL.Table.cs | 2 +- 8 files changed, 153 insertions(+), 99 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index cf80d38..1accf5e 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1 +1,2 @@ -custom: ["http://t.me/WTelegramBot?start=donate"] +github: wiz0u +custom: ["https://www.buymeacoffee.com/wizou", "http://t.me/WTelegramBot?start=donate"] diff --git a/.github/dev.yml b/.github/dev.yml index d4810da..6b18a3e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.3.2-dev.$(Rev:r) +name: 3.3.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ae0f20e..4bb75c8 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -374,8 +374,9 @@ var chatInvite = await client.Messages_CheckChatInvite("HASH"); // optional: get await client.Messages_ImportChatInvite("HASH"); // join the channel/group // Note: This works also with HASH invite links from public channel/group ``` -Note: `CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite) +`CheckChatInvite` can return [3 different types of invitation object](https://corefork.telegram.org/type/ChatInvite) +You can also use helper methods `AnalyzeInviteLink` and `GetMessageByLink` to more easily fetch information from links. ## Add/Invite/Remove someone in a chat ```csharp diff --git a/README.md b/README.md index d60fb32..8a524db 100644 --- a/README.md +++ b/README.md @@ -1,7 +1,7 @@ [![API Layer](https://img.shields.io/badge/API_Layer-155-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) -[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](http://t.me/WTelegramBot?start=donate) +[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) ## _Telegram Client API library written 100% in C# and .NET_ @@ -195,4 +195,4 @@ as well as the [API Terms of Service](https://core.telegram.org/api/terms) or yo If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.github.io/WTelegramClient/FAQ), the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) -If you like this library, please [consider a donation](http://t.me/WTelegramBot?start=donate) ❤ This will help the project keep going. +If you like this library, you can [buy me a coffee](https://www.buymeacoffee.com/wizou) ❤ This will help the project keep going. diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 1acaff5..1b7b952 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -12,6 +12,7 @@ namespace TL { long ID { get; } bool IsActive { get; } + string MainUsername { get; } InputPeer ToInputPeer(); } @@ -142,6 +143,7 @@ namespace TL { public abstract long ID { get; } public abstract bool IsActive { get; } + public abstract string MainUsername { get; } public abstract InputPeer ToInputPeer(); protected abstract InputUser ToInputUser(); public static implicit operator InputPeer(UserBase user) => user?.ToInputPeer(); @@ -151,6 +153,7 @@ namespace TL { public override long ID => id; public override bool IsActive => false; + public override string MainUsername => null; public override string ToString() => null; public override InputPeer ToInputPeer() => null; protected override InputUser ToInputUser() => null; @@ -159,13 +162,13 @@ namespace TL { public override long ID => id; public override bool IsActive => (flags & Flags.deleted) == 0; - public bool IsBot => (flags & Flags.bot) != 0; - public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; + public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override string ToString() => MainUsername is string uname ? '@' + uname : last_name == null ? first_name : $"{first_name} {last_name}"; public override InputPeer ToInputPeer() => new InputPeerUser(id, access_hash); protected override InputUser ToInputUser() => new(id, access_hash); /// An estimation of the number of days ago the user was last seen (Online=0, Recently=1, LastWeek=5, LastMonth=20, LongTimeAgo=150) public TimeSpan LastSeenAgo => status?.LastSeenAgo ?? TimeSpan.FromDays(150); + public bool IsBot => (flags & Flags.bot) != 0; } /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) @@ -183,6 +186,7 @@ namespace TL { /// Is this chat among current user active chats? public abstract bool IsActive { get; } + public virtual string MainUsername => null; public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); @@ -216,7 +220,7 @@ namespace TL partial class Channel { public override bool IsActive => (flags & Flags.left) == 0; - public string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; + public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7e3fd02..c3c7207 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -118,13 +118,13 @@ namespace TL [TLDef(0xF392B7F4)] public class InputPhoneContact : InputContact { - /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. + /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; /// Phone number public string phone; - /// Contact's first name + /// Contact's first name public string first_name; - /// Contact's last name + /// Contact's last name public string last_name; } @@ -2059,6 +2059,7 @@ namespace TL [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { + /// Flags, see TL conditional fields public Flags flags; /// The domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; @@ -2133,6 +2134,7 @@ namespace TL [TLDef(0x3C134D7B)] public class MessageActionSetMessagesTTL : MessageAction { + /// Flags, see TL conditional fields public Flags flags; /// New Time-To-Live public int period; @@ -2192,6 +2194,7 @@ namespace TL [TLDef(0x0D999256)] public class MessageActionTopicCreate : MessageAction { + /// Flags, see TL conditional fields public Flags flags; public string title; public int icon_color; @@ -2199,6 +2202,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_emoji_id = 0x1, } } @@ -2206,6 +2210,7 @@ namespace TL [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public string title; [IfFlag(1)] public long icon_emoji_id; @@ -2214,9 +2219,13 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, + /// Field has a value has_icon_emoji_id = 0x2, + /// Field has a value has_closed = 0x4, + /// Field has a value has_hidden = 0x8, } } @@ -3190,7 +3199,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -3682,6 +3691,7 @@ namespace TL [TLDef(0x1B49EC6D)] public class UpdateDraftMessage : Update { + /// Flags, see TL conditional fields public Flags flags; /// The peer to which the draft is associated public Peer peer; @@ -3840,6 +3850,7 @@ namespace TL [TLDef(0xEA29055D)] public class UpdateChannelReadMessagesContents : Update { + /// Flags, see TL conditional fields public Flags flags; /// Channel/supergroup ID public long channel_id; @@ -4315,6 +4326,7 @@ namespace TL [TLDef(0x5E1B3CB8)] public class UpdateMessageReactions : Update { + /// Flags, see TL conditional fields public Flags flags; /// Peer public Peer peer; @@ -4418,6 +4430,7 @@ namespace TL [TLDef(0x192EFBE3)] public class UpdateChannelPinnedTopic : Update { + /// Flags, see TL conditional fields public Flags flags; public long channel_id; public int topic_id; @@ -4431,12 +4444,14 @@ namespace TL [TLDef(0xFE198602)] public class UpdateChannelPinnedTopics : Update { + /// Flags, see TL conditional fields public Flags flags; public long channel_id; [IfFlag(0)] public int[] order; [Flags] public enum Flags : uint { + /// Field has a value has_order = 0x1, } } @@ -7907,6 +7922,7 @@ namespace TL [TLDef(0xE57B1432)] public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public byte[] nonce; [IfFlag(1)] public string receipt; @@ -7914,7 +7930,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_nonce = 0x1, + /// Field has a value has_receipt = 0x2, } } @@ -10137,13 +10155,16 @@ namespace TL [TLDef(0x5D8D353B)] public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public ForumTopicBase prev_topic; [IfFlag(1)] public ForumTopicBase new_topic; [Flags] public enum Flags : uint { + /// Field has a value has_prev_topic = 0x1, + /// Field has a value has_new_topic = 0x2, } } @@ -13184,6 +13205,7 @@ namespace TL [TLDef(0xC9EE1D87)] public class Messages_SponsoredMessages : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public int posts_between; /// Sponsored messages @@ -13997,12 +14019,13 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class MessageExtendedMediaBase : IObject { } /// See [TLDef(0xAD628CC8)] public class MessageExtendedMediaPreview : MessageExtendedMediaBase { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public int w; [IfFlag(0)] public int h; @@ -14011,8 +14034,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_w = 0x1, + /// Field has a value has_thumb = 0x2, + /// Field has a value has_video_duration = 0x4, } } @@ -14035,6 +14061,7 @@ namespace TL [TLDef(0xB4073647)] public class Username : IObject { + /// Flags, see TL conditional fields public Flags flags; public string username; @@ -14045,7 +14072,7 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class ForumTopicBase : IObject { public virtual int ID { get; } @@ -14062,6 +14089,7 @@ namespace TL [TLDef(0x71701DA9)] public class ForumTopic : ForumTopicBase { + /// Flags, see TL conditional fields public Flags flags; public int id; public DateTime date; @@ -14080,10 +14108,12 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_emoji_id = 0x1, my = 0x2, closed = 0x4, pinned = 0x8, + /// Field has a value has_draft = 0x10, short_ = 0x20, hidden = 0x40, @@ -14096,6 +14126,7 @@ namespace TL [TLDef(0x367617D3)] public class Messages_ForumTopics : IObject, IPeerResolver { + /// Flags, see TL conditional fields public Flags flags; public int count; public ForumTopicBase[] topics; @@ -14127,19 +14158,22 @@ namespace TL public DateTime expires; } - /// See + /// See Derived classes: public abstract class RequestPeerType : IObject { } /// See [TLDef(0x5F3B8A00)] public class RequestPeerTypeUser : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(0)] public bool bot; [IfFlag(1)] public bool premium; [Flags] public enum Flags : uint { + /// Field has a value has_bot = 0x1, + /// Field has a value has_premium = 0x2, } } @@ -14147,6 +14181,7 @@ namespace TL [TLDef(0xC9F06E1B)] public class RequestPeerTypeChat : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(3)] public bool has_username; [IfFlag(4)] public bool forum; @@ -14156,9 +14191,13 @@ namespace TL [Flags] public enum Flags : uint { creator = 0x1, + /// Field has a value has_user_admin_rights = 0x2, + /// Field has a value has_bot_admin_rights = 0x4, + /// Field has a value has_has_username = 0x8, + /// Field has a value has_forum = 0x10, bot_participant = 0x20, } @@ -14167,6 +14206,7 @@ namespace TL [TLDef(0x339BEF6C)] public class RequestPeerTypeBroadcast : RequestPeerType { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(3)] public bool has_username; [IfFlag(1)] public ChatAdminRights user_admin_rights; @@ -14175,8 +14215,11 @@ namespace TL [Flags] public enum Flags : uint { creator = 0x1, + /// Field has a value has_user_admin_rights = 0x2, + /// Field has a value has_bot_admin_rights = 0x4, + /// Field has a value has_has_username = 0x8, } } @@ -14216,7 +14259,7 @@ namespace TL public MessageEntity[] entities; } - /// Translated text, or no result See Derived classes: , + /// Translated text, or no result See Derived classes: public abstract class Messages_TranslatedText : IObject { } /// See [TLDef(0x33DB32F8)] @@ -14229,6 +14272,7 @@ namespace TL [TLDef(0xC84834CE)] public class AutoSaveSettings : IObject { + /// Flags, see TL conditional fields public Flags flags; [IfFlag(2)] public long video_max_size; @@ -14236,6 +14280,7 @@ namespace TL { photos = 0x1, videos = 0x2, + /// Field has a value has_video_max_size = 0x4, } } @@ -14271,7 +14316,7 @@ namespace TL public JsonObject config; } - /// See + /// See Derived classes: public abstract class InputBotApp : IObject { } /// See [TLDef(0xA920BD7A)] @@ -14293,6 +14338,7 @@ namespace TL [TLDef(0x95FCD1D6)] public class BotApp : IObject { + /// Flags, see TL conditional fields public Flags flags; public long id; public long access_hash; @@ -14305,6 +14351,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_document = 0x1, } } @@ -14313,6 +14360,7 @@ namespace TL [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { + /// Flags, see TL conditional fields public Flags flags; public BotApp app; @@ -14323,7 +14371,7 @@ namespace TL } } - /// See + /// See Derived classes: public abstract class AppWebViewResult : IObject { } /// See [TLDef(0x3C1B4F0D)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ac8210d..fdaa088 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: 400,403 (details) + /// Invoke the specified query using the specified API layer See Possible codes: 400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -286,7 +286,7 @@ namespace TL code = code, }); - /// See + /// See [bots: ✓] public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) => client.Invoke(new Auth_ImportWebTokenAuthorization { @@ -295,7 +295,7 @@ namespace TL web_auth_token = web_auth_token, }); - /// See + /// See [bots: ✓] public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) => client.Invoke(new Auth_RequestFirebaseSms { @@ -921,7 +921,7 @@ namespace TL { }); - /// Get info about multiple wallpapers See + /// Get info about multiple wallpapers See Possible codes: 400 (details) /// Wallpapers to fetch info about public static Task Account_GetMultiWallPapers(this Client client, params InputWallPaperBase[] wallpapers) => client.Invoke(new Account_GetMultiWallPapers @@ -1062,14 +1062,14 @@ namespace TL { }); - /// See + /// See [bots: ✓] public static Task Account_ReorderUsernames(this Client client, params string[] order) => client.Invoke(new Account_ReorderUsernames { order = order, }); - /// See + /// See [bots: ✓] public static Task Account_ToggleUsername(this Client client, string username, bool active) => client.Invoke(new Account_ToggleUsername { @@ -1077,7 +1077,7 @@ namespace TL active = active, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1085,7 +1085,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1093,13 +1093,13 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Account_GetAutoSaveSettings(this Client client) => client.Invoke(new Account_GetAutoSaveSettings { }); - /// See + /// See [bots: ✓] public static Task Account_SaveAutoSaveSettings(this Client client, AutoSaveSettings settings, InputPeer peer = null, bool users = false, bool chats = false, bool broadcasts = false) => client.Invoke(new Account_SaveAutoSaveSettings { @@ -1108,7 +1108,7 @@ namespace TL settings = settings, }); - /// See + /// See [bots: ✓] public static Task Account_DeleteAutoSaveExceptions(this Client client) => client.Invoke(new Account_DeleteAutoSaveExceptions { @@ -1339,13 +1339,13 @@ namespace TL phone = phone, }); - /// See + /// See [bots: ✓] public static Task Contacts_ExportContactToken(this Client client) => client.Invoke(new Contacts_ExportContactToken { }); - /// See + /// See [bots: ✓] public static Task Contacts_ImportContactToken(this Client client, string token) => client.Invoke(new Contacts_ImportContactToken { @@ -1360,7 +1360,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400 (details) + /// Returns the current user dialog list. See Possible codes: 400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1380,7 +1380,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1402,7 +1402,7 @@ namespace TL hash = hash, }); - /// Returns found messages See Possible codes: 400 (details) + /// Returns found messages See Possible codes: 400,403 (details) /// User or chat, histories with which are searched, or for global search /// Text search request /// Only return messages sent by the specified user ID @@ -1480,7 +1480,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) /// Target user or group /// Thread ID /// Type of action @@ -1493,7 +1493,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1523,7 +1523,7 @@ namespace TL send_as = send_as, }); - /// Send a media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -1670,7 +1670,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,403,500 (details) + /// Creates a new chat. See Possible codes: 400,406,500 (details) /// List of user IDs to be invited /// Chat name public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) @@ -1888,7 +1888,7 @@ namespace TL hash = hash, }); - /// Install a stickerset See Possible codes: 400 (details) + /// Install a stickerset See Possible codes: 406 (details) /// Stickerset to install /// Whether to archive stickerset public static Task Messages_InstallStickerSet(this Client client, InputStickerSet stickerset, bool archived) @@ -1898,7 +1898,7 @@ namespace TL archived = archived, }); - /// Uninstall a stickerset See Possible codes: 400 (details) + /// Uninstall a stickerset See Possible codes: 406 (details) /// The stickerset to uninstall public static Task Messages_UninstallStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Messages_UninstallStickerSet @@ -1920,7 +1920,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2019,7 +2019,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: 400,-503 (details) + /// Query an inline bot See Possible codes: 400,406,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2092,7 +2092,7 @@ namespace TL id = id, }); - /// Edit message See [bots: ✓] Possible codes: 400,403 (details) + /// Edit message See [bots: ✓] Possible codes: 400,403,406 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -2164,7 +2164,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400 (details) + /// Get dialog info of specified peers See Possible codes: 400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -3112,7 +3112,7 @@ namespace TL limit = limit, }); - /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400 (details) + /// Dismiss or approve a chat join request related to a specific chat or channel. See [bots: ✓] Possible codes: 400,403 (details) /// Whether to dismiss or approve the chat join request » /// The chat or channel /// The user whose join request » should be dismissed or approved @@ -3136,7 +3136,7 @@ namespace TL link = link, }); - /// Enable or disable content protection on a channel or chat See + /// Enable or disable content protection on a channel or chat See Possible codes: 400 (details) /// The chat or channel /// Enable or disable content protection public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) @@ -3171,7 +3171,7 @@ namespace TL reaction = reaction, }); - /// Get message reactions » See + /// Get message reactions » See Possible codes: 400 (details) /// Peer /// Message IDs public static Task Messages_GetMessagesReactions(this Client client, InputPeer peer, params int[] id) @@ -3269,7 +3269,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), }); - /// View and search recently sent media.
This method does not support pagination. See
+ /// View and search recently sent media.
This method does not support pagination. See
Possible codes: 400 (details)
/// Optional search query /// Message filter /// Maximum number of results to return (max 100). @@ -3393,7 +3393,7 @@ namespace TL data = data, }); - /// Transcribe voice message See + /// Transcribe voice message See Possible codes: 400,403 (details) /// Peer ID where the voice message was sent /// Voice message ID public static Task Messages_TranscribeAudio(this Client client, InputPeer peer, int msg_id) @@ -3490,20 +3490,20 @@ namespace TL id = id, }); - /// See + /// See [bots: ✓] public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL { period = period, }); - /// See + /// See [bots: ✓] public static Task Messages_GetDefaultHistoryTTL(this Client client) => client.Invoke(new Messages_GetDefaultHistoryTTL { }); - /// See + /// See [bots: ✓] public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer) => client.Invoke(new Messages_SendBotRequestedPeer { @@ -3513,7 +3513,7 @@ namespace TL requested_peer = requested_peer, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3521,7 +3521,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3529,7 +3529,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3537,7 +3537,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -3546,7 +3546,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) => client.Invoke(new Messages_TogglePeerTranslations { @@ -3554,7 +3554,7 @@ namespace TL peer = peer, }); - /// See + /// See [bots: ✓] public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp { @@ -3562,7 +3562,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) => client.Invoke(new Messages_RequestAppWebView { @@ -3595,7 +3595,7 @@ namespace TL qts = qts, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -3656,7 +3656,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false) => client.Invoke(new Photos_UploadContactProfilePhoto { @@ -3834,7 +3834,7 @@ namespace TL { }); - /// Accept the new terms of service See + /// Accept the new terms of service See Possible codes: 400 (details) /// ID of terms of service public static Task Help_AcceptTermsOfService(this Client client, DataJSON id) => client.Invoke(new Help_AcceptTermsOfService @@ -3891,7 +3891,7 @@ namespace TL user_id = user_id, }); - /// Internal use See Possible codes: 400 (details) + /// Internal use See Possible codes: 400,403 (details) /// User /// Message /// Message entities for styled text @@ -3945,7 +3945,7 @@ namespace TL { }); - /// Mark channel/supergroup history as read See Possible codes: 400 (details) + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -3955,7 +3955,7 @@ namespace TL max_id = max_id, }); - /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) @@ -3977,7 +3977,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -3987,7 +3987,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -4004,7 +4004,7 @@ namespace TL hash = hash, }); - /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400 (details) + /// Get info about a channel/supergroup participant See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup /// Participant to get info about public static Task Channels_GetParticipant(this Client client, InputChannelBase channel, InputPeer participant) @@ -4014,7 +4014,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -4111,7 +4111,7 @@ namespace TL channel = channel, }); - /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403 (details) + /// Leave a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel/supergroup to leave public static Task Channels_LeaveChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_LeaveChannel @@ -4119,7 +4119,7 @@ namespace TL channel = channel, }); - /// Invite users to a channel/supergroup See Possible codes: 400,403 (details) + /// Invite users to a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel/supergroup /// Users to invite public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, params InputUserBase[] users) @@ -4169,7 +4169,7 @@ namespace TL flags = (Channels_GetAdminedPublicChannels.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), }); - /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403 (details) + /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) /// The supergroup/channel. /// Participant to ban /// The banned rights @@ -4181,7 +4181,7 @@ namespace TL banned_rights = banned_rights, }); - /// Get the admin log of a channel/supergroup See Possible codes: 400,403 (details) + /// Get the admin log of a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel /// Search query, can be empty /// Event filter @@ -4212,7 +4212,7 @@ namespace TL stickerset = stickerset, }); - /// Mark channel/supergroup message contents as read See Possible codes: 400 (details) + /// Mark channel/supergroup message contents as read See Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id) @@ -4363,7 +4363,7 @@ namespace TL enabled = enabled, }); - /// Set whether all users should request admin approval to join the group ». See + /// Set whether all users should request admin approval to join the group ». See Possible codes: 400 (details) /// Group /// Toggle public static Task Channels_ToggleJoinRequest(this Client client, InputChannelBase channel, bool enabled) @@ -4373,7 +4373,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) => client.Invoke(new Channels_ReorderUsernames { @@ -4381,7 +4381,7 @@ namespace TL order = order, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) => client.Invoke(new Channels_ToggleUsername { @@ -4390,14 +4390,14 @@ namespace TL active = active, }); - /// See + /// See [bots: ✓] public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) => client.Invoke(new Channels_DeactivateAllUsernames { channel = channel, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleForum { @@ -4405,7 +4405,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, long? icon_emoji_id = null, InputPeer send_as = null) => client.Invoke(new Channels_CreateForumTopic { @@ -4418,7 +4418,7 @@ namespace TL send_as = send_as, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) => client.Invoke(new Channels_GetForumTopics { @@ -4431,7 +4431,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) => client.Invoke(new Channels_GetForumTopicsByID { @@ -4439,7 +4439,7 @@ namespace TL topics = topics, }); - /// See + /// See [bots: ✓] public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) => client.Invoke(new Channels_EditForumTopic { @@ -4452,7 +4452,7 @@ namespace TL hidden = hidden.GetValueOrDefault(), }); - /// See + /// See [bots: ✓] public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) => client.Invoke(new Channels_UpdatePinnedForumTopic { @@ -4461,7 +4461,7 @@ namespace TL pinned = pinned, }); - /// See + /// See [bots: ✓] public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) => client.Invoke(new Channels_DeleteTopicHistory { @@ -4469,7 +4469,7 @@ namespace TL top_msg_id = top_msg_id, }); - /// See + /// See [bots: ✓] public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) => client.Invoke(new Channels_ReorderPinnedForumTopics { @@ -4478,7 +4478,7 @@ namespace TL order = order, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAntiSpam { @@ -4486,7 +4486,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) => client.Invoke(new Channels_ReportAntiSpamFalsePositive { @@ -4494,7 +4494,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleParticipantsHidden { @@ -4589,7 +4589,7 @@ namespace TL admin_rights = admin_rights, }); - /// See + /// See [bots: ✓] public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null) => client.Invoke(new Bots_SetBotInfo { @@ -4599,7 +4599,7 @@ namespace TL description = description, }); - /// See + /// See [bots: ✓] public static Task Bots_GetBotInfo(this Client client, string lang_code) => client.Invoke(new Bots_GetBotInfo { @@ -4760,7 +4760,7 @@ namespace TL position = position, }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) + /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400,406 (details) /// The stickerset /// The sticker /// a null value means messages.stickerSetNotModified @@ -4800,7 +4800,7 @@ namespace TL title = title, }); - /// See + /// See [bots: ✓] /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeSticker(this Client client, InputDocument sticker, string emoji = null, MaskCoords mask_coords = null, string keywords = null) => client.Invoke(new Stickers_ChangeSticker @@ -4812,7 +4812,7 @@ namespace TL keywords = keywords, }); - /// See + /// See [bots: ✓] /// a null value means messages.stickerSetNotModified public static Task Stickers_RenameStickerSet(this Client client, InputStickerSet stickerset, string title) => client.Invoke(new Stickers_RenameStickerSet @@ -4821,7 +4821,7 @@ namespace TL title = title, }); - /// See + /// See [bots: ✓] public static Task Stickers_DeleteStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Stickers_DeleteStickerSet { @@ -4987,7 +4987,7 @@ namespace TL users = users, }); - /// Terminate a group call See Possible codes: 400 (details) + /// Terminate a group call See Possible codes: 400,403 (details) /// The group call to terminate public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) => client.Invoke(new Phone_DiscardGroupCall @@ -5251,7 +5251,7 @@ namespace TL folder_id = folder_id, }); - /// Get channel statistics See Possible codes: 400 (details) + /// Get channel statistics See Possible codes: 400,403 (details) /// Whether to enable dark theme for graph colors /// The channel public static Task Stats_GetBroadcastStats(this Client client, InputChannelBase channel, bool dark = false) @@ -5272,7 +5272,7 @@ namespace TL x = x.GetValueOrDefault(), }); - /// Get supergroup statistics See Possible codes: 400 (details) + /// Get supergroup statistics See Possible codes: 400,403 (details) /// Whether to enable dark theme for graph colors /// Supergroup ID public static Task Stats_GetMegagroupStats(this Client client, InputChannelBase channel, bool dark = false) diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 57e224f..f2ee174 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 = 155; // fetched 09/03/2023 20:45:49 + public const int Version = 155; // fetched 13/03/2023 22:46:30 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; From b3075340782660c4468fea16beb9be81bc0b12cc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 24 Mar 2023 16:57:54 +0100 Subject: [PATCH 052/336] api doc --- FAQ.md | 3 +- README.md | 2 +- src/TL.Schema.cs | 45 ++++++----- src/TL.SchemaFuncs.cs | 179 +++++++++++++++++++++++++++++++----------- 4 files changed, 164 insertions(+), 65 deletions(-) diff --git a/FAQ.md b/FAQ.md index c879365..4ebb202 100644 --- a/FAQ.md +++ b/FAQ.md @@ -22,7 +22,8 @@ The WTelegram.session file contains the authentication keys negociated for the c You could switch the current user via an `Auth_Logout` followed by a `LoginUserIfNeeded` but that would require the user to sign in with a verification_code each time. -Instead, if you want to deal with multiple users from the same machine, the recommended solution is to have a different session file for each user. This can be done by having your Config callback reply with a different filename (or folder) for "**session_pathname**" for each user. +Instead, if you want to deal with multiple users from the same machine, the recommended solution is to have a different session file for each user. +This can be done by having your Config callback reply with a different filename (or folder) for "**session_pathname**" for each user. This way, you can keep separate session files (each with their authentication keys) for each user. If you need to manage these user accounts in parallel, you can create multiple instances of WTelegram.Client, diff --git a/README.md b/README.md index 8a524db..f68bee3 100644 --- a/README.md +++ b/README.md @@ -47,7 +47,7 @@ If you run this program again, you will notice that only **api_hash** is request This is because WTelegramClient saves (typically in the encrypted file **bin\WTelegram.session**) its state and the authentication keys that were negotiated with Telegram so that you needn't sign-in again every time. -That file path is configurable (**session_pathname**), and under various circumstances (changing user or server address) +That file path is configurable (**session_pathname**), and under various circumstances *(changing user or server address, write permissions)* you may want to change it or simply delete the existing session file in order to restart the authentification process. # Non-interactive configuration diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index c3c7207..6e1c9e3 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1880,7 +1880,7 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See @@ -2196,8 +2196,11 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Topic name. public string title; + /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. public int icon_color; + /// ID of the custom emoji used as topic icon. [IfFlag(0)] public long icon_emoji_id; [Flags] public enum Flags : uint @@ -2486,7 +2489,7 @@ namespace TL } } - /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: + /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , public abstract class Auth_SentCodeBase : IObject { } /// Contains info about a sent verification code. See [TLDef(0x5E002502)] @@ -2570,7 +2573,7 @@ namespace TL public byte[] bytes; } - /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , + /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , , public abstract class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] @@ -3199,7 +3202,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -4978,6 +4981,7 @@ namespace TL [IfFlag(2)] public int base_lang_pack_version; /// Default message reaction [IfFlag(15)] public Reaction reactions_default; + /// Autologin token, click here for more info on URL authorization ». [IfFlag(16)] public string autologin_token; [Flags] public enum Flags : uint @@ -5447,7 +5451,7 @@ namespace TL public UserBase user; } - /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , + /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , , public abstract class NotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] @@ -6283,7 +6287,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -6440,7 +6444,7 @@ namespace TL } } - /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , + /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , public abstract class KeyboardButtonBase : IObject { /// Button text @@ -7837,7 +7841,7 @@ namespace TL FragmentSms = 0x06ED998C, } - /// Type of the verification code that was sent See Derived classes: , , , , , , + /// Type of the verification code that was sent See Derived classes: , , , , , , , , public abstract class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] @@ -8225,7 +8229,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// Stickerset preview See Derived classes: , , + /// Stickerset preview See Derived classes: , , , public abstract class StickerSetCoveredBase : IObject { /// Stickerset @@ -9841,7 +9845,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -12332,7 +12336,7 @@ namespace TL public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } - /// Represents an animated video thumbnail See Derived classes: + /// Represents an animated video thumbnail See Derived classes: , , public abstract class VideoSizeBase : IObject { } /// Animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] @@ -14019,7 +14023,7 @@ namespace TL } } - /// See Derived classes: + /// See Derived classes: , public abstract class MessageExtendedMediaBase : IObject { } /// See [TLDef(0xAD628CC8)] @@ -14072,7 +14076,7 @@ namespace TL } } - /// See Derived classes: + /// See Derived classes: , public abstract class ForumTopicBase : IObject { public virtual int ID { get; } @@ -14094,7 +14098,9 @@ namespace TL public int id; public DateTime date; public string title; + /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. public int icon_color; + /// ID of the custom emoji used as topic icon. [IfFlag(0)] public long icon_emoji_id; public int top_message; public int read_inbox_max_id; @@ -14150,15 +14156,17 @@ namespace TL public int period; } - /// See + /// Describes a temporary profile link. See [TLDef(0x41BF109B)] public class ExportedContactToken : IObject { + /// The temporary profile link. public string url; + /// Its expiry date public DateTime expires; } - /// See Derived classes: + /// See Derived classes: , , public abstract class RequestPeerType : IObject { } /// See [TLDef(0x5F3B8A00)] @@ -14259,7 +14267,7 @@ namespace TL public MessageEntity[] entities; } - /// Translated text, or no result See Derived classes: + /// Translated text, or no result See Derived classes: public abstract class Messages_TranslatedText : IObject { } /// See [TLDef(0x33DB32F8)] @@ -14316,13 +14324,14 @@ namespace TL public JsonObject config; } - /// See Derived classes: + /// See Derived classes: , public abstract class InputBotApp : IObject { } /// See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { public long id; + /// REQUIRED FIELD. See how to obtain it
public long access_hash; } ///
See @@ -14371,7 +14380,7 @@ namespace TL } } - /// See Derived classes: + /// See Derived classes: public abstract class AppWebViewResult : IObject { } /// See [TLDef(0x3C1B4F0D)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index fdaa088..d3f26ae 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -286,7 +286,7 @@ namespace TL code = code, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) => client.Invoke(new Auth_ImportWebTokenAuthorization { @@ -295,7 +295,7 @@ namespace TL web_auth_token = web_auth_token, }); - /// See [bots: ✓] + /// See [bots: ✓] Possible codes: 400 (details) public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) => client.Invoke(new Auth_RequestFirebaseSms { @@ -978,7 +978,7 @@ namespace TL hash = hash, }); - /// Set time-to-live of current session See Possible codes: 406 (details) + /// Set time-to-live of current session See Possible codes: 400,406 (details) /// Time-to-live of current session in days public static Task Account_SetAuthorizationTTL(this Client client, int authorization_ttl_days) => client.Invoke(new Account_SetAuthorizationTTL @@ -1062,14 +1062,17 @@ namespace TL { }); - /// See [bots: ✓] + /// Reorder usernames associated with the currently logged-in user. See Possible codes: 400 (details) + /// The new order for active usernames. All active usernames must be specified. public static Task Account_ReorderUsernames(this Client client, params string[] order) => client.Invoke(new Account_ReorderUsernames { order = order, }); - /// See [bots: ✓] + /// Associate or dissociate a purchased fragment.com username to the currently logged-in user. See Possible codes: 400 (details) + /// Username + /// Whether to associate or dissociate it public static Task Account_ToggleUsername(this Client client, string username, bool active) => client.Invoke(new Account_ToggleUsername { @@ -1077,7 +1080,7 @@ namespace TL active = active, }); - /// See [bots: ✓] + /// See /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1085,7 +1088,7 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// See /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1093,13 +1096,18 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Get autosave settings See public static Task Account_GetAutoSaveSettings(this Client client) => client.Invoke(new Account_GetAutoSaveSettings { }); - /// See [bots: ✓] + /// Modify autosave settings See [bots: ✓] Possible codes: 400 (details) + /// Whether the new settings should affect all private chats + /// Whether the new settings should affect all groups + /// Whether the new settings should affect all channels + /// Whether the new settings should affect a specific peer + /// The new autosave settings public static Task Account_SaveAutoSaveSettings(this Client client, AutoSaveSettings settings, InputPeer peer = null, bool users = false, bool chats = false, bool broadcasts = false) => client.Invoke(new Account_SaveAutoSaveSettings { @@ -1108,13 +1116,13 @@ namespace TL settings = settings, }); - /// See [bots: ✓] + /// See public static Task Account_DeleteAutoSaveExceptions(this Client client) => client.Invoke(new Account_DeleteAutoSaveExceptions { }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,500 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1339,13 +1347,14 @@ namespace TL phone = phone, }); - /// See [bots: ✓] + /// Generates a temporary profile link for the currently logged-in user. See [bots: ✓] public static Task Contacts_ExportContactToken(this Client client) => client.Invoke(new Contacts_ExportContactToken { }); - /// See [bots: ✓] + /// Obtain user info from a temporary profile link. See [bots: ✓] Possible codes: 400 (details) + /// The token extracted from the temporary profile link. public static Task Contacts_ImportContactToken(this Client client, string token) => client.Invoke(new Contacts_ImportContactToken { @@ -1360,7 +1369,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400,403 (details) + /// Returns the current user dialog list. See Possible codes: 400,403,500 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1380,7 +1389,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406,500 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1502,6 +1511,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination where the message will be sent /// The message ID to which this message will reply to + /// If set, sends the message to the specified message thread/forum topic /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons @@ -1531,6 +1541,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// Destination /// Message ID to which this message should reply to + /// If set, sends the media to the specified message thread/forum topic /// Attached media /// Caption /// Random ID to avoid resending the same message You can use @@ -1565,6 +1576,7 @@ namespace TL /// IDs of messages /// Random ID to prevent resending of messages You can use /// Destination peer + /// Destination message thread/forum topic /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) @@ -1673,6 +1685,7 @@ namespace TL /// Creates a new chat. See Possible codes: 400,406,500 (details) /// List of user IDs to be invited /// Chat name + /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) => client.Invoke(new Messages_CreateChat { @@ -1861,7 +1874,7 @@ namespace TL title = title, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406,500 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2063,6 +2076,7 @@ namespace TL /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination /// ID of the message this message should reply to + /// If set, sends the message to the specified message thread/forum topic /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults @@ -2164,7 +2178,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400,406 (details) + /// Get dialog info of specified peers See Possible codes: 400,406,500 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2175,6 +2189,7 @@ namespace TL /// Save a message draft associated to a chat. See Possible codes: 400 (details) /// Disable generation of the webpage preview /// Message ID the message should reply to + /// Message thread/forum topic where the message will be sent /// Destination of the message that should be sent /// The draft /// Message entities for styled text @@ -2455,6 +2470,7 @@ namespace TL /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions + /// If set, considers only messages within the specified message thread/forum topic /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -2475,6 +2491,7 @@ namespace TL /// Mark mentions as read See Possible codes: 400 (details) /// Dialog + /// Mark as read only mentions within the specified message thread/forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadMentions { @@ -2503,6 +2520,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat /// The message to reply to + /// If set, sends the media to the specified message thread/forum topic /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer @@ -2670,6 +2688,7 @@ namespace TL /// Get the number of results that would be found by a Messages_Search call with the same parameters See Possible codes: 400 (details) /// Peer where to search + /// If set, consider only messages within the specified message thread/forum topic /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) => client.Invoke(new Messages_GetSearchCounters @@ -2881,6 +2900,7 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin + /// Message thread/forum topic where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_UnpinAllMessages { @@ -3026,7 +3046,7 @@ namespace TL peer = peer, }); - /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403 (details) + /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403,500 (details) /// If set, only returns info about users with pending join requests » /// Chat /// Invite link @@ -3227,6 +3247,7 @@ namespace TL /// Translate a given text See Possible codes: 400 (details) /// If the text is a chat message, the peer ID + /// A list of message IDs to translate /// The text to translate /// Two-letter ISO 639-1 language code of the language to which the message is translated public static Task Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int[] id = null, TextWithEntities[] text = null) @@ -3241,6 +3262,7 @@ namespace TL /// Get unread reactions to messages you sent See /// Peer + /// If set, considers only reactions to messages within the specified message thread/forum topic /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3261,6 +3283,7 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer + /// Mark as read only reactions to messages within the specified message thread/forum topic public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadReactions { @@ -3319,6 +3342,7 @@ namespace TL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. + /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified message thread/forum topic /// Open the web app as the specified peer, sending the resulting the message as the specified peer. public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => client.Invoke(new Messages_RequestWebView @@ -3341,6 +3365,7 @@ namespace TL /// Bot that owns the web app /// Web app interaction ID obtained from Messages_RequestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. + /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified message thread/forum topic. /// Open the web app as the specified peer public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView @@ -3537,7 +3562,9 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Look for custom emojis associated to a UTF8 emoji See [bots: ✓] Possible codes: 400 (details) + /// The emoji + /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -3546,7 +3573,9 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Toggle real-time chat translation for a certain chat See [bots: ✓] + /// Whether to disable or enable real-time chat translation + /// Peer where to enable or disable real-time chat translation public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) => client.Invoke(new Messages_TogglePeerTranslations { @@ -3554,7 +3583,7 @@ namespace TL peer = peer, }); - /// See [bots: ✓] + /// See [bots: ✓] Possible codes: 400 (details) public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp { @@ -3621,7 +3650,7 @@ namespace TL }); /// Updates current user profile photo. See Possible codes: 400 (details) - /// File saved in parts by means of Upload_SaveFilePart method + /// Profile photo /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool fallback = false) @@ -3656,7 +3685,10 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See [bots: ✓] Possible codes: 400 (details) + /// Profile photo + /// Animated profile picture video + /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false) => client.Invoke(new Photos_UploadContactProfilePhoto { @@ -3852,6 +3884,7 @@ namespace TL }); /// Get app-specific configuration, see client configuration for more info on the result. See + /// Hash for pagination, for more info click here /// a null value means help.appConfigNotModified public static Task Help_GetAppConfig(this Client client, int hash = default) => client.Invoke(new Help_GetAppConfig @@ -3977,7 +4010,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406,500 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -4022,7 +4055,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406,500 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -4034,10 +4067,12 @@ namespace TL /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport + /// Whether to create a forum /// Channel title /// Channel description /// Geogroup location /// Geogroup address + /// Time-to-live of all messages that will be sent in the supergroup: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. public static Task Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false, bool forum = false) => client.Invoke(new Channels_CreateChannel { @@ -4103,7 +4138,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406 (details) + /// Join a channel/supergroup See Possible codes: 400,406,500 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -4373,7 +4408,9 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] + /// Reorder active usernames See [bots: ✓] Possible codes: 400 (details) + /// The supergroup or channel + /// The new order for active usernames. All active usernames must be specified. public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) => client.Invoke(new Channels_ReorderUsernames { @@ -4381,7 +4418,10 @@ namespace TL order = order, }); - /// See [bots: ✓] + /// Associate or dissociate a purchased fragment.com username to a supergroup or channel. See [bots: ✓] + /// Supergroup or channel + /// Username + /// Whether to associate or dissociate the username public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) => client.Invoke(new Channels_ToggleUsername { @@ -4390,14 +4430,17 @@ namespace TL active = active, }); - /// See [bots: ✓] + /// Disable all purchased usernames of a supergroup or channel See [bots: ✓] + /// Supergroup or channel public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) => client.Invoke(new Channels_DeactivateAllUsernames { channel = channel, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Enable or disable forum functionality in a supergroup. See [bots: ✓] Possible codes: 400 (details) + /// Supergroup ID + /// Enable or disable forum functionality public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleForum { @@ -4405,7 +4448,13 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] + /// Create a forum topic. See [bots: ✓] Possible codes: 400 (details) + /// The forum + /// Topic title + /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. + /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. + /// Unique client message ID to prevent duplicate sending of the same event You can use + /// Create the topic as the specified peer public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, long? icon_emoji_id = null, InputPeer send_as = null) => client.Invoke(new Channels_CreateForumTopic { @@ -4418,7 +4467,13 @@ namespace TL send_as = send_as, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Get topics of a forum See [bots: ✓] Possible codes: 400 (details) + /// Supergroup + /// Search query + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) => client.Invoke(new Channels_GetForumTopics { @@ -4431,7 +4486,9 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// Get forum topics by their ID See [bots: ✓] + /// Forum + /// Topic IDs public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) => client.Invoke(new Channels_GetForumTopicsByID { @@ -4439,7 +4496,13 @@ namespace TL topics = topics, }); - /// See [bots: ✓] + /// Edit forum topic See [bots: ✓] + /// Supergroup + /// Topic ID + /// If present, will update the topic title. + /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. + /// If present, will update the open/closed status of the topic. + /// If present, will hide/unhide the topic. public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) => client.Invoke(new Channels_EditForumTopic { @@ -4452,7 +4515,10 @@ namespace TL hidden = hidden.GetValueOrDefault(), }); - /// See [bots: ✓] + /// Pin or unpin forum topics See [bots: ✓] + /// Supergroup ID + /// Forum topic ID + /// Whether to pin or unpin the topic public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) => client.Invoke(new Channels_UpdatePinnedForumTopic { @@ -4461,7 +4527,9 @@ namespace TL pinned = pinned, }); - /// See [bots: ✓] + /// Delete message history of a forum topic See [bots: ✓] + /// Forum + /// Topic ID public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) => client.Invoke(new Channels_DeleteTopicHistory { @@ -4469,7 +4537,10 @@ namespace TL top_msg_id = top_msg_id, }); - /// See [bots: ✓] + /// Reorder pinned forum topics See [bots: ✓] + /// If set, topics pinned server-side but not present in the order field will be unpinned. + /// Supergroup ID + /// Topic IDs » public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) => client.Invoke(new Channels_ReorderPinnedForumTopics { @@ -4478,7 +4549,9 @@ namespace TL order = order, }); - /// See [bots: ✓] + /// Enable or disable the native antispam system. See [bots: ✓] + /// Supergroup ID + /// Enable or disable the native antispam system. public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAntiSpam { @@ -4486,7 +4559,9 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] + /// Report a native antispam false positive See [bots: ✓] + /// Supergroup ID + /// Message ID that was mistakenly deleted by the native antispam system, taken from the admin log public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) => client.Invoke(new Channels_ReportAntiSpamFalsePositive { @@ -4494,7 +4569,9 @@ namespace TL msg_id = msg_id, }); - /// See [bots: ✓] + /// Hide or display the participants list in a supergroup See [bots: ✓] + /// Supergroup ID + /// If true, will hide the participants list; otherwise will unhide it. public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleParticipantsHidden { @@ -4589,7 +4666,10 @@ namespace TL admin_rights = admin_rights, }); - /// See [bots: ✓] + /// Set our about text and description (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Language code, if left empty update the fallback about text and description + /// New about text + /// New description public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null) => client.Invoke(new Bots_SetBotInfo { @@ -4599,7 +4679,8 @@ namespace TL description = description, }); - /// See [bots: ✓] + /// Get our about text and description (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Language code, if left empty this method will return the fallback about text and description. public static Task Bots_GetBotInfo(this Client client, string lang_code) => client.Invoke(new Bots_GetBotInfo { @@ -4721,6 +4802,7 @@ namespace TL /// Whether this is a mask stickerset /// Whether this is an animated stickerset /// Whether this is a video stickerset + /// Whether this is a custom emoji stickerset. /// Stickerset owner /// Stickerset name, 1-64 chars /// Short name of sticker set, to be used in sticker deep links ». Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and, if called by a bot, must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters. @@ -4800,7 +4882,11 @@ namespace TL title = title, }); - /// See [bots: ✓] + /// Update the keywords, emojis or mask coordinates of a sticker See [bots: ✓] Possible codes: 400 (details) + /// The sticker + /// If set, updates the emoji list associated to the sticker + /// If set, updates the mask coordinates + /// If set, updates the sticker keywords (separated by commas). /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeSticker(this Client client, InputDocument sticker, string emoji = null, MaskCoords mask_coords = null, string keywords = null) => client.Invoke(new Stickers_ChangeSticker @@ -4812,7 +4898,9 @@ namespace TL keywords = keywords, }); - /// See [bots: ✓] + /// Renames a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Stickerset to rename + /// New stickerset title /// a null value means messages.stickerSetNotModified public static Task Stickers_RenameStickerSet(this Client client, InputStickerSet stickerset, string title) => client.Invoke(new Stickers_RenameStickerSet @@ -4821,7 +4909,8 @@ namespace TL title = title, }); - /// See [bots: ✓] + /// Deletes a stickerset we created, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Stickerset to delete public static Task Stickers_DeleteStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Stickers_DeleteStickerSet { From 81870b2de1f55dc8b76bdcf06437095de4cc4162 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 26 Mar 2023 17:59:15 +0200 Subject: [PATCH 053/336] API Layer 156: some email login stuff --- README.md | 2 +- src/TL.Schema.cs | 25 ++++++++++++---- src/TL.SchemaFuncs.cs | 59 ++++++++++++++++++++++++++------------ src/TL.Table.cs | 4 +-- src/WTelegramClient.csproj | 2 +- 5 files changed, 63 insertions(+), 29 deletions(-) diff --git a/README.md b/README.md index f68bee3..ac00bd1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-155-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-156-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6e1c9e3..a86dd6f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -7879,7 +7879,7 @@ namespace TL public string prefix; } /// The code was sent via the previously configured login email » See - [TLDef(0x5A159841)] + [TLDef(0xF450F59B)] public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType { /// Flags, see TL conditional fields @@ -7888,8 +7888,8 @@ namespace TL public string email_pattern; /// Length of the sent verification code public int length; - /// If set, contains an absolute UNIX timestamp indicating when will the user be able to authorize with a code sent to the user's phone number - [IfFlag(2)] public DateTime next_phone_login_date; + [IfFlag(3)] public int reset_available_period; + [IfFlag(4)] public DateTime reset_pending_date; [Flags] public enum Flags : uint { @@ -7897,8 +7897,10 @@ namespace TL apple_signin_allowed = 0x1, /// Whether authorization through Google ID is allowed google_signin_allowed = 0x2, - /// Field has a value - has_next_phone_login_date = 0x4, + /// Field has a value + has_reset_available_period = 0x8, + /// Field has a value + has_reset_pending_date = 0x10, } } /// The user should add and verify an email address in order to login as described here ». See @@ -11421,6 +11423,7 @@ namespace TL manage_call = 0x800, /// Set this flag if none of the other flags are set, but you still want the user to be an admin: if this or any of the other flags are set, the admin can get the chat admin log, get chat statistics, get message statistics in channels, get channel members, see anonymous administrators in supergroups and ignore slow mode. other = 0x1000, + /// If set, allows the admin to create, delete or modify forum topics ». manage_topics = 0x2000, } } @@ -11448,7 +11451,7 @@ namespace TL send_gifs = 0x10, /// If set, does not allow a user to send games in a supergroup/chat send_games = 0x20, - /// If set, does not allow a user to use inline bots in a supergroup/chat + /// If set, does not allow a user to use inline bots in a supergroup/chat. send_inline = 0x40, /// If set, does not allow a user to embed links in the messages of a supergroup/chat embed_links = 0x80, @@ -11460,13 +11463,21 @@ namespace TL invite_users = 0x8000, /// If set, does not allow any user to pin messages in a supergroup/chat pin_messages = 0x20000, + /// If set, does not allow any user to create, delete or modify forum topics ». manage_topics = 0x40000, + /// If set, does not allow a user to send photos in a supergroup/chat. send_photos = 0x80000, + /// If set, does not allow a user to send videos in a supergroup/chat. send_videos = 0x100000, + /// If set, does not allow a user to send round videos in a supergroup/chat. send_roundvideos = 0x200000, + /// If set, does not allow a user to send audio files in a supergroup/chat. send_audios = 0x400000, + /// If set, does not allow a user to send voice messages in a supergroup/chat. send_voices = 0x800000, + /// If set, does not allow a user to send documents in a supergroup/chat. send_docs = 0x1000000, + /// If set, does not allow a user to send text messages in a supergroup/chat. send_plain = 0x2000000, } } @@ -12617,7 +12628,9 @@ namespace TL has_reply_to_peer_id = 0x1, /// Field has a value has_reply_to_top_id = 0x2, + /// This is a reply to a scheduled message. reply_to_scheduled = 0x4, + /// Whether this message was sent in a forum topic (except for the General topic). forum_topic = 0x8, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index d3f26ae..9c343e8 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -306,6 +306,14 @@ namespace TL ios_push_secret = ios_push_secret, }); + /// See + public static Task Auth_ResetLoginEmail(this Client client, string phone_number, string phone_code_hash) + => client.Invoke(new Auth_ResetLoginEmail + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1511,7 +1519,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination where the message will be sent /// The message ID to which this message will reply to - /// If set, sends the message to the specified message thread/forum topic + /// If set, sends the message to the specified forum topic /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons @@ -1541,7 +1549,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// Destination /// Message ID to which this message should reply to - /// If set, sends the media to the specified message thread/forum topic + /// If set, sends the media to the specified forum topic /// Attached media /// Caption /// Random ID to avoid resending the same message You can use @@ -1576,7 +1584,7 @@ namespace TL /// IDs of messages /// Random ID to prevent resending of messages You can use /// Destination peer - /// Destination message thread/forum topic + /// Destination forum topic /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) @@ -2076,7 +2084,7 @@ namespace TL /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination /// ID of the message this message should reply to - /// If set, sends the message to the specified message thread/forum topic + /// If set, sends the message to the specified forum topic /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults @@ -2189,7 +2197,7 @@ namespace TL /// Save a message draft associated to a chat. See Possible codes: 400 (details) /// Disable generation of the webpage preview /// Message ID the message should reply to - /// Message thread/forum topic where the message will be sent + /// Forum topic where the message will be sent /// Destination of the message that should be sent /// The draft /// Message entities for styled text @@ -2470,7 +2478,7 @@ namespace TL /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions - /// If set, considers only messages within the specified message thread/forum topic + /// If set, considers only messages within the specified forum topic /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -2491,7 +2499,7 @@ namespace TL /// Mark mentions as read See Possible codes: 400 (details) /// Dialog - /// Mark as read only mentions within the specified message thread/forum topic + /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadMentions { @@ -2520,7 +2528,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat /// The message to reply to - /// If set, sends the media to the specified message thread/forum topic + /// If set, sends the media to the specified forum topic /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer @@ -2688,7 +2696,7 @@ namespace TL /// Get the number of results that would be found by a Messages_Search call with the same parameters See Possible codes: 400 (details) /// Peer where to search - /// If set, consider only messages within the specified message thread/forum topic + /// If set, consider only messages within the specified forum topic /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) => client.Invoke(new Messages_GetSearchCounters @@ -2900,7 +2908,7 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin - /// Message thread/forum topic where to unpin + /// Forum topic where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_UnpinAllMessages { @@ -3262,7 +3270,7 @@ namespace TL /// Get unread reactions to messages you sent See /// Peer - /// If set, considers only reactions to messages within the specified message thread/forum topic + /// If set, considers only reactions to messages within the specified forum topic /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3283,7 +3291,7 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer - /// Mark as read only reactions to messages within the specified message thread/forum topic + /// Mark as read only reactions to messages within the specified forum topic public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) => client.Invoke(new Messages_ReadReactions { @@ -3342,7 +3350,7 @@ namespace TL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified message thread/forum topic + /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified forum topic /// Open the web app as the specified peer, sending the resulting the message as the specified peer. public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => client.Invoke(new Messages_RequestWebView @@ -3365,7 +3373,7 @@ namespace TL /// Bot that owns the web app /// Web app interaction ID obtained from Messages_RequestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified message thread/forum topic. + /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified forum topic. /// Open the web app as the specified peer public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView @@ -3591,7 +3599,13 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Open a bot web app from a bot web app deep link, sending over user information after user confirmation. See [bots: ✓] + /// Set this flag if the bot is asking permission to send messages to the user as specified in the bot web app deep link docs, and the user agreed. + /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. + /// The app obtained by invoking Messages_GetBotApp as specified in the bot web app deep link docs. + /// If the startapp query string parameter is present in the bot web app deep link, pass it to start_param. + /// Theme parameters » + /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) => client.Invoke(new Messages_RequestAppWebView { @@ -4448,9 +4462,9 @@ namespace TL enabled = enabled, }); - /// Create a forum topic. See [bots: ✓] Possible codes: 400 (details) + /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400 (details) /// The forum - /// Topic title + /// Topic title (maximum UTF-8 length: 128) /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. /// Unique client message ID to prevent duplicate sending of the same event You can use @@ -4496,10 +4510,10 @@ namespace TL topics = topics, }); - /// Edit forum topic See [bots: ✓] + /// Edit forum topic; requires manage_topics rights. See [bots: ✓] /// Supergroup /// Topic ID - /// If present, will update the topic title. + /// If present, will update the topic title (maximum UTF-8 length: 128). /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. /// If present, will update the open/closed status of the topic. /// If present, will hide/unhide the topic. @@ -5631,6 +5645,13 @@ namespace TL.Methods } } + [TLDef(0x7E960193)] + public class Auth_ResetLoginEmail : IMethod + { + public string phone_number; + public string phone_code_hash; + } + [TLDef(0xEC86017A)] public class Account_RegisterDevice : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f2ee174..9f5eb29 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 = 155; // fetched 13/03/2023 22:46:30 + public const int Version = 156; // fetched 26/03/2023 15:54:09 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -602,7 +602,7 @@ namespace TL [0x5353E5A7] = typeof(Auth_SentCodeTypeCall), [0xAB03C6D9] = typeof(Auth_SentCodeTypeFlashCall), [0x82006484] = typeof(Auth_SentCodeTypeMissedCall), - [0x5A159841] = typeof(Auth_SentCodeTypeEmailCode), + [0xF450F59B] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), [0xE57B1432] = typeof(Auth_SentCodeTypeFirebaseSms), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 68efad0..49d8aeb 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: 155 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 156 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 621a88bb9f56d26e15cd314b890c056c8cf7f2f6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 2 Apr 2023 00:06:26 +0200 Subject: [PATCH 054/336] Fix `cache_time` type --- .github/dev.yml | 2 +- src/TL.Schema.cs | 225 +++++++++++++++++++++++++++++++++--------- src/TL.SchemaFuncs.cs | 33 ++++--- src/TL.Table.cs | 2 +- 4 files changed, 199 insertions(+), 63 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 6b18a3e..5412eb9 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.3.3-dev.$(Rev:r) +name: 3.3.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a86dd6f..81038fe 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -199,6 +199,7 @@ namespace TL has_stickers = 0x1, /// Field has a value has_ttl_seconds = 0x2, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x4, } } @@ -217,6 +218,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x2, } } @@ -271,6 +273,7 @@ namespace TL nosound_video = 0x8, /// Force the media file to be uploaded as document force_file = 0x10, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x20, } } @@ -293,6 +296,7 @@ namespace TL has_ttl_seconds = 0x1, /// Field has a value has_query = 0x2, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x4, } } @@ -328,6 +332,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x2, } } @@ -346,6 +351,7 @@ namespace TL { /// Field has a value has_ttl_seconds = 0x1, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x2, } } @@ -712,6 +718,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Flags, see TL conditional fields public Flags2 flags2; /// ID of the user public long id; @@ -739,6 +746,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; + /// Additional usernames [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint @@ -949,6 +957,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Flags, see TL conditional fields public Flags2 flags2; /// ID of the channel public long id; @@ -972,6 +981,7 @@ namespace TL [IfFlag(18)] public ChatBannedRights default_banned_rights; /// Participant count [IfFlag(17)] public int participants_count; + /// Additional usernames [IfFlag(32)] public Username[] usernames; [Flags] public enum Flags : uint @@ -1026,6 +1036,7 @@ namespace TL join_to_send = 0x10000000, /// Whether a user's join request will have to be approved by administrators, toggle using Channels_ToggleJoinRequest join_request = 0x20000000, + /// Whether this supergroup is a forum forum = 0x40000000, } @@ -1172,6 +1183,7 @@ namespace TL has_requests_pending = 0x20000, /// Field has a value has_available_reactions = 0x40000, + /// Whether real-time chat translation is disabled. translations_disabled = 0x80000, } @@ -1355,8 +1367,11 @@ namespace TL { /// Can we delete this channel? can_delete_channel = 0x1, + /// Whether native antispam functionality is enabled in this supergroup. antispam = 0x2, + /// Whether the participant list is hidden. participants_hidden = 0x4, + /// Whether real-time chat translation is disabled. translations_disabled = 0x8, } @@ -1721,6 +1736,7 @@ namespace TL has_photo = 0x1, /// Field has a value has_ttl_seconds = 0x4, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x8, } } @@ -1768,6 +1784,7 @@ namespace TL has_ttl_seconds = 0x4, /// Whether this is a normal sticker, if not set this is a premium sticker and a premium sticker animation must be played. nopremium = 0x8, + /// Whether this media should be hidden behind a spoiler warning spoiler = 0x10, } } @@ -2190,7 +2207,7 @@ namespace TL /// Duration of the gifted Telegram Premium subscription public int months; } - /// See + /// A forum topic was created. See [TLDef(0x0D999256)] public class MessageActionTopicCreate : MessageAction { @@ -2209,15 +2226,19 @@ namespace TL has_icon_emoji_id = 0x1, } } - /// See + /// Forum topic information was edited. See [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { /// Flags, see TL conditional fields public Flags flags; + /// Topic title. [IfFlag(0)] public string title; + /// ID of the custom emoji used as topic icon. [IfFlag(1)] public long icon_emoji_id; + /// Whether the topic was closed. [IfFlag(2)] public bool closed; + /// Whether the topic was hidden. [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint @@ -2238,11 +2259,13 @@ namespace TL { public PhotoBase photo; } - /// See + /// Contains info about a peer that the user shared with the bot after clicking on a button. See [TLDef(0xFE77345D)] public class MessageActionRequestedPeer : MessageAction { + /// button_id contained in the public int button_id; + /// The shared peer public Peer peer; } @@ -2278,10 +2301,11 @@ namespace TL public PeerNotifySettings notify_settings; /// PTS [IfFlag(0)] public int pts; - /// Message draft + /// Message draft [IfFlag(1)] public DraftMessageBase draft; /// Peer folder ID, for more info click here [IfFlag(4)] public int folder_id; + /// Time-to-live of all messages sent in this dialog [IfFlag(5)] public int ttl_period; [Flags] public enum Flags : uint @@ -2533,6 +2557,7 @@ namespace TL [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; + /// A future auth token [IfFlag(2)] public byte[] future_auth_token; /// Info on authorized user public UserBase user; @@ -2591,11 +2616,13 @@ namespace TL /// All channels See [TLDef(0xB1DB7C7E)] public class InputNotifyBroadcasts : InputNotifyPeerBase { } - /// See + /// Notifications generated by a topic in a forum. See [TLDef(0x5C467992)] public class InputNotifyForumTopic : InputNotifyPeerBase { + /// Forum ID public InputPeer peer; + /// Topic ID public int top_msg_id; } @@ -3070,6 +3097,7 @@ namespace TL [IfFlag(2)] public int offset_id_offset; /// Found messages public MessageBase[] messages; + /// Forum topic information public ForumTopicBase[] topics; /// Chats public Dictionary chats; @@ -3273,6 +3301,7 @@ namespace TL public string first_name; /// New last name. Corresponds to the new value of real_last_name field of the . public string last_name; + /// Usernames. public Username[] usernames; } /// New encrypted message. See @@ -3698,6 +3727,7 @@ namespace TL public Flags flags; /// The peer to which the draft is associated public Peer peer; + /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; /// The draft public DraftMessageBase draft; @@ -3857,6 +3887,7 @@ namespace TL public Flags flags; /// Channel/supergroup ID public long channel_id; + /// Forum topic ID. [IfFlag(0)] public int top_msg_id; /// IDs of messages that were read public int[] messages; @@ -4335,6 +4366,7 @@ namespace TL public Peer peer; /// Message ID public int msg_id; + /// Forum topic ID [IfFlag(0)] public int top_msg_id; /// Reactions public MessageReactions reactions; @@ -4429,27 +4461,32 @@ namespace TL public int msg_id; public MessageExtendedMediaBase extended_media; } - /// See + /// A forum topic » was pinned or unpinned. See [TLDef(0x192EFBE3)] public class UpdateChannelPinnedTopic : Update { /// Flags, see TL conditional fields public Flags flags; + /// The forum ID public long channel_id; + /// The topic ID public int topic_id; [Flags] public enum Flags : uint { + /// Whether the topic was pinned or unpinned pinned = 0x1, } } - /// See + /// The pinned topics of a forum have changed. See [TLDef(0xFE198602)] public class UpdateChannelPinnedTopics : Update { /// Flags, see TL conditional fields public Flags flags; + /// Forum ID. public long channel_id; + /// Ordered list containing the IDs of all pinned topics. [IfFlag(0)] public int[] order; [Flags] public enum Flags : uint @@ -4464,7 +4501,7 @@ namespace TL { public long user_id; } - /// See + /// Media autosave settings have changed and must be refetched using Account_GetAutoSaveSettings. See [TLDef(0xEC05B097)] public class UpdateAutoSaveSettings : Update { } /// See @@ -5469,11 +5506,13 @@ namespace TL /// Channel notification settings See [TLDef(0xD612E8EF)] public class NotifyBroadcasts : NotifyPeerBase { } - /// See + /// Notifications generated by a topic in a forum. See [TLDef(0x226E6308)] public class NotifyForumTopic : NotifyPeerBase { + /// Forum ID public Peer peer; + /// Topic ID public int top_msg_id; } @@ -6328,7 +6367,7 @@ namespace TL /// Default custom emoji status stickerset See [TLDef(0x29D0F5EE)] public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } - /// See + /// Default custom emoji stickerset for forum topic icons See [TLDef(0x44C1F8E9)] public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } @@ -6623,11 +6662,13 @@ namespace TL public class KeyboardButtonSimpleWebView : KeyboardButtonWebView { } - /// See + /// Prompts the user to select and share a peer with the bot using Messages_SendBotRequestedPeer See [TLDef(0x0D0B468C, inheritBefore = true)] public class KeyboardButtonRequestPeer : KeyboardButton { + /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; + /// Filtering criteria to use for the peer selection list shown to the user. public RequestPeerType peer_type; } @@ -7757,7 +7798,7 @@ namespace TL /// The results public BotInlineResultBase[] results; /// Caching validity of the results - public DateTime cache_time; + public int cache_time; /// Users mentioned in the results public Dictionary users; @@ -7837,7 +7878,7 @@ namespace TL FlashCall = 0x226CCEFB, ///The next time, the authentication code will be delivered via an immediately canceled incoming call, handled manually by the user. MissedCall = 0xD61AD6EE, - ///See + ///The next time, the authentication code will be delivered via fragment.com FragmentSms = 0x06ED998C, } @@ -7954,7 +7995,7 @@ namespace TL /// URL to open [IfFlag(2)] public string url; /// For how long should this answer be cached - public DateTime cache_time; + public int cache_time; [Flags] public enum Flags : uint { @@ -9334,6 +9375,7 @@ namespace TL public string emoji; /// Coordinates for mask sticker [IfFlag(0)] public MaskCoords mask_coords; + /// Set of keywords, separated by commas [IfFlag(1)] public string keywords; [Flags] public enum Flags : uint @@ -10125,45 +10167,54 @@ namespace TL /// New allowed reaction emojis public ChatReactions new_value; } - /// See + /// The list of usernames associated with the channel was changed See [TLDef(0xF04FB3A9)] public class ChannelAdminLogEventActionChangeUsernames : ChannelAdminLogEventAction { + /// Previous set of usernames public string[] prev_value; + /// New set of usernames public string[] new_value; } - /// See + /// Forum functionality was enabled or disabled. See [TLDef(0x02CC6383)] public class ChannelAdminLogEventActionToggleForum : ChannelAdminLogEventAction { + /// Whether forum functionality was enabled or disabled. public bool new_value; } - /// See + /// A forum topic was created See [TLDef(0x58707D28)] public class ChannelAdminLogEventActionCreateTopic : ChannelAdminLogEventAction { + /// The forum topic that was created public ForumTopicBase topic; } - /// See + /// A forum topic was edited See [TLDef(0xF06FE208)] public class ChannelAdminLogEventActionEditTopic : ChannelAdminLogEventAction { + /// Previous topic information public ForumTopicBase prev_topic; + /// New topic information public ForumTopicBase new_topic; } - /// See + /// A forum topic was deleted See [TLDef(0xAE168909)] public class ChannelAdminLogEventActionDeleteTopic : ChannelAdminLogEventAction { + /// The forum topic that was deleted public ForumTopicBase topic; } - /// See + /// A forum topic was pinned or unpinned See [TLDef(0x5D8D353B)] public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction { /// Flags, see TL conditional fields public Flags flags; + /// Previous topic information [IfFlag(0)] public ForumTopicBase prev_topic; + /// New topic information [IfFlag(1)] public ForumTopicBase new_topic; [Flags] public enum Flags : uint @@ -10174,10 +10225,11 @@ namespace TL has_new_topic = 0x2, } } - /// See + /// Native antispam functionality was enabled or disabled. See [TLDef(0x64F36DFC)] public class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction { + /// Whether antispam functionality was enabled or disabled. public bool new_value; } @@ -10252,6 +10304,7 @@ namespace TL invites = 0x8000, /// A message was posted in a channel send = 0x10000, + /// Forum-related events forums = 0x20000, } } @@ -11525,7 +11578,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Previously stored logout tokens, see the documentation for more info » + /// Previously stored future auth tokens, see the documentation for more info » [IfFlag(6)] public byte[][] logout_tokens; [IfFlag(8)] public string token; [IfFlag(8)] public bool app_sandbox; @@ -13355,13 +13408,13 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Logout token » to be used on subsequent authorizations See + /// Future auth token » to be used on subsequent authorizations See [TLDef(0xC3A2835F)] public class Auth_LoggedOut : IObject { /// Flags, see TL conditional fields public Flags flags; - /// Logout token » to be used on subsequent authorizations + /// Future auth token » to be used on subsequent authorizations [IfFlag(0)] public byte[] future_auth_token; [Flags] public enum Flags : uint @@ -13494,6 +13547,7 @@ namespace TL public Flags flags; /// Peer that reacted to the message public Peer peer_id; + /// When was this reaction added public DateTime date; /// Reaction emoji public Reaction reaction; @@ -13588,6 +13642,7 @@ namespace TL inactive = 0x1, /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, + /// Whether the bot would like to send messages to the user. request_write_access = 0x4, } } @@ -14066,92 +14121,119 @@ namespace TL public MessageMedia media; } - /// See + /// Keywords for a certain sticker See [TLDef(0xFCFEB29C)] public class StickerKeyword : IObject { + /// Sticker ID public long document_id; + /// Keywords public string[] keyword; } - /// See + /// Contains information about a username. See [TLDef(0xB4073647)] public class Username : IObject { /// Flags, see TL conditional fields public Flags flags; + /// The username. public string username; [Flags] public enum Flags : uint { + /// Whether the username is editable, meaning it wasn't bought on fragment. editable = 0x1, + /// Whether the username is active. active = 0x2, } } - /// See Derived classes: , + /// Contains information about a forum topic See Derived classes: , public abstract class ForumTopicBase : IObject { + /// The ID of the deleted forum topic. public virtual int ID { get; } } - /// See + /// Represents a deleted forum topic. See [TLDef(0x023F109B)] public class ForumTopicDeleted : ForumTopicBase { + /// The ID of the deleted forum topic. public int id; + /// The ID of the deleted forum topic. public override int ID => id; } - /// See + /// Represents a forum topic. See [TLDef(0x71701DA9)] public class ForumTopic : ForumTopicBase { /// Flags, see TL conditional fields public Flags flags; + /// Topic ID public int id; + /// Topic creation date public DateTime date; + /// Topic title public string title; /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. public int icon_color; /// ID of the custom emoji used as topic icon. [IfFlag(0)] public long icon_emoji_id; + /// ID of the last message that was sent to this topic public int top_message; + /// Position up to which all incoming messages are read. public int read_inbox_max_id; + /// Position up to which all outgoing messages are read. public int read_outbox_max_id; + /// Number of unread messages public int unread_count; + /// Number of unread mentions public int unread_mentions_count; + /// Number of unread reactions to messages you sent public int unread_reactions_count; + /// ID of the peer that created the topic public Peer from_id; + /// Notification settings public PeerNotifySettings notify_settings; + /// Message draft [IfFlag(4)] public DraftMessageBase draft; [Flags] public enum Flags : uint { /// Field has a value has_icon_emoji_id = 0x1, + /// Whether the topic was created by the current user my = 0x2, + /// Whether the topic is closed (no messages can be sent to it) closed = 0x4, + /// Whether the topic is pinned pinned = 0x8, /// Field has a value has_draft = 0x10, short_ = 0x20, + /// Whether the topic is hidden (only valid for the "General" topic, id=1) hidden = 0x40, } + /// Topic ID public override int ID => id; } - /// See + /// Contains information about multiple forum topics See [TLDef(0x367617D3)] public class Messages_ForumTopics : IObject, IPeerResolver { /// Flags, see TL conditional fields public Flags flags; public int count; + /// Forum topics public ForumTopicBase[] topics; public MessageBase[] messages; public Dictionary chats; public Dictionary users; + /// Event count after generation public int pts; [Flags] public enum Flags : uint @@ -14162,10 +14244,11 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains info about the default value of the Time-To-Live setting, applied to all new chats. See [TLDef(0x43B46B20)] public class DefaultHistoryTTL : IObject { + /// Time-To-Live setting applied to all new chats. public int period; } @@ -14179,15 +14262,17 @@ namespace TL public DateTime expires; } - /// See Derived classes: , , + /// Filtering criteria to use for the peer selection list shown to the user. See Derived classes: , , public abstract class RequestPeerType : IObject { } - /// See + /// Choose a user. See [TLDef(0x5F3B8A00)] public class RequestPeerTypeUser : RequestPeerType { /// Flags, see TL conditional fields public Flags flags; + /// Whether to allow choosing only bots. [IfFlag(0)] public bool bot; + /// Whether to allow choosing only Premium users. [IfFlag(1)] public bool premium; [Flags] public enum Flags : uint @@ -14198,19 +14283,24 @@ namespace TL has_premium = 0x2, } } - /// See + /// Choose a chat or supergroup See [TLDef(0xC9F06E1B)] public class RequestPeerTypeChat : RequestPeerType { /// Flags, see TL conditional fields public Flags flags; + /// If specified, allows only choosing channels with or without a username, according to the value of . [IfFlag(3)] public bool has_username; + /// If specified, allows only choosing chats or supergroups that are or aren't forums, according to the value of . [IfFlag(4)] public bool forum; + /// If specified, allows only choosing chats or supergroups where the current user is an admin with at least the specified admin rights. [IfFlag(1)] public ChatAdminRights user_admin_rights; + /// If specified, allows only choosing chats or supergroups where the bot is an admin with at least the specified admin rights. [IfFlag(2)] public ChatAdminRights bot_admin_rights; [Flags] public enum Flags : uint { + /// Whether to allow only choosing chats or supergroups that were created by the current user. creator = 0x1, /// Field has a value has_user_admin_rights = 0x2, @@ -14220,21 +14310,26 @@ namespace TL has_has_username = 0x8, /// Field has a value has_forum = 0x10, + /// Whether to allow only choosing chats or supergroups where the bot is a participant. bot_participant = 0x20, } } - /// See + /// Choose a channel See [TLDef(0x339BEF6C)] public class RequestPeerTypeBroadcast : RequestPeerType { /// Flags, see TL conditional fields public Flags flags; + /// If specified, allows only choosing channels with or without a username, according to the value of . [IfFlag(3)] public bool has_username; + /// If specified, allows only choosing channels where the current user is an admin with at least the specified admin rights. [IfFlag(1)] public ChatAdminRights user_admin_rights; + /// If specified, allows only choosing channels where the bot is an admin with at least the specified admin rights. [IfFlag(2)] public ChatAdminRights bot_admin_rights; [Flags] public enum Flags : uint { + /// Whether to allow only choosing channels that were created by the current user. creator = 0x1, /// Field has a value has_user_admin_rights = 0x2, @@ -14272,11 +14367,13 @@ namespace TL public EmojiGroup[] groups; } - /// See + /// Styled text with message entities See [TLDef(0x751F3146)] public class TextWithEntities : IObject { + /// Text public string text; + /// Message entities for styled text public MessageEntity[] entities; } @@ -14289,86 +14386,110 @@ namespace TL public TextWithEntities[] result; } - /// See + /// Media autosave settings See [TLDef(0xC84834CE)] public class AutoSaveSettings : IObject { /// Flags, see TL conditional fields public Flags flags; + /// If set, specifies a size limit for autosavable videos [IfFlag(2)] public long video_max_size; [Flags] public enum Flags : uint { + /// Whether photos should be autosaved to the gallery. photos = 0x1, + /// Whether videos should be autosaved to the gallery. videos = 0x2, /// Field has a value has_video_max_size = 0x4, } } - /// See + /// Peer-specific media autosave settings See [TLDef(0x81602D47)] public class AutoSaveException : IObject { + /// The peer public Peer peer; + /// Media autosave settings public AutoSaveSettings settings; } - /// See + /// Contains media autosave settings See [TLDef(0x4C3E069D)] public class Account_AutoSaveSettings : IObject, IPeerResolver { + /// Default media autosave settings for private chats public AutoSaveSettings users_settings; + /// Default media autosave settings for groups and supergroups public AutoSaveSettings chats_settings; + /// Default media autosave settings for channels public AutoSaveSettings broadcasts_settings; + /// Peer-specific granular autosave settings public AutoSaveException[] exceptions; + /// Chats mentioned in the peer-specific granular autosave settings public Dictionary chats; + /// Users mentioned in the peer-specific granular autosave settings public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains various client configuration parameters See /// a value means help.appConfigNotModified [TLDef(0xDD18782E)] public class Help_AppConfig : IObject { + /// Hash for pagination, for more info click here public int hash; + /// Client configuration parameters public JsonObject config; } - /// See Derived classes: , + /// Used to fetch information about a bot web app See Derived classes: , public abstract class InputBotApp : IObject { } - /// See + /// Used to fetch information about a bot web app by its ID See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { + /// Bot web app ID. public long id; - /// REQUIRED FIELD. See how to obtain it
+ /// REQUIRED FIELD. See how to obtain it
Access hash, obtained from the .
public long access_hash; } - /// See + /// Used to fetch information about a bot web app by its short name See [TLDef(0x908C0407)] public class InputBotAppShortName : InputBotApp { + /// ID of the bot that owns the bot web app public InputUserBase bot_id; + /// Short name, obtained from a bot web app deep link public string short_name; } - /// See + /// Contains information about a bot web app. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] public class BotApp : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Bot web app ID public long id; + /// Bot web app access hash public long access_hash; + /// Bot web app short name, used to generate bot web app deep links. public string short_name; + /// Bot web app title. public string title; + /// Bot web app description. public string description; + /// Bot web app photo. public PhotoBase photo; + /// Bot web app animation. [IfFlag(0)] public DocumentBase document; + /// Hash to pass to Messages_GetBotApp, to avoid refetching bot app info if it hasn't changed. public long hash; [Flags] public enum Flags : uint @@ -14378,27 +14499,31 @@ namespace TL } } - /// See + /// Contains information about a bot web app See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { /// Flags, see TL conditional fields public Flags flags; + /// Bot app information public BotApp app; [Flags] public enum Flags : uint { + /// Whether the web app was never used by the user, and confirmation must be asked from the user before opening it. inactive = 0x1, + /// The bot is asking permission to send messages to the user: if the user agrees, set the write_allowed flag when invoking Messages_RequestAppWebView. request_write_access = 0x2, } } - /// See Derived classes: + /// Contains the link that must be used to open a bot web app. See Derived classes: public abstract class AppWebViewResult : IObject { } - /// See + /// Contains the link that must be used to open a bot web app. See [TLDef(0x3C1B4F0D)] public class AppWebViewResultUrl : AppWebViewResult { + /// The URL to open public string url; } @@ -14410,11 +14535,13 @@ namespace TL public string url; } - /// See + /// Contains info about when a certain participant has read a message See [TLDef(0x4A4FF172)] public class ReadParticipantDate : IObject { + /// User ID public long user_id; + /// When the user read the message public DateTime date; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9c343e8..979e3e7 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1124,7 +1124,7 @@ namespace TL settings = settings, }); - /// See + /// Clear all peer-specific autosave settings. See public static Task Account_DeleteAutoSaveExceptions(this Client client) => client.Invoke(new Account_DeleteAutoSaveExceptions { @@ -2065,7 +2065,7 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. /// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, DateTime cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) + public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, int cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { flags = (Messages_SetInlineBotResults.Flags)((next_offset != null ? 0x4 : 0) | (switch_pm != null ? 0x8 : 0) | (switch_webview != null ? 0x10 : 0) | (gallery ? 0x1 : 0) | (private_ ? 0x2 : 0)), @@ -2176,7 +2176,7 @@ namespace TL /// Popup to show /// URL to open /// Cache validity - public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, DateTime cache_time, string message = null, string url = null, bool alert = false) + public static Task Messages_SetBotCallbackAnswer(this Client client, long query_id, int cache_time, string message = null, string url = null, bool alert = false) => client.Invoke(new Messages_SetBotCallbackAnswer { flags = (Messages_SetBotCallbackAnswer.Flags)((message != null ? 0x1 : 0) | (url != null ? 0x4 : 0) | (alert ? 0x2 : 0)), @@ -3330,6 +3330,7 @@ namespace TL }); /// Enable or disable web bot attachment menu » See + /// Whether the user authorizes the bot to write messages to them, if requested by .request_write_access /// Bot ID /// Toggle public static Task Messages_ToggleBotInAttachMenu(this Client client, InputUserBase bot, bool enabled, bool write_allowed = false) @@ -3523,20 +3524,25 @@ namespace TL id = id, }); - /// See [bots: ✓] + /// Changes the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] + /// The new default Time-To-Live of all messages sent in new chats. public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL { period = period, }); - /// See [bots: ✓] + /// Gets the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] public static Task Messages_GetDefaultHistoryTTL(this Client client) => client.Invoke(new Messages_GetDefaultHistoryTTL { }); - /// See [bots: ✓] + /// Send a chosen peer, as requested by a button. See [bots: ✓] + /// The bot that sent the button. + /// ID of the message that contained the reply keyboard with the button. + /// The button_id field from the . + /// The chosen peer. public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer) => client.Invoke(new Messages_SendBotRequestedPeer { @@ -3591,7 +3597,9 @@ namespace TL peer = peer, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Obtain information about a bot web app See [bots: ✓] Possible codes: 400 (details) + /// Bot app information obtained from a bot web app deep link ». + /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp { @@ -4510,7 +4518,7 @@ namespace TL topics = topics, }); - /// Edit forum topic; requires manage_topics rights. See [bots: ✓] + /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400 (details) /// Supergroup /// Topic ID /// If present, will update the topic title (maximum UTF-8 length: 128). @@ -4869,7 +4877,8 @@ namespace TL /// Set stickerset thumbnail See [bots: ✓] Possible codes: 400 (details) /// Stickerset - /// Thumbnail + /// Thumbnail (only for normal stickersets, not custom emoji stickersets). + /// Only for custom emoji stickersets, ID of a custom emoji present in the set to use as thumbnail; pass 0 to fallback to the first custom emoji of the set. /// a null value means messages.stickerSetNotModified public static Task Stickers_SetStickerSetThumb(this Client client, InputStickerSet stickerset, InputDocument thumb = null, long? thumb_document_id = null) => client.Invoke(new Stickers_SetStickerSetThumb @@ -4896,7 +4905,7 @@ namespace TL title = title, }); - /// Update the keywords, emojis or mask coordinates of a sticker See [bots: ✓] Possible codes: 400 (details) + /// Update the keywords, emojis or mask coordinates of a sticker, bots only. See [bots: ✓] Possible codes: 400 (details) /// The sticker /// If set, updates the emoji list associated to the sticker /// If set, updates the mask coordinates @@ -7047,7 +7056,7 @@ namespace TL.Methods public Flags flags; public long query_id; public InputBotInlineResultBase[] results; - public DateTime cache_time; + public int cache_time; [IfFlag(2)] public string next_offset; [IfFlag(3)] public InlineBotSwitchPM switch_pm; [IfFlag(4)] public InlineBotWebView switch_webview; @@ -7162,7 +7171,7 @@ namespace TL.Methods public long query_id; [IfFlag(0)] public string message; [IfFlag(2)] public string url; - public DateTime cache_time; + public int cache_time; [Flags] public enum Flags : uint { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9f5eb29..f993e3c 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 = 156; // fetched 26/03/2023 15:54:09 + public const int Version = 156; // fetched 26/03/2023 17:25:51 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; From 9af6404eff6cff0f4af7a7ad5781d97061b07b46 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 2 Apr 2023 13:44:23 +0200 Subject: [PATCH 055/336] Now throwing WTException. Class hierarchy is TL.RpcException : WTelegram.WTException : ApplicationException --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.Helpers.cs | 12 +++++----- src/Client.cs | 56 +++++++++++++++++++++---------------------- src/Encryption.cs | 46 +++++++++++++++++------------------ src/Helpers.cs | 6 +++++ src/SecretChats.cs | 56 +++++++++++++++++++++---------------------- src/Session.cs | 6 ++--- src/TL.Extensions.cs | 8 +++---- src/TL.Secret.cs | 2 +- src/TL.cs | 10 ++++---- src/TlsStream.cs | 4 ++-- 12 files changed, 108 insertions(+), 102 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 5412eb9..1eff107 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.3.4-dev.$(Rev:r) +name: 3.4.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index c5423ff..f5b9a10 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.3.$(Rev:r) +name: 3.4.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 961934e..58d5d7b 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -55,7 +55,7 @@ namespace WTelegram lock (tasks) tasks[file_part] = task; if (!isBig) md5.TransformBlock(bytes, 0, read, null, 0); - if (read < FilePartSize && bytesLeft != 0) throw new ApplicationException($"Failed to fully read stream ({read},{bytesLeft})"); + if (read < FilePartSize && bytesLeft != 0) throw new WTException($"Failed to fully read stream ({read},{bytesLeft})"); async Task SavePart(int file_part, byte[] bytes) { @@ -331,7 +331,7 @@ namespace WTelegram if (fileSize != 0 && fileOffset >= fileSize) { if (await task != ((fileSize - 1) % FilePartSize) + 1) - throw new ApplicationException("Downloaded file size does not match expected file size"); + throw new WTException("Downloaded file size does not match expected file size"); break; } @@ -362,7 +362,7 @@ namespace WTelegram _parallelTransfers.Release(); } if (fileBase is not Upload_File fileData) - throw new ApplicationException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name); + throw new WTException("Upload_GetFile returned unsupported " + fileBase?.GetType().Name); if (fileData.bytes.Length != FilePartSize) abort = true; if (fileData.bytes.Length != 0) { @@ -480,7 +480,7 @@ namespace WTelegram mds.messages = messageList.ToArray(); return mds; case Messages_Dialogs md: return md; - default: throw new ApplicationException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); + default: throw new WTException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); } } @@ -762,13 +762,13 @@ namespace WTelegram long chatId = long.Parse(url[(start + 2)..slash]); var chats = await this.Channels_GetChannels(new InputChannel(chatId, 0)); if (!chats.chats.TryGetValue(chatId, out chat)) - throw new ApplicationException($"Channel {chatId} not found"); + throw new WTException($"Channel {chatId} not found"); } else { var resolved = await this.Contacts_ResolveUsername(url[start..slash]); chat = resolved.Chat; - if (chat is null) throw new ApplicationException($"@{url[start..slash]} is not a Chat/Channel"); + if (chat is null) throw new WTException($"@{url[start..slash]} is not a Chat/Channel"); } int msgId = int.Parse(url[(slash + 1)..end]); return await this.Channels_GetMessages((Channel)chat, msgId) as Messages_ChannelMessages; diff --git a/src/Client.cs b/src/Client.cs index 3bcfc31..c9006a5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -120,7 +120,7 @@ namespace WTelegram internal Task ConfigAsync(string what) => Task.Run(() => Config(what)); internal string Config(string what) - => _config(what) ?? DefaultConfig(what) ?? throw new ApplicationException("You must provide a config value for " + what); + => _config(what) ?? DefaultConfig(what) ?? throw new WTException("You must provide a config value for " + what); /// Default config values, used if your Config callback returns public static string DefaultConfig(string what) => what switch @@ -232,7 +232,7 @@ namespace WTelegram if ((dcSession?.AuthKeyID ?? 0) == 0) // we will need to negociate an AuthKey => can't use media_only DC flags &= ~DcOption.Flags.media_only; var dcOptions = _session.DcOptions.Where(dc => dc.id == dcId).OrderBy(dc => dc.flags ^ flags); - var dcOption = dcOptions.FirstOrDefault() ?? throw new ApplicationException($"Could not find adequate dc_option for DC {dcId}"); + var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing dcSession.DataCenter = dcOption; return _session.DCSessions[dcId] = dcSession; @@ -267,7 +267,7 @@ namespace WTelegram { var authorization = await altSession.Client.Auth_ImportAuthorization(exported.id, exported.bytes); if (authorization is not Auth_Authorization { user: User user }) - throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); + throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); altSession.UserId = user.id; } } @@ -289,19 +289,19 @@ namespace WTelegram try { if (await stream.FullReadAsync(data, 4, cts.Token) != 4) - throw new ApplicationException(ConnectionShutDown); + throw new WTException(ConnectionShutDown); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, 4); #endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen <= 0) - throw new ApplicationException("Could not read frame data : Invalid payload length"); + throw new WTException("Could not read frame data : Invalid payload length"); else if (payloadLen > data.Length) data = new byte[payloadLen]; else if (Math.Max(payloadLen, MinBufferSize) < data.Length / 4) data = new byte[Math.Max(payloadLen, MinBufferSize)]; if (await stream.FullReadAsync(data, payloadLen, cts.Token) != payloadLen) - throw new ApplicationException("Could not read frame data : Connection shut down"); + throw new WTException("Could not read frame data : Connection shut down"); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, payloadLen); #endif @@ -310,7 +310,7 @@ namespace WTelegram catch (Exception ex) // an exception in RecvAsync is always fatal { if (cts.IsCancellationRequested) return; - bool disconnectedAltDC = !IsMainDC && ex is ApplicationException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }; + bool disconnectedAltDC = !IsMainDC && ex is WTException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }; if (disconnectedAltDC) Helpers.Log(3, $"{_dcSession.DcID}>Alt DC disconnected: {ex.Message}"); else @@ -378,35 +378,35 @@ namespace WTelegram throw new RpcException(error_code, TransportError(error_code)); } if (dataLen < 24) // authKeyId+msgId+length+ctorNb | authKeyId+msgKey - throw new ApplicationException($"Packet payload too small: {dataLen}"); + throw new WTException($"Packet payload too small: {dataLen}"); long authKeyId = BinaryPrimitives.ReadInt64LittleEndian(data); if (authKeyId != _dcSession.AuthKeyID) - throw new ApplicationException($"Received a packet encrypted with unexpected key {authKeyId:X}"); + throw new WTException($"Received a packet encrypted with unexpected key {authKeyId:X}"); if (authKeyId == 0) // Unencrypted message { using var reader = new BinaryReader(new MemoryStream(data, 8, dataLen - 8)); long msgId = _lastRecvMsgId = reader.ReadInt64(); - if ((msgId & 1) == 0) throw new ApplicationException($"Invalid server msgId {msgId}"); + if ((msgId & 1) == 0) throw new WTException($"Invalid server msgId {msgId}"); int length = reader.ReadInt32(); dataLen -= 20; if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) - throw new ApplicationException($"Unexpected unencrypted/padding length {dataLen} - {length}"); + throw new WTException($"Unexpected unencrypted/padding length {dataLen} - {length}"); var obj = reader.ReadTLObject(); Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {MsgIdToStamp(msgId):u} clear{((msgId & 2) == 0 ? "" : " NAR")}"); - if (_bareRpc == null) throw new ApplicationException("Shouldn't receive unencrypted packet at this point"); + if (_bareRpc == null) throw new WTException("Shouldn't receive unencrypted packet at this point"); return obj; } else { byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, (dataLen - 24) & ~0xF), false, 8, _dcSession.AuthKey, data, 8, _sha256Recv); if (decrypted_data.Length < 36) // header below+ctorNb - throw new ApplicationException($"Decrypted packet too small: {decrypted_data.Length}"); + throw new WTException($"Decrypted packet too small: {decrypted_data.Length}"); _sha256Recv.TransformBlock(_dcSession.AuthKey, 96, 32, null, 0); _sha256Recv.TransformFinalBlock(decrypted_data, 0, decrypted_data.Length); if (!data.AsSpan(8, 16).SequenceEqual(_sha256Recv.Hash.AsSpan(8, 16))) - throw new ApplicationException("Mismatch between MsgKey & decrypted SHA256"); + throw new WTException("Mismatch between MsgKey & decrypted SHA256"); _sha256Recv.Initialize(); using var reader = new BinaryReader(new MemoryStream(decrypted_data)); var serverSalt = reader.ReadInt64(); // int64 salt @@ -415,10 +415,10 @@ namespace WTelegram var seqno = reader.ReadInt32(); // int32 msg_seqno var length = reader.ReadInt32(); // int32 message_data_length - if (length < 0 || length % 4 != 0) throw new ApplicationException($"Invalid message_data_length: {length}"); - if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new ApplicationException($"Invalid message padding length: {decrypted_data.Length - 32}-{length}"); - if (sessionId != _dcSession.Id) throw new ApplicationException($"Unexpected session ID: {sessionId} != {_dcSession.Id}"); - if ((msgId & 1) == 0) throw new ApplicationException($"msg_id is not odd: {msgId}"); + if (length < 0 || length % 4 != 0) throw new WTException($"Invalid message_data_length: {length}"); + if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new WTException($"Invalid message padding length: {decrypted_data.Length - 32}-{length}"); + if (sessionId != _dcSession.Id) throw new WTException($"Unexpected session ID: {sessionId} != {_dcSession.Id}"); + if ((msgId & 1) == 0) throw new WTException($"msg_id is not odd: {msgId}"); if (!_dcSession.CheckNewMsgId(msgId)) { Helpers.Log(3, $"{_dcSession.DcID}>Ignoring duplicate or old msg_id {msgId}"); @@ -434,7 +434,7 @@ namespace WTelegram _dcSession.Salt = serverSalt; _saltChangeCounter += 1200; // counter is decreased by KeepAlive (we have margin of 10 min) if (_saltChangeCounter >= 1800) - throw new ApplicationException("Server salt changed too often! Security issue?"); + throw new WTException("Server salt changed too often! Security issue?"); } if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); @@ -590,7 +590,7 @@ namespace WTelegram return; } else if (_dcSession.AuthKeyID == 0) - throw new ApplicationException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); + throw new WTException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); lock (_pendingRpcs) _pendingRpcs[_bareRpc.msgId] = _bareRpc; } @@ -664,7 +664,7 @@ namespace WTelegram else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc) { if (_bareRpc?.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; - rpc.tcs.SetException(new ApplicationException($"BadMsgNotification {badMsgNotification.error_code}")); + rpc.tcs.SetException(new WTException($"BadMsgNotification {badMsgNotification.error_code}")); } else RaiseUpdate(obj); @@ -879,7 +879,7 @@ namespace WTelegram /// First call should be with phone number
Further calls should be with the requested configuration value /// Configuration item requested to continue login, or when login is successful
/// Possible values: verification_code, name (signup), password (2FA), email & email_verification_code (email registration)
- /// + /// public async Task Login(string loginInfo) { if (_loginCfg.request == default) RunLoginAsync(loginInfo); @@ -997,7 +997,7 @@ namespace WTelegram } var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number"; Helpers.Log(3, mismatch); - if (!reloginOnFailedResume) throw new ApplicationException(mismatch); + if (!reloginOnFailedResume) throw new WTException(mismatch); } catch (RpcException ex) when (reloginOnFailedResume) { @@ -1157,7 +1157,7 @@ namespace WTelegram public User LoginAlreadyDone(Auth_AuthorizationBase authorization) { if (authorization is not Auth_Authorization { user: User user }) - throw new ApplicationException("Failed to get Authorization: " + authorization.GetType().Name); + throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); _session.UserId = _dcSession.UserId = user.id; lock (_session) _session.Save(); return User = user; @@ -1190,7 +1190,7 @@ namespace WTelegram private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null) { - if (_reactorTask == null) throw new ApplicationException("You must connect to Telegram first"); + if (_reactorTask == null) throw new WTException("You must connect to Telegram first"); isContent &= _dcSession.AuthKeyID != 0; (long msgId, int seqno) = NewMsgId(isContent); if (rpc != null) @@ -1212,7 +1212,7 @@ namespace WTelegram if (_dcSession.AuthKeyID == 0) // send unencrypted message { - if (_bareRpc == null) throw new ApplicationException($"Shouldn't send a {msg.GetType().Name} unencrypted"); + if (_bareRpc == null) throw new WTException($"Shouldn't send a {msg.GetType().Name} unencrypted"); writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted) writer.Write(msgId); // int64 message_id writer.Write(0); // int32 message_data_length (to be patched) @@ -1273,7 +1273,7 @@ namespace WTelegram internal async Task InvokeBare(IMethod request) { - if (_bareRpc != null) throw new ApplicationException("A bare request is already undergoing"); + if (_bareRpc != null) throw new WTException("A bare request is already undergoing"); retry: _bareRpc = new Rpc { type = typeof(T) }; await SendAsync(request, false, _bareRpc); @@ -1352,7 +1352,7 @@ namespace WTelegram case ReactorError: goto retry; default: - throw new ApplicationException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(T).Name}"); + throw new WTException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(T).Name}"); } } } diff --git a/src/Encryption.cs b/src/Encryption.cs index 01f8cc9..41ca816 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -23,7 +23,7 @@ namespace WTelegram { AesECB.Mode = CipherMode.ECB; AesECB.Padding = PaddingMode.Zeros; - if (AesECB.BlockSize != 128) throw new ApplicationException("AES Blocksize is not 16 bytes"); + if (AesECB.BlockSize != 128) throw new WTException("AES Blocksize is not 16 bytes"); } internal static async Task CreateAuthorizationKey(Client client, Session.DCSession session) @@ -36,9 +36,9 @@ namespace WTelegram var nonce = new Int128(RNG); var resPQ = await client.ReqPqMulti(nonce); //2) - if (resPQ.nonce != nonce) throw new ApplicationException("Nonce mismatch"); + if (resPQ.nonce != nonce) throw new WTException("Nonce mismatch"); var fingerprint = resPQ.server_public_key_fingerprints.FirstOrDefault(PublicKeys.ContainsKey); - if (fingerprint == 0) throw new ApplicationException("Couldn't match any server_public_key_fingerprints"); + if (fingerprint == 0) throw new WTException("Couldn't match any server_public_key_fingerprints"); var publicKey = PublicKeys[fingerprint]; Helpers.Log(2, $"Selected public key with fingerprint {fingerprint:X}"); //3) @@ -73,7 +73,7 @@ namespace WTelegram clearStream.Write(aes_key, 0, 32); // write aes_key as prefix for initial Sha256 computation writer.WriteTLObject(pqInnerData); int clearLength = (int)clearStream.Position - 32; // length before padding - if (clearLength > 144) throw new ApplicationException("PQInnerData too big"); + if (clearLength > 144) throw new WTException("PQInnerData too big"); byte[] clearBuffer = clearStream.GetBuffer(); RNG.GetBytes(clearBuffer, 32 + clearLength, 192 - clearLength); sha256.ComputeHash(clearBuffer, 0, 32 + 192).CopyTo(clearBuffer, 224); // append Sha256 @@ -91,22 +91,22 @@ namespace WTelegram var serverDHparams = await client.ReqDHParams(pqInnerData.nonce, pqInnerData.server_nonce, pqInnerData.p, pqInnerData.q, fingerprint, encrypted_data); //5) var localTime = DateTimeOffset.UtcNow; - if (serverDHparams is not ServerDHParamsOk serverDHparamsOk) throw new ApplicationException("not server_DH_params_ok"); - if (serverDHparamsOk.nonce != nonce) throw new ApplicationException("Nonce mismatch"); - if (serverDHparamsOk.server_nonce != resPQ.server_nonce) throw new ApplicationException("Server Nonce mismatch"); + if (serverDHparams is not ServerDHParamsOk serverDHparamsOk) throw new WTException("not server_DH_params_ok"); + if (serverDHparamsOk.nonce != nonce) throw new WTException("Nonce mismatch"); + if (serverDHparamsOk.server_nonce != resPQ.server_nonce) throw new WTException("Server Nonce mismatch"); var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(resPQ.server_nonce, pqInnerData.new_nonce); var answer = AES_IGE_EncryptDecrypt(serverDHparamsOk.encrypted_answer, tmp_aes_key, tmp_aes_iv, false); using var answerReader = new BinaryReader(new MemoryStream(answer)); var answerHash = answerReader.ReadBytes(20); var answerObj = answerReader.ReadTLObject(); - if (answerObj is not ServerDHInnerData serverDHinnerData) throw new ApplicationException("not server_DH_inner_data"); + if (answerObj is not ServerDHInnerData serverDHinnerData) throw new WTException("not server_DH_inner_data"); long padding = answerReader.BaseStream.Length - answerReader.BaseStream.Position; - if (padding >= 16) throw new ApplicationException("Too much pad"); + if (padding >= 16) throw new WTException("Too much pad"); if (!Enumerable.SequenceEqual(sha1.ComputeHash(answer, 20, answer.Length - (int)padding - 20), answerHash)) - throw new ApplicationException("Answer SHA1 mismatch"); - if (serverDHinnerData.nonce != nonce) throw new ApplicationException("Nonce mismatch"); - if (serverDHinnerData.server_nonce != resPQ.server_nonce) throw new ApplicationException("Server Nonce mismatch"); + throw new WTException("Answer SHA1 mismatch"); + if (serverDHinnerData.nonce != nonce) throw new WTException("Nonce mismatch"); + if (serverDHinnerData.server_nonce != resPQ.server_nonce) throw new WTException("Server Nonce mismatch"); var g_a = BigEndianInteger(serverDHinnerData.g_a); var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime); CheckGoodPrime(dh_prime, serverDHinnerData.g); @@ -149,15 +149,15 @@ namespace WTelegram var authKeyHash = sha1.ComputeHash(authKey); retry_id = BinaryPrimitives.ReadInt64LittleEndian(authKeyHash); // (auth_key_aux_hash) //9) - if (setClientDHparamsAnswer is not DhGenOk dhGenOk) throw new ApplicationException("not dh_gen_ok"); - if (dhGenOk.nonce != nonce) throw new ApplicationException("Nonce mismatch"); - if (dhGenOk.server_nonce != resPQ.server_nonce) throw new ApplicationException("Server Nonce mismatch"); + if (setClientDHparamsAnswer is not DhGenOk dhGenOk) throw new WTException("not dh_gen_ok"); + if (dhGenOk.nonce != nonce) throw new WTException("Nonce mismatch"); + if (dhGenOk.server_nonce != resPQ.server_nonce) throw new WTException("Server Nonce mismatch"); var expected_new_nonceN = new byte[32 + 1 + 8]; pqInnerData.new_nonce.raw.CopyTo(expected_new_nonceN, 0); expected_new_nonceN[32] = 1; Array.Copy(authKeyHash, 0, expected_new_nonceN, 33, 8); // (auth_key_aux_hash) if (!Enumerable.SequenceEqual(dhGenOk.new_nonce_hash1.raw, sha1.ComputeHash(expected_new_nonceN).Skip(4))) - throw new ApplicationException("setClientDHparamsAnswer.new_nonce_hashN mismatch"); + throw new WTException("setClientDHparamsAnswer.new_nonce_hashN mismatch"); session.AuthKeyID = BinaryPrimitives.ReadInt64LittleEndian(authKeyHash.AsSpan(12)); session.AuthKey = authKey; @@ -188,7 +188,7 @@ namespace WTelegram { Helpers.Log(2, "Verifying encryption key safety... (this should happen only once per DC)"); // check that 2^2047 <= p < 2^2048 - if (p.GetBitLength() != 2048) throw new ApplicationException("p is not 2048-bit number"); + if (p.GetBitLength() != 2048) throw new WTException("p is not 2048-bit number"); // check that g generates a cyclic subgroup of prime order (p - 1) / 2, i.e. is a quadratic residue mod p. if (g switch { @@ -200,11 +200,11 @@ namespace WTelegram 7 => (int)(p % 7) is not 3 and not 5 and not 6, _ => true, }) - throw new ApplicationException("Bad prime mod 4g"); + throw new WTException("Bad prime mod 4g"); // check whether p is a safe prime (meaning that both p and (p - 1) / 2 are prime) if (SafePrimes.Contains(p)) return; - if (!p.IsProbablePrime()) throw new ApplicationException("p is not a prime number"); - if (!((p - 1) / 2).IsProbablePrime()) throw new ApplicationException("(p - 1) / 2 is not a prime number"); + if (!p.IsProbablePrime()) throw new WTException("p is not a prime number"); + if (!((p - 1) / 2).IsProbablePrime()) throw new WTException("(p - 1) / 2 is not a prime number"); SafePrimes.Add(p); } @@ -233,7 +233,7 @@ namespace WTelegram // check that g, g_a and g_b are greater than 1 and less than dh_prime - 1. // We recommend checking that g_a and g_b are between 2^{2048-64} and dh_prime - 2^{2048-64} as well. if (g.GetBitLength() < 2048 - 64 || (dh_prime - g).GetBitLength() < 2048 - 64) - throw new ApplicationException("g^a or g^b is not between 2^{2048-64} and dh_prime - 2^{2048-64}"); + throw new WTException("g^a or g^b is not between 2^{2048-64} and dh_prime - 2^{2048-64}"); } public static void LoadPublicKey(string pem) @@ -298,7 +298,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB internal static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { - if (input.Length % 16 != 0) throw new ApplicationException("AES_IGE input size not divisible by 16"); + if (input.Length % 16 != 0) throw new WTException("AES_IGE input size not divisible by 16"); using var aesCrypto = encrypt ? AesECB.CreateEncryptor(aes_key, null) : AesECB.CreateDecryptor(aes_key, null); var output = new byte[input.Length]; @@ -396,7 +396,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB RNG.GetBytes(algo.salt1, salt1len, 32); } else - throw new ApplicationException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); + throw new WTException("2FA authentication uses an unsupported algo: " + accountPassword.current_algo?.GetType().Name); var g = new BigInteger(algo.g); var p = BigEndianInteger(algo.p); diff --git a/src/Helpers.cs b/src/Helpers.cs index a349c7a..6bc628d 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -253,4 +253,10 @@ namespace WTelegram protected override void Dispose(bool disposing) => _innerStream.Dispose(); } } + + public class WTException : ApplicationException + { + public WTException(string message) : base(message) { } + public WTException(string message, Exception innerException) : base(message, innerException) { } + } } diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 53bdec0..422bc44 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -95,7 +95,7 @@ namespace WTelegram public void Load(Stream input) { using var reader = new BinaryReader(input, Encoding.UTF8, true); - if (reader.ReadInt32() != 0) throw new ApplicationException("Unrecognized Secrets format"); + if (reader.ReadInt32() != 0) throw new WTException("Unrecognized Secrets format"); dh = (Messages_DhConfig)reader.ReadTLObject(); if (dh?.p != null) dh_prime = BigEndianInteger(dh.p); int count = reader.ReadInt32(); @@ -128,15 +128,15 @@ namespace WTelegram { var mdhcb = await client.Messages_GetDhConfig(dh?.version ?? 0, 256); if (mdhcb is Messages_DhConfigNotModified { random: var random }) - _ = dh ?? throw new ApplicationException("DhConfigNotModified on zero version"); + _ = dh ?? throw new WTException("DhConfigNotModified on zero version"); else if (mdhcb is Messages_DhConfig dhc) { var p = BigEndianInteger(dhc.p); CheckGoodPrime(p, dhc.g); (dh, dh_prime, random, dh.random) = (dhc, p, dhc.random, null); } - else throw new ApplicationException("Unexpected DHConfig response: " + mdhcb?.GetType().Name); - if (random.Length != 256) throw new ApplicationException("Invalid DHConfig random"); + else throw new WTException("Unexpected DHConfig response: " + mdhcb?.GetType().Name); + if (random.Length != 256) throw new WTException("Invalid DHConfig random"); var salt = new byte[256]; RNG.GetBytes(salt); for (int i = 0; i < 256; i++) salt[i] ^= random[i]; @@ -146,7 +146,7 @@ namespace WTelegram /// Initiate a secret chat with the given user.
(chat must be acknowledged by remote user before being active)
/// The remote user /// Secret Chat ID - /// + /// public async Task Request(InputUserBase user) { int chat_id; @@ -164,7 +164,7 @@ namespace WTelegram CheckGoodGaAndGb(g_a, dh_prime); var ecb = await client.Messages_RequestEncryption(user, chat_id, g_a.To256Bytes()); if (ecb is not EncryptedChatWaiting ecw || ecw.id != chat_id || ecw.participant_id != chat.participant_id) - throw new ApplicationException("Invalid " + ecb?.GetType().Name); + throw new WTException("Invalid " + ecb?.GetType().Name); chat.peer.access_hash = ecw.access_hash; return chat_id; } @@ -173,7 +173,7 @@ namespace WTelegram /// If update.chat is , you might want to first make sure you want to accept this secret chat initiated by user /// Incoming requests for secret chats are automatically: accepted (), rejected () or ignored () /// if the update was handled successfully - /// + /// public async Task HandleUpdate(UpdateEncryption update, bool? acceptChatRequests = true) { try @@ -188,8 +188,8 @@ namespace WTelegram var gab = BigInteger.ModPow(g_b, a, dh_prime); chat.flags &= ~SecretChat.Flags.requestChat; SetAuthKey(chat, gab.To256Bytes()); - if (ec.key_fingerprint != chat.key_fingerprint) throw new ApplicationException("Invalid fingerprint on accepted secret chat"); - if (ec.access_hash != chat.peer.access_hash || ec.participant_id != chat.participant_id) throw new ApplicationException("Invalid peer on accepted secret chat"); + if (ec.key_fingerprint != chat.key_fingerprint) throw new WTException("Invalid fingerprint on accepted secret chat"); + if (ec.access_hash != chat.peer.access_hash || ec.participant_id != chat.participant_id) throw new WTException("Invalid peer on accepted secret chat"); await SendNotifyLayer(chat); return true; } @@ -227,7 +227,7 @@ namespace WTelegram var ecb = await client.Messages_AcceptEncryption(chat.peer, g_b.ToByteArray(true, true), chat.key_fingerprint); if (ecb is not EncryptedChat ec || ec.id != ecr.id || ec.access_hash != ecr.access_hash || ec.admin_id != ecr.admin_id || ec.key_fingerprint != chat.key_fingerprint) - throw new ApplicationException("Inconsistent accepted secret chat"); + throw new WTException("Inconsistent accepted secret chat"); await SendNotifyLayer(chat); return true; } @@ -274,7 +274,7 @@ namespace WTelegram /// Confirmation of sent message public async Task SendMessage(int chatId, DecryptedMessageBase msg, bool silent = false, InputEncryptedFileBase file = null) { - if (!chats.TryGetValue(chatId, out var chat)) throw new ApplicationException("Secret chat not found"); + if (!chats.TryGetValue(chatId, out var chat)) throw new WTException("Secret chat not found"); try { var dml = new TL.Layer23.DecryptedMessageLayer @@ -336,14 +336,14 @@ namespace WTelegram private IObject Decrypt(SecretChat chat, byte[] data, int dataLen) { if (dataLen < 32) // authKeyId+msgKey+(length+ctorNb) - throw new ApplicationException($"Encrypted packet too small: {data.Length}"); + throw new WTException($"Encrypted packet too small: {data.Length}"); var authKey = chat.authKey; long authKeyId = BinaryPrimitives.ReadInt64LittleEndian(data); if (authKeyId == chat.key_fingerprint) if (!chat.flags.HasFlag(SecretChat.Flags.commitKey)) CheckPFS(chat); else { chat.flags &= ~SecretChat.Flags.commitKey; Array.Clear(chat.salt, 0, chat.salt.Length); } else if (chat.flags.HasFlag(SecretChat.Flags.commitKey) && authKeyId == BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(chat.salt).AsSpan(12))) authKey = chat.salt; - else throw new ApplicationException($"Received a packet encrypted with unexpected key {authKeyId:X}"); + else throw new WTException($"Received a packet encrypted with unexpected key {authKeyId:X}"); int x = (int)(chat.flags & SecretChat.Flags.originator); byte[] decrypted_data = EncryptDecryptMessage(data.AsSpan(24, dataLen - 24), false, x, authKey, data, 8, sha256); var length = BinaryPrimitives.ReadInt32LittleEndian(decrypted_data); @@ -354,11 +354,11 @@ namespace WTelegram sha256.TransformBlock(authKey, 88 + x, 32, null, 0); sha256.TransformFinalBlock(decrypted_data, 0, decrypted_data.Length); if (success = data.AsSpan(8, 16).SequenceEqual(sha256.Hash.AsSpan(8, 16))) - if (decrypted_data.Length - 4 - length is < 12 or > 1024) throw new ApplicationException($"Invalid MTProto2 padding length: {decrypted_data.Length - 4}-{length}"); + if (decrypted_data.Length - 4 - length is < 12 or > 1024) throw new WTException($"Invalid MTProto2 padding length: {decrypted_data.Length - 4}-{length}"); else if (chat.remoteLayer < Layer.MTProto2) chat.remoteLayer = Layer.MTProto2; } - if (!success) throw new ApplicationException("Could not decrypt message"); - if (length % 4 != 0) throw new ApplicationException($"Invalid message_data_length: {length}"); + if (!success) throw new WTException("Could not decrypt message"); + if (length % 4 != 0) throw new WTException($"Invalid message_data_length: {length}"); using var reader = new BinaryReader(new MemoryStream(decrypted_data, 4, length)); return reader.ReadTLObject(); } @@ -370,16 +370,16 @@ namespace WTelegram /// You can use the generic properties to access their fields /// May return an empty array if msg was already previously received or is not the next message in sequence. ///
May return multiple messages if missing messages are finally received (using = true)
- /// + /// public ICollection DecryptMessage(EncryptedMessageBase msg, bool fillGaps = true) { - if (!chats.TryGetValue(msg.ChatId, out var chat)) throw new ApplicationException("Secret chat not found"); + if (!chats.TryGetValue(msg.ChatId, out var chat)) throw new WTException("Secret chat not found"); try { var obj = Decrypt(chat, msg.Bytes, msg.Bytes.Length); - if (obj is not TL.Layer23.DecryptedMessageLayer dml) throw new ApplicationException("Decrypted object is not DecryptedMessageLayer"); - if (dml.random_bytes.Length < 15) throw new ApplicationException("Not enough random_bytes"); - if (((dml.out_seq_no ^ dml.in_seq_no) & 1) != 1 || ((dml.out_seq_no ^ chat.in_seq_no) & 1) != 0) throw new ApplicationException("Invalid seq_no parities"); + if (obj is not TL.Layer23.DecryptedMessageLayer dml) throw new WTException("Decrypted object is not DecryptedMessageLayer"); + if (dml.random_bytes.Length < 15) throw new WTException("Not enough random_bytes"); + if (((dml.out_seq_no ^ dml.in_seq_no) & 1) != 1 || ((dml.out_seq_no ^ chat.in_seq_no) & 1) != 0) throw new WTException("Invalid seq_no parities"); if (dml.layer > chat.remoteLayer) chat.remoteLayer = dml.layer; //Debug.WriteLine($"<\t{dml.in_seq_no}\t{dml.out_seq_no}\t\t\t\t\t\texpected:{chat.out_seq_no}/{chat.in_seq_no + 2}"); if (dml.out_seq_no <= chat.in_seq_no) return Array.Empty(); // already received message @@ -510,7 +510,7 @@ namespace WTelegram } break; // we lost, process with the larger exchange_id RequestKey case 0: break; - default: throw new ApplicationException("Invalid RequestKey"); + default: throw new WTException("Invalid RequestKey"); } var g_a = BigEndianInteger(request.g_a); var salt = new byte[256]; @@ -529,9 +529,9 @@ namespace WTelegram break; case TL.Layer23.DecryptedMessageActionAcceptKey accept: if ((chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) != SecretChat.Flags.renewKey) - throw new ApplicationException("Invalid AcceptKey"); + throw new WTException("Invalid AcceptKey"); if (accept.exchange_id != chat.exchange_id) - throw new ApplicationException("AcceptKey: exchange_id mismatch"); + throw new WTException("AcceptKey: exchange_id mismatch"); var a = BigEndianInteger(chat.salt); g_b = BigEndianInteger(accept.g_b); CheckGoodGaAndGb(g_b, dh_prime); @@ -539,7 +539,7 @@ namespace WTelegram var authKey = gab.To256Bytes(); key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(authKey).AsSpan(12)); if (accept.key_fingerprint != key_fingerprint) - throw new ApplicationException("AcceptKey: key_fingerprint mismatch"); + throw new WTException("AcceptKey: key_fingerprint mismatch"); _ = SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), action = new TL.Layer23.DecryptedMessageActionCommitKey { exchange_id = accept.exchange_id, key_fingerprint = accept.key_fingerprint } }); chat.salt = chat.authKey; // A may only discard the previous key after a message encrypted with the new key has been received. @@ -548,10 +548,10 @@ namespace WTelegram break; case TL.Layer23.DecryptedMessageActionCommitKey commit: if ((chat.flags & (SecretChat.Flags.requestChat | SecretChat.Flags.renewKey | SecretChat.Flags.acceptKey)) != SecretChat.Flags.acceptKey) - throw new ApplicationException("Invalid RequestKey"); + throw new WTException("Invalid RequestKey"); key_fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(chat.salt).AsSpan(12)); if (commit.exchange_id != chat.exchange_id | commit.key_fingerprint != key_fingerprint) - throw new ApplicationException("CommitKey: data mismatch"); + throw new WTException("CommitKey: data mismatch"); chat.flags &= ~SecretChat.Flags.acceptKey; authKey = chat.authKey; SetAuthKey(chat, chat.salt); @@ -614,7 +614,7 @@ namespace WTelegram var res = md5.TransformFinalBlock(iv, 0, 32); long fingerprint = BinaryPrimitives.ReadInt64LittleEndian(md5.Hash); fingerprint ^= fingerprint >> 32; - if (encryptedFile.key_fingerprint != (int)fingerprint) throw new ApplicationException("Encrypted file fingerprint mismatch"); + if (encryptedFile.key_fingerprint != (int)fingerprint) throw new WTException("Encrypted file fingerprint mismatch"); using var decryptStream = new AES_IGE_Stream(outputStream, size, key, iv); var fileLocation = encryptedFile.ToFileLocation(); diff --git a/src/Session.cs b/src/Session.cs index 76580ec..8b06975 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -104,12 +104,12 @@ namespace WTelegram { var input = new byte[length]; if (store.Read(input, 0, length) != length) - throw new ApplicationException($"Can't read session block ({store.Position}, {length})"); + throw new WTException($"Can't read session block ({store.Position}, {length})"); using var sha256 = SHA256.Create(); using var decryptor = aes.CreateDecryptor(rgbKey, input[0..16]); var utf8Json = decryptor.TransformFinalBlock(input, 16, input.Length - 16); if (!sha256.ComputeHash(utf8Json, 32, utf8Json.Length - 32).SequenceEqual(utf8Json[0..32])) - throw new ApplicationException("Integrity check failed in session loading"); + throw new WTException("Integrity check failed in session loading"); session = JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); Helpers.Log(2, "Loaded previous session"); } @@ -124,7 +124,7 @@ namespace WTelegram catch (Exception ex) { store.Dispose(); - throw new ApplicationException($"Exception while reading session file: {ex.Message}\nUse the correct api_hash/id/key, or delete the file to start a new session", ex); + throw new WTException($"Exception while reading session file: {ex.Message}\nUse the correct api_hash/id/key, or delete the file to start a new session", ex); } } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index c9205f8..71dcdc6 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -37,10 +37,10 @@ namespace TL public static void CollectUsersChats(this IPeerResolver structure, Dictionary users, Dictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); - public static Task Messages_GetChats(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); - public static Task Channels_GetChannels(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllChats"); - public static Task Users_GetUsers(this Client _) => throw new ApplicationException("The method you're looking for is Messages_GetAllDialogs"); - public static Task Messages_GetMessages(this Client _) => throw new ApplicationException("If you want to get the messages from a chat, use Messages_GetHistory"); + public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); + public static Task Channels_GetChannels(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); + public static Task Users_GetUsers(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllDialogs"); + public static Task Messages_GetMessages(this Client _) => throw new WTException("If you want to get the messages from a chat, use Messages_GetHistory"); } public static class Markdown diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 1253e9b..605f1b2 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -32,7 +32,7 @@ namespace TL public abstract class DecryptedMessageMedia : IObject { public virtual string MimeType { get; } - internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new ApplicationException("Incompatible DecryptedMessageMedia"); } + internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new WTelegram.WTException("Incompatible DecryptedMessageMedia"); } } /// Object describes the action to which a service message is linked. See diff --git a/src/TL.cs b/src/TL.cs index 4ec4923..97e88aa 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -28,7 +28,7 @@ namespace TL public IfFlagAttribute(int bit) => Bit = bit; } - public class RpcException : Exception + public class RpcException : WTelegram.WTException { public readonly int Code; /// The value of X in the message, -1 if no variable X was found @@ -73,7 +73,7 @@ namespace TL using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress))) return ReadTLObject(gzipReader); if (!Layer.Table.TryGetValue(ctorNb, out var type)) - throw new ApplicationException($"Cannot find type for ctor #{ctorNb:x}"); + throw new WTelegram.WTException($"Cannot find type for ctor #{ctorNb:x}"); if (type == null) return null; // nullable ctor (class meaning is associated with null) var tlDef = type.GetCustomAttribute(); var obj = Activator.CreateInstance(type, true); @@ -153,7 +153,7 @@ namespace TL 0x997275b5 => true, 0xbc799737 => false, Layer.RpcErrorCtor => reader.ReadTLObject(Layer.RpcErrorCtor), - var value => throw new ApplicationException($"Invalid boolean value #{value:x}") + var value => throw new WTelegram.WTException($"Invalid boolean value #{value:x}") }; case TypeCode.Object: if (type.IsArray) @@ -235,7 +235,7 @@ namespace TL return array; } else - throw new ApplicationException($"Cannot deserialize {type.Name} with ctor #{ctorNb:x}"); + throw new WTelegram.WTException($"Cannot deserialize {type.Name} with ctor #{ctorNb:x}"); } internal static Dictionary ReadTLDictionary(this BinaryReader reader, Func getID) where T : class @@ -243,7 +243,7 @@ namespace TL uint ctorNb = reader.ReadUInt32(); var elementType = typeof(T); if (ctorNb != Layer.VectorCtor) - throw new ApplicationException($"Cannot deserialize Vector<{elementType.Name}> with ctor #{ctorNb:x}"); + throw new WTelegram.WTException($"Cannot deserialize Vector<{elementType.Name}> with ctor #{ctorNb:x}"); int count = reader.ReadInt32(); var dict = new Dictionary(count); for (int i = 0; i < count; i++) diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 3391f67..a4b4e9f 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -27,7 +27,7 @@ namespace WTelegram if (await _innerStream.FullReadAsync(_tlsReadHeader, 5, ct) != 5) return 0; if (_tlsReadHeader[0] != 0x17 || _tlsReadHeader[1] != 0x03 || _tlsReadHeader[2] != 0x03) - throw new ApplicationException("Could not read frame data : Invalid TLS header"); + throw new WTException("Could not read frame data : Invalid TLS header"); _tlsFrameleft = (_tlsReadHeader[3] << 8) + _tlsReadHeader[4]; } var read = await _innerStream.ReadAsync(buffer, offset, Math.Min(count, _tlsFrameleft), ct); @@ -82,7 +82,7 @@ namespace WTelegram } } } - throw new ApplicationException("TLS Handshake failed"); + throw new WTException("TLS Handshake failed"); } static readonly byte[] TlsClientHello1 = new byte[11] { From ddfa095f1ae8c38267beb56c13ffc03827295ec8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Apr 2023 16:26:33 +0200 Subject: [PATCH 056/336] api doc --- EXAMPLES.md | 2 +- src/TL.Schema.cs | 50 +++++++++++++++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 31 +++++++++++++++++++-------- 3 files changed, 59 insertions(+), 24 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 4bb75c8..c3cb81a 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -39,7 +39,7 @@ 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): +// • Disable logging (⛔️𝗗𝗢𝗡'𝗧 𝗗𝗢 𝗧𝗛𝗜𝗦 as you won't be able to diagnose any upcoming problem): WTelegram.Helpers.Log = (lvl, str) => { }; ``` diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 81038fe..ca343c3 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -467,8 +467,9 @@ namespace TL [IfFlag(0)] public InputFileBase file; /// Square video for animated profile picture [IfFlag(1)] public InputFileBase video; - /// Timestamp that should be shown as static preview to the user (seconds) + /// Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. [IfFlag(2)] public double video_start_ts; + /// Animated sticker profile picture, must contain either a or a . [IfFlag(3)] public VideoSizeBase video_emoji_markup; [Flags] public enum Flags : uint @@ -2072,13 +2073,13 @@ namespace TL /// Action message public string message; } - /// The domain name of the website on which the user has logged in. More about Telegram Login » See + /// The user has given the bot permission to do something. See [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { /// Flags, see TL conditional fields public Flags flags; - /// The domain name of the website on which the user has logged in. + /// The domain name of the website on which the user has logged in. More about Telegram Login » [IfFlag(0)] public string domain; [IfFlag(2)] public BotApp app; @@ -2253,10 +2254,11 @@ namespace TL has_hidden = 0x8, } } - /// See + /// A new profile picture was suggested using Photos_UploadContactProfilePhoto. See [TLDef(0x57DE635E)] public class MessageActionSuggestProfilePhoto : MessageAction { + /// The photo that the user suggested we set as profile picture. public PhotoBase photo; } /// Contains info about a peer that the user shared with the bot after clicking on a button. See @@ -2838,9 +2840,11 @@ namespace TL [IfFlag(1)] public string about; /// Peer settings public PeerSettings settings; + /// Personal profile photo, to be shown instead of profile_photo. [IfFlag(21)] public PhotoBase personal_photo; /// Profile photo [IfFlag(2)] public PhotoBase profile_photo; + /// Fallback profile photo, displayed if no photo is present in profile_photo or personal_photo, due to privacy settings. [IfFlag(22)] public PhotoBase fallback_photo; /// Notification settings public PeerNotifySettings notify_settings; @@ -3727,7 +3731,7 @@ namespace TL public Flags flags; /// The peer to which the draft is associated public Peer peer; - /// ID of the forum topic to which the draft is associated + /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; /// The draft public DraftMessageBase draft; @@ -4495,10 +4499,11 @@ namespace TL has_order = 0x1, } } - /// See + /// User information was updated, it must be refetched using Users_GetFullUser. See [TLDef(0x20529438)] public class UpdateUser : Update { + /// User ID public long user_id; } /// Media autosave settings have changed and must be refetched using Account_GetAutoSaveSettings. See @@ -5887,6 +5892,7 @@ namespace TL { /// Whether this custom emoji can be sent by non-Premium users free = 0x1, + /// Whether the color of this TGS custom emoji should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. text_color = 0x2, } } @@ -6432,6 +6438,7 @@ namespace TL public StickerSet set; /// Emoji info for stickers public StickerPack[] packs; + /// Keywords for some or every sticker in the stickerset. public StickerKeyword[] keywords; /// Stickers in stickerset public DocumentBase[] documents; @@ -8310,6 +8317,7 @@ namespace TL public StickerSet set; /// Emoji information about every sticker in the stickerset public StickerPack[] packs; + /// Keywords for some or every sticker in the stickerset. public StickerKeyword[] keywords; /// Stickers public DocumentBase[] documents; @@ -8317,12 +8325,14 @@ namespace TL /// Stickerset public override StickerSet Set => set; } - /// See + /// Just the stickerset information, with no previews. See [TLDef(0x77B15D1C)] public class StickerSetNoCovered : StickerSetCoveredBase { + /// Stickerset information. public StickerSet set; + /// Stickerset information. public override StickerSet Set => set; } @@ -9375,7 +9385,7 @@ namespace TL public string emoji; /// Coordinates for mask sticker [IfFlag(0)] public MaskCoords mask_coords; - /// Set of keywords, separated by commas + /// Set of keywords, separated by commas (can't be provided for mask stickers) [IfFlag(1)] public string keywords; [Flags] public enum Flags : uint @@ -12402,7 +12412,7 @@ namespace TL /// Represents an animated video thumbnail See Derived classes: , , public abstract class VideoSizeBase : IObject { } - /// Animated profile picture in MPEG4 format See + /// An animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] public class VideoSize : VideoSizeBase { @@ -12425,19 +12435,24 @@ namespace TL has_video_start_ts = 0x1, } } - /// See + /// An animated profile picture based on a custom emoji sticker. See [TLDef(0xF85C413C)] public class VideoSizeEmojiMarkup : VideoSizeBase { + /// Custom emoji ID: the custom emoji sticker is shown at the center of the profile picture and occupies at most 67% of it. public long emoji_id; + /// 1, 2, 3 or 4 RBG-24 colors used to generate a solid (1), gradient (2) or freeform gradient (3, 4) background, similar to how fill wallpapers are generated. The rotation angle for gradient backgrounds is 0. public int[] background_colors; } - /// See + /// An animated profile picture based on a sticker. See [TLDef(0x0DA082FE)] public class VideoSizeStickerMarkup : VideoSizeBase { + /// Stickerset public InputStickerSet stickerset; + /// Sticker ID public long sticker_id; + /// 1, 2, 3 or 4 RBG-24 colors used to generate a solid (1), gradient (2) or freeform gradient (3, 4) background, similar to how fill wallpapers are generated. The rotation angle for gradient backgrounds is 0. public int[] background_colors; } @@ -14340,30 +14355,37 @@ namespace TL } } - /// See + /// Represents a list of custom emojis. See /// a value means emojiListNotModified [TLDef(0x7A1E11D1)] public class EmojiList : IObject { + /// Hash for pagination, for more info click here public long hash; + /// Custom emoji IDs public long[] document_id; } - /// See + /// Represents an emoji category. See [TLDef(0x7A9ABDA9)] public class EmojiGroup : IObject { + /// Category name, i.e. "Animals", "Flags", "Faces" and so on... public string title; + /// A single custom emoji used as preview for the category. public long icon_emoji_id; + /// A list of UTF-8 emojis, matching the category. public string[] emoticons; } - /// See + /// Represents a list of emoji categories. See /// a value means messages.emojiGroupsNotModified [TLDef(0x881FB94B)] public class Messages_EmojiGroups : IObject { + /// Hash for pagination, for more info click here public int hash; + /// A list of emoji categories. public EmojiGroup[] groups; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 979e3e7..f7265f8 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1088,7 +1088,8 @@ namespace TL active = active, }); - /// See + /// Get a set of suggested custom emoji stickers that can be used as profile picture See + /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1096,7 +1097,8 @@ namespace TL hash = hash, }); - /// See + /// Get a set of suggested custom emoji stickers that can be used as group picture See + /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -3552,7 +3554,8 @@ namespace TL requested_peer = requested_peer, }); - /// See [bots: ✓] + /// Represents a list of emoji categories, to be used when selecting custom emojis. See [bots: ✓] + /// Hash for pagination, for more info click here /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3560,7 +3563,8 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See [bots: ✓] + /// Hash for pagination, for more info click here /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3568,7 +3572,8 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See [bots: ✓] + /// Hash for pagination, for more info click here /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3663,6 +3668,7 @@ namespace TL }); /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) + /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. /// Input photo public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id, bool fallback = false) => client.Invoke(new Photos_UpdateProfilePhoto @@ -3672,9 +3678,11 @@ namespace TL }); /// Updates current user profile photo. See Possible codes: 400 (details) + /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. /// Profile photo /// Animated profile picture video - /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. + /// Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. + /// Animated sticker profile picture, must contain either a or a . public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool fallback = false) => client.Invoke(new Photos_UploadProfilePhoto { @@ -3707,10 +3715,14 @@ namespace TL limit = limit, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. See [bots: ✓] Possible codes: 400 (details) + /// If set, will send a service message to user_id, suggesting them to use the specified profile picture; otherwise, will set a personal profile picture for the user (only visible to the current user). + /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply deleted the service message with Messages_DeleteMessages). + /// The contact /// Profile photo /// Animated profile picture video - /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview. + /// Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. + /// Animated sticker profile picture, must contain either a or a . public static Task Photos_UploadContactProfilePhoto(this Client client, InputUserBase user_id, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool suggest = false, bool save = false) => client.Invoke(new Photos_UploadContactProfilePhoto { @@ -4825,6 +4837,7 @@ namespace TL /// Whether this is an animated stickerset /// Whether this is a video stickerset /// Whether this is a custom emoji stickerset. + /// Whether the color of TGS custom emojis contained in this set should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. For custom emoji stickersets only. /// Stickerset owner /// Stickerset name, 1-64 chars /// Short name of sticker set, to be used in sticker deep links ». Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and, if called by a bot, must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters. @@ -4909,7 +4922,7 @@ namespace TL /// The sticker /// If set, updates the emoji list associated to the sticker /// If set, updates the mask coordinates - /// If set, updates the sticker keywords (separated by commas). + /// If set, updates the sticker keywords (separated by commas). Can't be provided for mask stickers. /// a null value means messages.stickerSetNotModified public static Task Stickers_ChangeSticker(this Client client, InputDocument sticker, string emoji = null, MaskCoords mask_coords = null, string keywords = null) => client.Invoke(new Stickers_ChangeSticker From 2f79411fce6ca7a080a78425e3e7dc170ef7feaa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Apr 2023 16:32:19 +0200 Subject: [PATCH 057/336] Support IDictionary in CollectUsersChats (closes #137) Renamed UserID => UserId due to discrepancy --- src/Client.Helpers.cs | 2 +- src/TL.Extensions.cs | 8 ++++---- src/TL.Helpers.cs | 24 ++++++++++++------------ 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 58d5d7b..7748d52 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -527,7 +527,7 @@ namespace WTelegram foreach (var kvp in ccp.users) result.users[kvp.Key] = kvp.Value; lock (participants) foreach (var participant in ccp.participants) - if (user_ids.Add(participant.UserID)) + if (user_ids.Add(participant.UserId)) participants.Add(participant); offset += ccp.participants.Length; if (offset >= ccp.count || ccp.participants.Length == 0) break; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 71dcdc6..3038d0e 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -13,9 +13,9 @@ namespace TL private class CollectorPeer : Peer { public override long ID => 0; - internal Dictionary _users; - internal Dictionary _chats; - protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) + internal IDictionary _users; + internal IDictionary _chats; + protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) { lock (_users) foreach (var user in users.Values) @@ -34,7 +34,7 @@ namespace TL /// Accumulate users/chats found in this structure in your dictionaries, ignoring Min constructors when the full object is already stored /// The structure having a users - public static void CollectUsersChats(this IPeerResolver structure, Dictionary users, Dictionary chats) + public static void CollectUsersChats(this IPeerResolver structure, IDictionary users, IDictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 1b7b952..a4bb8a3 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -118,25 +118,25 @@ namespace TL partial class Peer { public abstract long ID { get; } - protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); + protected internal abstract IPeerInfo UserOrChat(IDictionary users, IDictionary chats); } partial class PeerUser { public override string ToString() => "user " + user_id; public override long ID => user_id; - protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; + protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; } partial class PeerChat { public override string ToString() => "chat " + chat_id; public override long ID => chat_id; - protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; } partial class PeerChannel { public override string ToString() => "channel " + channel_id; public override long ID => channel_id; - protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; } partial class UserBase : IPeerInfo @@ -191,7 +191,7 @@ namespace TL /// returns true if you're banned of any of these rights public abstract bool IsBanned(ChatBannedRights.Flags flags = 0); public abstract InputPeer ToInputPeer(); - public static implicit operator InputPeer(ChatBase chat) => chat.ToInputPeer(); + public static implicit operator InputPeer(ChatBase chat) => chat?.ToInputPeer(); } partial class ChatEmpty { @@ -542,22 +542,22 @@ namespace TL partial class ChannelParticipantBase { public virtual bool IsAdmin => false; - public abstract long UserID { get; } + public abstract long UserId { get; } } partial class ChannelParticipantCreator { public override bool IsAdmin => true; - public override long UserID => user_id; + public override long UserId => user_id; } partial class ChannelParticipantAdmin { public override bool IsAdmin => true; - public override long UserID => user_id; + public override long UserId => user_id; } - partial class ChannelParticipant { public override long UserID => user_id; } - partial class ChannelParticipantSelf { public override long UserID => user_id; } - partial class ChannelParticipantBanned { public override long UserID => peer is PeerUser pu ? pu.user_id : 0; } - partial class ChannelParticipantLeft { public override long UserID => peer is PeerUser pu ? pu.user_id : 0; } + partial class ChannelParticipant { public override long UserId => user_id; } + partial class ChannelParticipantSelf { public override long UserId => user_id; } + partial class ChannelParticipantBanned { public override long UserId => peer is PeerUser pu ? pu.user_id : 0; } + partial class ChannelParticipantLeft { public override long UserId => peer is PeerUser pu ? pu.user_id : 0; } partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer?.UserOrChat(users, chats); } From 0c6a8dd0a987c3bac94ff35c7ab7b0c9d6adf9f0 Mon Sep 17 00:00:00 2001 From: wiz0u <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Apr 2023 18:46:18 +0200 Subject: [PATCH 058/336] Create autolock.yml --- .github/workflows/autolock.yml | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 .github/workflows/autolock.yml diff --git a/.github/workflows/autolock.yml b/.github/workflows/autolock.yml new file mode 100644 index 0000000..635bcda --- /dev/null +++ b/.github/workflows/autolock.yml @@ -0,0 +1,22 @@ +name: 'Auto-Lock Issues' + +on: + schedule: + - cron: '0 12 * * *' + workflow_dispatch: + +permissions: + issues: write + pull-requests: write + +concurrency: + group: lock + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: dessant/lock-threads@v4 + with: + issue-inactive-days: '60' + pr-inactive-days: '60' From d53dc5f07cbfa333e8224244d97e50f398370026 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 9 Apr 2023 14:14:56 +0200 Subject: [PATCH 059/336] Support IDictionary in CollectUsersChats (#137) --- src/Compat.cs | 2 +- src/TL.Extensions.cs | 6 +++--- src/TL.Helpers.cs | 8 ++++---- src/TL.cs | 8 ++++---- 4 files changed, 12 insertions(+), 12 deletions(-) diff --git a/src/Compat.cs b/src/Compat.cs index c4db45b..9364fde 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -47,7 +47,7 @@ namespace WTelegram return length; } - public static V GetValueOrDefault(this Dictionary dictionary, K key, V defaultValue = default) + public static V GetValueOrDefault(this IReadOnlyDictionary dictionary, K key, V defaultValue = default) => dictionary.TryGetValue(key, out V value) ? value : defaultValue; public static void Deconstruct(this KeyValuePair kvp, out K key, out V value) { key = kvp.Key; value = kvp.Value; } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 3038d0e..0e2a7fe 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -15,7 +15,7 @@ namespace TL public override long ID => 0; internal IDictionary _users; internal IDictionary _chats; - protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) { lock (_users) foreach (var user in users.Values) @@ -51,7 +51,7 @@ namespace TL /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, Dictionary users = null) + public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -251,7 +251,7 @@ namespace TL /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] HtmlToEntities(this Client _, ref string text, bool premium = false, Dictionary users = null) + public static MessageEntity[] HtmlToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index a4bb8a3..463d3bc 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -118,25 +118,25 @@ namespace TL partial class Peer { public abstract long ID { get; } - protected internal abstract IPeerInfo UserOrChat(IDictionary users, IDictionary chats); + protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); } partial class PeerUser { public override string ToString() => "user " + user_id; public override long ID => user_id; - protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => users.TryGetValue(user_id, out var user) ? user : null; } partial class PeerChat { public override string ToString() => "chat " + chat_id; public override long ID => chat_id; - protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(chat_id, out var chat) ? chat : null; } partial class PeerChannel { public override string ToString() => "channel " + channel_id; public override long ID => channel_id; - protected internal override IPeerInfo UserOrChat(IDictionary users, IDictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; + protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) => chats.TryGetValue(channel_id, out var chat) ? chat : null; } partial class UserBase : IPeerInfo diff --git a/src/TL.cs b/src/TL.cs index 97e88aa..20659c9 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -168,9 +168,9 @@ namespace TL else if (type == typeof(Int256)) return new Int256(reader); else if (type == typeof(Dictionary)) - return reader.ReadTLDictionary(u => u.ID); + return reader.ReadTLDictionary(); else if (type == typeof(Dictionary)) - return reader.ReadTLDictionary(c => c.ID); + return reader.ReadTLDictionary(); else return reader.ReadTLObject(); default: @@ -238,7 +238,7 @@ namespace TL throw new WTelegram.WTException($"Cannot deserialize {type.Name} with ctor #{ctorNb:x}"); } - internal static Dictionary ReadTLDictionary(this BinaryReader reader, Func getID) where T : class + internal static Dictionary ReadTLDictionary(this BinaryReader reader) where T : class, IPeerInfo { uint ctorNb = reader.ReadUInt32(); var elementType = typeof(T); @@ -249,7 +249,7 @@ namespace TL for (int i = 0; i < count; i++) { var value = (T)reader.ReadTLValue(elementType); - dict[getID(value)] = value is UserEmpty ? null : value; + dict[value.ID] = value is UserEmpty ? null : value; } return dict; } From 22e64ea3ee000bfba8dae011727acd2fb67d6d20 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:31:57 +0200 Subject: [PATCH 060/336] added some helpers --- src/TL.Helpers.cs | 7 +++++++ src/TL.Schema.cs | 2 +- src/TL.cs | 6 +++--- 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 463d3bc..1fb8141 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -492,6 +492,13 @@ namespace TL public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; } + partial class MessageEntity + { + public string Type { get { var name = GetType().Name; return name[(name.IndexOf("MessageEntity") + 13)..]; } } + public int Offset { get => offset; set => offset = value; } + public int Length { get => length; set => length = value; } + } + partial class InputChannel { /// Channel identifier diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index ca343c3..bff0d83 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -6754,7 +6754,7 @@ namespace TL } /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , - public abstract class MessageEntity : IObject + public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) public int offset; diff --git a/src/TL.cs b/src/TL.cs index 20659c9..1c4fab8 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -42,9 +42,9 @@ namespace TL public Exception Exception; } - internal static class Serialization + public static class Serialization { - internal static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject + public static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } var type = obj.GetType(); @@ -66,7 +66,7 @@ namespace TL } } - internal static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) + public static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) { if (ctorNb == 0) ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.GZipedCtor) From 24a46206e12d0b5ae9bee023461f8b04888dc4c3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Apr 2023 16:33:04 +0200 Subject: [PATCH 061/336] api doc --- src/TL.Schema.cs | 41 +++++++++++++++++++++++++++++++---------- src/TL.SchemaFuncs.cs | 20 +++++++++++--------- 2 files changed, 42 insertions(+), 19 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bff0d83..7f0540b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -837,6 +837,7 @@ namespace TL has_video = 0x1, /// Field has a value has_stripped_thumb = 0x2, + /// Whether this profile photo is only visible to us (i.e. it was set using Photos_UploadContactProfilePhoto). personal = 0x4, } } @@ -1184,7 +1185,7 @@ namespace TL has_requests_pending = 0x20000, /// Field has a value has_available_reactions = 0x40000, - /// Whether real-time chat translation is disabled. + /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x80000, } @@ -1372,7 +1373,7 @@ namespace TL antispam = 0x2, /// Whether the participant list is hidden. participants_hidden = 0x4, - /// Whether real-time chat translation is disabled. + /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x8, } @@ -2079,14 +2080,16 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// The domain name of the website on which the user has logged in. More about Telegram Login » + /// The user has logged in via Telegram Login »; this field contains the domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; + /// We just gave the specified bot web app permission to send us messages. [IfFlag(2)] public BotApp app; [Flags] public enum Flags : uint { /// Field has a value has_domain = 0x1, + /// We just installed the bot's attachment menu, thus giving the bot permission to send us messages. attach_menu = 0x2, /// Field has a value has_app = 0x4, @@ -2911,6 +2914,7 @@ namespace TL has_personal_photo = 0x200000, /// Field has a value has_fallback_photo = 0x400000, + /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x800000, } } @@ -4509,10 +4513,11 @@ namespace TL /// Media autosave settings have changed and must be refetched using Account_GetAutoSaveSettings. See [TLDef(0xEC05B097)] public class UpdateAutoSaveSettings : Update { } - /// See + /// 0-N updates of this type may be returned only when invoking Messages_AddChatUser, Channels_InviteToChannel or Messages_CreateChat: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead. See [TLDef(0xCCF08AD6)] public class UpdateGroupInvitePrivacyForbidden : Update { + /// ID of the user we couldn't add. public long user_id; } @@ -6742,6 +6747,7 @@ namespace TL selective = 0x4, /// Field has a value has_placeholder = 0x8, + /// Requests clients to always show the keyboard when the regular keyboard is hidden. persistent = 0x10, } } @@ -7799,8 +7805,9 @@ namespace TL public long query_id; /// The next offset to use when navigating through results [IfFlag(1)] public string next_offset; - /// Whether the bot requested the user to message them in private + /// Shown as a button on top of the remaining inline result list; if clicked, redirects the user to a private chat with the bot with the specified start parameter. [IfFlag(2)] public InlineBotSwitchPM switch_pm; + /// Shown as a button on top of the remaining inline result list; if clicked, opens the specified bot web app. [IfFlag(3)] public InlineBotWebView switch_webview; /// The results public BotInlineResultBase[] results; @@ -10314,7 +10321,7 @@ namespace TL invites = 0x8000, /// A message was posted in a channel send = 0x10000, - /// Forum-related events + /// Forum-related events forums = 0x20000, } } @@ -13260,7 +13267,9 @@ namespace TL public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; + /// If set, contains additional information about the sponsored message to be shown along with the message. [IfFlag(8)] public string additional_info; [Flags] public enum Flags : uint @@ -13292,6 +13301,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; /// Sponsored messages public SponsoredMessage[] messages; @@ -14067,6 +14077,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Identifier of the last in-store transaction for the currently used subscription. [IfFlag(3)] public string transaction; /// Duration of subscription in months public int months; @@ -14083,7 +14094,9 @@ namespace TL { /// Field has a value has_store_product = 0x1, + /// Whether this subscription option is currently in use. current = 0x2, + /// Whether this subscription option can be used to upgrade the existing Telegram Premium subscription. can_purchase_upgrade = 0x4, /// Field has a value has_transaction = 0x8, @@ -14242,17 +14255,22 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; + /// Total number of topics matching query; may be less than the topics contained in topics, in which case pagination is required. public int count; /// Forum topics public ForumTopicBase[] topics; + /// Related messages (contains the messages mentioned by .top_message). public MessageBase[] messages; + /// Related chats public Dictionary chats; + /// Related users public Dictionary users; /// Event count after generation public int pts; [Flags] public enum Flags : uint { + /// Whether the returned topics are ordered by creation date; if set, pagination by next_offset should use .date; otherwise topics are ordered by the last message date, so paginate by the date of the referenced by .top_message. order_by_create_date = 0x1, } /// returns a or for the given Peer @@ -14399,12 +14417,13 @@ namespace TL public MessageEntity[] entities; } - /// Translated text, or no result See Derived classes: + /// Translated text with entities. See Derived classes: public abstract class Messages_TranslatedText : IObject { } - /// See + /// Translated text with entities See [TLDef(0x33DB32F8)] public class Messages_TranslateResult : Messages_TranslatedText { + /// Text+entities, for each input message. public TextWithEntities[] result; } @@ -14521,7 +14540,7 @@ namespace TL } } - /// Contains information about a bot web app See + /// Contains information about a bot web app See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { @@ -14549,11 +14568,13 @@ namespace TL public string url; } - /// See + /// Specifies a bot web app button, shown on top of the inline query results list. See [TLDef(0xB57295D5)] public class InlineBotWebView : IObject { + /// Text of the button public string text; + /// Webapp URL public string url; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index f7265f8..46b9669 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2042,7 +2042,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 @@ -2066,7 +2066,8 @@ namespace TL /// Vector of results for the inline query /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. - /// If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. + /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. + /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified bot web app. public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, int cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { @@ -2156,7 +2157,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 @@ -3255,10 +3256,10 @@ namespace TL reaction = reaction, }); - /// Translate a given text See Possible codes: 400 (details) + /// Translate a given text. See Possible codes: 400 (details) /// If the text is a chat message, the peer ID /// A list of message IDs to translate - /// The text to translate + /// A list of styled messages to translate /// Two-letter ISO 639-1 language code of the language to which the message is translated public static Task Messages_TranslateText(this Client client, string to_lang, InputPeer peer = null, int[] id = null, TextWithEntities[] text = null) => client.Invoke(new Messages_TranslateText @@ -3391,6 +3392,7 @@ namespace TL }); /// Open a bot web app. See + /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. /// Bot that owns the webapp /// Web app URL /// Theme parameters » @@ -3592,9 +3594,9 @@ namespace TL hash = hash, }); - /// Toggle real-time chat translation for a certain chat See [bots: ✓] - /// Whether to disable or enable real-time chat translation - /// Peer where to enable or disable real-time chat translation + /// Show or hide the real-time chat translation popup for a certain chat See [bots: ✓] + /// Whether to disable or enable the real-time chat translation popup + /// The peer public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) => client.Invoke(new Messages_TogglePeerTranslations { @@ -4584,7 +4586,7 @@ namespace TL }); /// Enable or disable the native antispam system. See [bots: ✓] - /// Supergroup ID + /// Supergroup ID. The specified supergroup must have at least telegram_antispam_group_size_min members to enable antispam functionality, as specified by the client configuration parameters. /// Enable or disable the native antispam system. public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAntiSpam From acb7ff1d74ede03e5a39485c3b898c594917b332 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Apr 2023 18:02:13 +0200 Subject: [PATCH 062/336] Layer 158: chat wallpapers, enhanced chat folders/lists & switch-inline, edit bot infos, ... --- README.md | 2 +- src/TL.Schema.cs | 251 ++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 399 ++++++++++++++++++++++++++++++------- src/TL.Table.cs | 22 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 566 insertions(+), 110 deletions(-) diff --git a/README.md b/README.md index ac00bd1..0d91114 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-156-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-158-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7f0540b..36f144e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -814,6 +814,7 @@ namespace TL { /// Field has a value has_usernames = 0x1, + bot_can_edit = 0x2, } } @@ -2074,22 +2075,22 @@ namespace TL /// Action message public string message; } - /// The user has given the bot permission to do something. See + /// We have given the bot permission to send us direct messages. See [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { /// Flags, see TL conditional fields public Flags flags; - /// The user has logged in via Telegram Login »; this field contains the domain name of the website on which the user has logged in. + /// We have authorized the bot to send us messages by logging into a website via Telegram Login »; this field contains the domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; - /// We just gave the specified bot web app permission to send us messages. + /// We have authorized the bot to send us messages by opening the specified bot web app. [IfFlag(2)] public BotApp app; [Flags] public enum Flags : uint { /// Field has a value has_domain = 0x1, - /// We just installed the bot's attachment menu, thus giving the bot permission to send us messages. + /// We have authorized the bot to send us messages by installing the bot's attachment menu. attach_menu = 0x2, /// Field has a value has_app = 0x4, @@ -2157,8 +2158,9 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// New Time-To-Live + /// New Time-To-Live of all messages sent in this chat; if 0, autodeletion was disabled. public int period; + /// If set, the chat TTL setting was set not due to a manual change by one of participants, but automatically because one of the participants has the Messages_SetDefaultHistoryTTL. For example, when a user writes to us for the first time and we have set a default messages TTL of 1 week, this service message (with auto_setting_from=our_userid) will be emitted before our first message. [IfFlag(0)] public long auto_setting_from; [Flags] public enum Flags : uint @@ -2201,15 +2203,24 @@ namespace TL public string text; } /// Info about a gifted Telegram Premium subscription See - [TLDef(0xABA0F5C6)] + [TLDef(0xC83D6AEC)] public class MessageActionGiftPremium : MessageAction { + public Flags flags; /// Three-letter ISO 4217 currency code public string currency; /// Price of the gift 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 amount; /// Duration of the gifted Telegram Premium subscription public int months; + [IfFlag(0)] public string crypto_currency; + [IfFlag(0)] public long crypto_amount; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_crypto_currency = 0x1, + } } /// A forum topic was created. See [TLDef(0x0D999256)] @@ -2242,7 +2253,7 @@ namespace TL [IfFlag(1)] public long icon_emoji_id; /// Whether the topic was closed. [IfFlag(2)] public bool closed; - /// Whether the topic was hidden. + /// Whether the topic was hidden (only valid for the "General" topic, id=1). [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint @@ -2273,6 +2284,15 @@ namespace TL /// The shared peer public Peer peer; } + /// See + [TLDef(0xBC44A927)] + public class MessageActionSetChatWallPaper : MessageAction + { + public WallPaperBase wallpaper; + } + /// See + [TLDef(0xC0787D6D)] + public class MessageActionSetSameChatWallPaper : MessageActionSetChatWallPaper { } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2832,7 +2852,7 @@ namespace TL } /// Extended user info See - [TLDef(0xF8D32AED)] + [TLDef(0x93EADB53)] public class UserFull : IObject { /// Flags, see TL conditional fields @@ -2871,6 +2891,7 @@ namespace TL [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; /// Telegram Premium subscriptions gift options [IfFlag(19)] public PremiumGiftOption[] premium_gifts; + [IfFlag(24)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint { @@ -2916,6 +2937,8 @@ namespace TL has_fallback_photo = 0x400000, /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x800000, + /// Field has a value + has_wallpaper = 0x1000000, } } @@ -4045,7 +4068,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 { @@ -4295,6 +4318,7 @@ namespace TL has_new_participant = 0x2, /// Field has a value has_invite = 0x4, + via_chatlist = 0x8, } } /// A bot was stopped or re-started. See @@ -6549,7 +6573,7 @@ namespace TL { } /// Button to force a user to switch to inline mode Pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See - [TLDef(0x0568A748)] + [TLDef(0x93B9FBB5)] public class KeyboardButtonSwitchInline : KeyboardButtonBase { /// Flags, see TL conditional fields @@ -6558,11 +6582,14 @@ namespace TL public string text; /// The inline query to use public string query; + [IfFlag(1)] public InlineQueryPeerType[] peer_types; [Flags] public enum Flags : uint { /// If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. same_peer = 0x1, + /// Field has a value + has_peer_types = 0x2, } /// Button label @@ -7973,18 +8000,20 @@ namespace TL google_signin_allowed = 0x2, } } - /// See + /// The code was delivered via fragment.com. See [TLDef(0xD9565C39)] public class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms { + /// Open the specified URL to log into fragment.com with the wallet that owns the specified phone number and view the code. public string url; } - /// See + /// An authentication code should be delivered via SMS after Firebase attestation, as described in the auth documentation ». See [TLDef(0xE57B1432)] public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { /// Flags, see TL conditional fields public Flags flags; + /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; [IfFlag(1)] public string receipt; [IfFlag(1)] public int push_timeout; @@ -10107,11 +10136,17 @@ namespace TL public bool join_muted; } /// A user joined the supergroup/channel using a specific invite link See - [TLDef(0x5CDADA77)] + [TLDef(0xFE9FC158)] public class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { + public Flags flags; /// The invite link used to join the supergroup/channel public ExportedChatInvite invite; + + [Flags] public enum Flags : uint + { + via_chatlist = 0x1, + } } /// A chat invite was deleted See [TLDef(0x5A50FCA4)] @@ -11612,6 +11647,7 @@ namespace TL allow_missed_call = 0x20, /// Field has a value has_logout_tokens = 0x40, + /// Whether Firebase auth is supported allow_firebase = 0x80, /// Field has a value has_token = 0x100, @@ -12211,10 +12247,24 @@ namespace TL public BankCardOpenUrl[] open_urls; } - /// Dialog filter AKA folder See + /// Dialog filter (folder ») See Derived classes: /// a value means dialogFilterDefault + public abstract class DialogFilterBase : IObject + { + /// Folder ID + public virtual int ID { get; } + /// Folder name + public virtual string Title { get; } + /// Folder emoticon + public virtual string Emoticon { get; } + /// Pinned chats, folders can have unlimited pinned chats + public virtual InputPeer[] PinnedPeers { get; } + /// Include the following chats in this folder + public virtual InputPeer[] IncludePeers { get; } + } + /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] - public class DialogFilter : IObject + public class DialogFilter : DialogFilterBase { /// Flags, see TL conditional fields public Flags flags; @@ -12252,6 +12302,40 @@ namespace TL /// Field has a value has_emoticon = 0x2000000, } + + /// Folder ID + public override int ID => id; + /// Folder name + public override string Title => title; + /// Folder emoticon + public override string Emoticon => emoticon; + /// Pinned chats, folders can have unlimited pinned chats + public override InputPeer[] PinnedPeers => pinned_peers; + /// Include the following chats in this folder + public override InputPeer[] IncludePeers => include_peers; + } + /// See + [TLDef(0xD64A04A8)] + public class DialogFilterChatlist : DialogFilterBase + { + public Flags flags; + public int id; + public string title; + [IfFlag(25)] public string emoticon; + public InputPeer[] pinned_peers; + public InputPeer[] include_peers; + + [Flags] public enum Flags : uint + { + has_emoticon = 0x2000000, + has_my_invites = 0x4000000, + } + + public override int ID => id; + public override string Title => title; + public override string Emoticon => emoticon; + public override InputPeer[] PinnedPeers => pinned_peers; + public override InputPeer[] IncludePeers => include_peers; } /// Suggested folders See @@ -12259,7 +12343,7 @@ namespace TL public class DialogFilterSuggested : IObject { /// Folder info - public DialogFilter filter; + public DialogFilterBase filter; /// Folder description public string description; } @@ -12970,6 +13054,8 @@ namespace TL Megagroup = 0x5EC4BE43, ///The inline query was sent in a channel Broadcast = 0x6334EE9A, + ///See + BotPM = 0x0E3B2D0C, } /// ID of a specific chat import session, click here for more info ». See @@ -13037,6 +13123,7 @@ namespace TL has_approved_by = 0x2, /// Field has a value has_about = 0x4, + via_chatlist = 0x8, } } @@ -13286,6 +13373,7 @@ namespace TL has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, + /// Whether a profile photo bubble should be displayed for this message, like for messages sent in groups. The photo shown in the bubble is obtained either from the peer contained in from_id, or from chat_invite. show_peer_photo = 0x40, /// Field has a value has_sponsor_info = 0x80, @@ -13885,6 +13973,7 @@ namespace TL { /// Pass true if this is a restore of a Telegram Premium purchase; only for the App Store restore = 0x1, + /// Pass true if this is an upgrade from a monthly subscription to a yearly subscription; only for App Store upgrade = 0x2, } } @@ -14077,7 +14166,7 @@ namespace TL { /// Flags, see TL conditional fields public Flags flags; - /// Identifier of the last in-store transaction for the currently used subscription. + /// Identifier of the last in-store transaction for the currently used subscription on the current account. [IfFlag(3)] public string transaction; /// Duration of subscription in months public int months; @@ -14096,7 +14185,7 @@ namespace TL has_store_product = 0x1, /// Whether this subscription option is currently in use. current = 0x2, - /// Whether this subscription option can be used to upgrade the existing Telegram Premium subscription. + /// Whether this subscription option can be used to upgrade the existing Telegram Premium subscription. When upgrading Telegram Premium subscriptions bought through stores, make sure that the store transaction ID is equal to transaction, to avoid upgrading someone else's account, if the client is currently logged into multiple accounts. can_purchase_upgrade = 0x4, /// Field has a value has_transaction = 0x8, @@ -14240,6 +14329,7 @@ namespace TL pinned = 0x8, /// Field has a value has_draft = 0x10, + /// Whether this constructor is a reduced version of the full topic information.
If set, only the my, closed, id, date, title, icon_color, icon_emoji_id and from_id parameters will contain valid information.
Reduced info is usually only returned in topic-related admin log events » and in the : if needed, full information can be fetched using Channels_GetForumTopicsByID.
short_ = 0x20, /// Whether the topic is hidden (only valid for the "General" topic, id=1) hidden = 0x40, @@ -14488,28 +14578,28 @@ namespace TL public JsonObject config; } - /// Used to fetch information about a bot web app See Derived classes: , + /// Used to fetch information about a named bot web app See Derived classes: , public abstract class InputBotApp : IObject { } - /// Used to fetch information about a bot web app by its ID See + /// Used to fetch information about a named bot web app by its ID See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { - /// Bot web app ID. + /// named bot web app ID. public long id; /// REQUIRED FIELD. See how to obtain it
Access hash, obtained from the .
public long access_hash; } - /// Used to fetch information about a bot web app by its short name See + /// Used to fetch information about a named bot web app by its short name See [TLDef(0x908C0407)] public class InputBotAppShortName : InputBotApp { /// ID of the bot that owns the bot web app public InputUserBase bot_id; - /// Short name, obtained from a bot web app deep link + /// Short name, obtained from a named bot web app deep link public string short_name; } - /// Contains information about a bot web app. See + /// Contains information about a named bot web app. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] public class BotApp : IObject @@ -14520,7 +14610,7 @@ namespace TL public long id; /// Bot web app access hash public long access_hash; - /// Bot web app short name, used to generate bot web app deep links. + /// Bot web app short name, used to generate named bot web app deep links. public string short_name; /// Bot web app title. public string title; @@ -14540,7 +14630,7 @@ namespace TL } } - /// Contains information about a bot web app See + /// Contains information about a named bot web app See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { @@ -14558,9 +14648,9 @@ namespace TL } } - /// Contains the link that must be used to open a bot web app. See Derived classes: + /// Contains the link that must be used to open a named bot web app. See Derived classes: public abstract class AppWebViewResult : IObject { } - /// Contains the link that must be used to open a bot web app. See + /// Contains the link that must be used to open a named bot web app. See [TLDef(0x3C1B4F0D)] public class AppWebViewResultUrl : AppWebViewResult { @@ -14587,4 +14677,109 @@ namespace TL /// When the user read the message public DateTime date; } + + /// See + public abstract class InputChatlist : IObject { } + /// See + [TLDef(0xF3E0DA33)] + public class InputChatlistDialogFilter : InputChatlist + { + public int filter_id; + } + + /// See + [TLDef(0x0C5181AC)] + public class ExportedChatlistInvite : IObject + { + public Flags flags; + public string title; + public string url; + public Peer[] peers; + + [Flags] public enum Flags : uint + { + } + } + + /// See + [TLDef(0x10E6E3A6)] + public class Chatlists_ExportedChatlistInvite : IObject + { + public DialogFilterBase filter; + public ExportedChatlistInvite invite; + } + + /// See + [TLDef(0x10AB6DC7)] + public class Chatlists_ExportedInvites : IObject, IPeerResolver + { + public ExportedChatlistInvite[] invites; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + public abstract class Chatlists_ChatlistInviteBase : IObject + { + public virtual Dictionary Chats { get; } + public virtual Dictionary Users { get; } + } + /// See + [TLDef(0xFA87F659)] + public class Chatlists_ChatlistInviteAlready : Chatlists_ChatlistInviteBase, IPeerResolver + { + public int filter_id; + public Peer[] missing_peers; + public Peer[] already_peers; + public Dictionary chats; + public Dictionary users; + + public override Dictionary Chats => chats; + public override Dictionary Users => users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + /// See + [TLDef(0x1DCD839D)] + public class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver + { + public Flags flags; + public string title; + [IfFlag(0)] public string emoticon; + public Peer[] peers; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_emoticon = 0x1, + } + + public override Dictionary Chats => chats; + public override Dictionary Users => users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x93BD878D)] + public class Chatlists_ChatlistUpdates : IObject, IPeerResolver + { + public Peer[] missing_peers; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xE8A775B0)] + public class Bots_BotInfo : IObject + { + public string name; + public string about; + public string description; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 46b9669..e15471c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -286,7 +286,10 @@ namespace TL code = code, }); - /// See Possible codes: 400 (details) + /// Login by importing an authorization token See Possible codes: 400 (details) + /// API ID + /// API hash + /// The authorization token public static Task Auth_ImportWebTokenAuthorization(this Client client, int api_id, string api_hash, string web_auth_token) => client.Invoke(new Auth_ImportWebTokenAuthorization { @@ -295,7 +298,10 @@ namespace TL web_auth_token = web_auth_token, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Request an SMS code via Firebase. See [bots: ✓] Possible codes: 400 (details) + /// Phone number + /// Phone code hash returned by Auth_SendCode + /// On Android, a JWS object obtained as described in the auth documentation » public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) => client.Invoke(new Auth_RequestFirebaseSms { @@ -768,9 +774,10 @@ namespace TL /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings - public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings) + public static Task Account_UploadWallPaper(this Client client, InputFileBase file, string mime_type, WallPaperSettings settings, bool for_chat = false) => client.Invoke(new Account_UploadWallPaper { + flags = (Account_UploadWallPaper.Flags)(for_chat ? 0x1 : 0), file = file, mime_type = mime_type, settings = settings, @@ -1132,7 +1139,7 @@ namespace TL { }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400,500 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1379,7 +1386,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400,403,500 (details) + /// Returns the current user dialog list. See Possible codes: 400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1399,7 +1406,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406,500 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1501,7 +1508,7 @@ namespace TL /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) /// Target user or group - /// Thread ID + /// Topic ID /// Type of action public static Task Messages_SetTyping(this Client client, InputPeer peer, SendMessageAction action, int? top_msg_id = null) => client.Invoke(new Messages_SetTyping @@ -1521,17 +1528,17 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination where the message will be sent /// The message ID to which this message will reply to - /// If set, sends the message to the specified forum topic + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -1551,7 +1558,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// Destination /// Message ID to which this message should reply to - /// If set, sends the media to the specified forum topic + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Attached media /// Caption /// Random ID to avoid resending the same message You can use @@ -1559,10 +1566,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, int? reply_to_msg_id = null, int? top_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), top_msg_id = top_msg_id.GetValueOrDefault(), @@ -1884,7 +1891,7 @@ namespace TL title = title, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406,500 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2087,7 +2094,7 @@ namespace TL /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination /// ID of the message this message should reply to - /// If set, sends the message to the specified forum topic + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults @@ -2189,7 +2196,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400,406,500 (details) + /// Get dialog info of specified peers See Possible codes: 400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2531,7 +2538,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat /// The message to reply to - /// If set, sends the media to the specified forum topic + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer @@ -2663,7 +2670,7 @@ namespace TL banned_rights = banned_rights, }); - /// Get localized emoji keywords See + /// Get localized emoji keywords ». See /// Language code public static Task Messages_GetEmojiKeywords(this Client client, string lang_code) => client.Invoke(new Messages_GetEmojiKeywords @@ -2671,9 +2678,9 @@ namespace TL lang_code = lang_code, }); - /// Get changed emoji keywords See + /// Get changed emoji keywords ». See /// Language code - /// Previous emoji keyword localization version + /// Previous stored emoji keyword list version public static Task Messages_GetEmojiKeywordsDifference(this Client client, string lang_code, int from_version) => client.Invoke(new Messages_GetEmojiKeywordsDifference { @@ -2681,16 +2688,16 @@ namespace TL from_version = from_version, }); - /// Get info about an emoji keyword localization See - /// Language codes + /// Obtain a list of related languages that must be used when fetching emoji keyword lists ». See + /// The user's language codes public static Task Messages_GetEmojiKeywordsLanguages(this Client client, params string[] lang_codes) => client.Invoke(new Messages_GetEmojiKeywordsLanguages { lang_codes = lang_codes, }); - /// Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation See - /// Language code for which the emoji replacements will be suggested + /// Returns an HTTP URL which can be used to automatically log in into translation platform and suggest new emoji keywords ». The URL will be valid for 30 seconds after generation. See + /// Language code for which the emoji keywords will be suggested public static Task Messages_GetEmojiURL(this Client client, string lang_code) => client.Invoke(new Messages_GetEmojiURL { @@ -2821,7 +2828,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 { }); @@ -2835,7 +2842,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), @@ -3057,7 +3064,7 @@ namespace TL peer = peer, }); - /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403,500 (details) + /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403 (details) /// If set, only returns info about users with pending join requests » /// Chat /// Invite link @@ -3354,12 +3361,12 @@ namespace TL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified forum topic + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, string url = null, string start_param = null, DataJSON theme_params = null, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, int? reply_to_msg_id = null, string url = null, DataJSON theme_params = null, string start_param = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((url != null ? 0x2 : 0) | (start_param != null ? 0x8 : 0) | (theme_params != null ? 0x4 : 0) | (reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), + flags = (Messages_RequestWebView.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), peer = peer, bot = bot, url = url, @@ -3377,7 +3384,7 @@ namespace TL /// Bot that owns the web app /// Web app interaction ID obtained from Messages_RequestWebView /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// If set, the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage will be sent to the specified forum topic. + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Open the web app as the specified peer public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView @@ -3604,8 +3611,8 @@ namespace TL peer = peer, }); - /// Obtain information about a bot web app See [bots: ✓] Possible codes: 400 (details) - /// Bot app information obtained from a bot web app deep link ». + /// Obtain information about a named bot web app See [bots: ✓] Possible codes: 400 (details) + /// Bot app information obtained from a named bot web app deep link ». /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp @@ -3614,11 +3621,11 @@ namespace TL hash = hash, }); - /// Open a bot web app from a bot web app deep link, sending over user information after user confirmation. See [bots: ✓] - /// Set this flag if the bot is asking permission to send messages to the user as specified in the bot web app deep link docs, and the user agreed. + /// Open a bot web app from a named bot web app deep link, sending over user information after user confirmation. See [bots: ✓] + /// Set this flag if the bot is asking permission to send messages to the user as specified in the named bot web app deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. - /// The app obtained by invoking Messages_GetBotApp as specified in the bot web app deep link docs. - /// If the startapp query string parameter is present in the bot web app deep link, pass it to start_param. + /// The app obtained by invoking Messages_GetBotApp as specified in the named bot web app deep link docs. + /// If the startapp query string parameter is present in the named bot web app deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) @@ -3632,6 +3639,17 @@ namespace TL platform = platform, }); + /// See + public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null) + => client.Invoke(new Messages_SetChatWallPaper + { + flags = (Messages_SetChatWallPaper.Flags)((wallpaper != null ? 0x1 : 0) | (id != null ? 0x2 : 0) | (settings != null ? 0x4 : 0)), + peer = peer, + wallpaper = wallpaper, + settings = settings, + id = id.GetValueOrDefault(), + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3672,10 +3690,11 @@ namespace TL /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. /// Input photo - public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id, bool fallback = false) + public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id, InputUserBase bot = null, bool fallback = false) => client.Invoke(new Photos_UpdateProfilePhoto { - flags = (Photos_UpdateProfilePhoto.Flags)(fallback ? 0x1 : 0), + flags = (Photos_UpdateProfilePhoto.Flags)((bot != null ? 0x2 : 0) | (fallback ? 0x1 : 0)), + bot = bot, id = id, }); @@ -3685,10 +3704,11 @@ namespace TL /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. /// Animated sticker profile picture, must contain either a or a . - public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, bool fallback = false) + public static Task Photos_UploadProfilePhoto(this Client client, InputFileBase file = null, InputFileBase video = null, double? video_start_ts = null, VideoSizeBase video_emoji_markup = null, InputUserBase bot = null, bool fallback = false) => client.Invoke(new Photos_UploadProfilePhoto { - flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x10 : 0) | (fallback ? 0x8 : 0)), + flags = (Photos_UploadProfilePhoto.Flags)((file != null ? 0x1 : 0) | (video != null ? 0x2 : 0) | (video_start_ts != null ? 0x4 : 0) | (video_emoji_markup != null ? 0x10 : 0) | (bot != null ? 0x20 : 0) | (fallback ? 0x8 : 0)), + bot = bot, file = file, video = video, video_start_ts = video_start_ts.GetValueOrDefault(), @@ -4046,7 +4066,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406,500 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -4091,7 +4111,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406,500 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -4174,7 +4194,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406,500 (details) + /// Join a channel/supergroup See Possible codes: 400,406 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -4329,7 +4349,7 @@ namespace TL { }); - /// Associate a group to a channel as discussion group for that channel See Possible codes: 400 (details) + /// Associate a group to a channel as discussion group for that channel See Possible codes: 400,403 (details) /// Channel /// Discussion group to associate to the channel public static Task Channels_SetDiscussionGroup(this Client client, InputChannelBase broadcast, InputChannelBase group) @@ -4454,7 +4474,7 @@ namespace TL order = order, }); - /// Associate or dissociate a purchased fragment.com username to a supergroup or channel. See [bots: ✓] + /// Associate or dissociate a purchased fragment.com username to a supergroup or channel. See [bots: ✓] Possible codes: 400 (details) /// Supergroup or channel /// Username /// Whether to associate or dissociate the username @@ -4491,10 +4511,10 @@ namespace TL /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. /// Unique client message ID to prevent duplicate sending of the same event You can use /// Create the topic as the specified peer - public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, long? icon_emoji_id = null, InputPeer send_as = null) + public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, InputPeer send_as = null, long? icon_emoji_id = null) => client.Invoke(new Channels_CreateForumTopic { - flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x8 : 0) | (send_as != null ? 0x4 : 0)), + flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0)), channel = channel, title = title, icon_color = icon_color.GetValueOrDefault(), @@ -4538,7 +4558,7 @@ namespace TL /// If present, will update the topic title (maximum UTF-8 length: 128). /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. /// If present, will update the open/closed status of the topic. - /// If present, will hide/unhide the topic. + /// If present, will hide/unhide the topic (only valid for the "General" topic, id=1). public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) => client.Invoke(new Channels_EditForumTopic { @@ -4605,7 +4625,7 @@ namespace TL msg_id = msg_id, }); - /// Hide or display the participants list in a supergroup See [bots: ✓] + /// Hide or display the participants list in a supergroup. See [bots: ✓] Possible codes: 400 (details) /// Supergroup ID /// If true, will hide the participants list; otherwise will unhide it. public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) @@ -4706,23 +4726,44 @@ namespace TL /// Language code, if left empty update the fallback about text and description /// New about text /// New description - public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null) + public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null, InputUserBase bot = null, string name = null) => client.Invoke(new Bots_SetBotInfo { - flags = (Bots_SetBotInfo.Flags)((about != null ? 0x1 : 0) | (description != null ? 0x2 : 0)), + flags = (Bots_SetBotInfo.Flags)((about != null ? 0x1 : 0) | (description != null ? 0x2 : 0) | (bot != null ? 0x4 : 0) | (name != null ? 0x8 : 0)), + bot = bot, lang_code = lang_code, + name = name, about = about, description = description, }); /// Get our about text and description (bots only) See [bots: ✓] Possible codes: 400 (details) /// Language code, if left empty this method will return the fallback about text and description. - public static Task Bots_GetBotInfo(this Client client, string lang_code) + public static Task Bots_GetBotInfo(this Client client, string lang_code, InputUserBase bot = null) => client.Invoke(new Bots_GetBotInfo { + flags = (Bots_GetBotInfo.Flags)(bot != null ? 0x1 : 0), + bot = bot, lang_code = lang_code, }); + /// See + public static Task Bots_ReorderUsernames(this Client client, InputUserBase bot, params string[] order) + => client.Invoke(new Bots_ReorderUsernames + { + bot = bot, + order = order, + }); + + /// See + public static Task Bots_ToggleUsername(this Client client, InputUserBase bot, string username, bool active) + => client.Invoke(new Bots_ToggleUsername + { + bot = bot, + username = username, + active = active, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -5370,14 +5411,6 @@ namespace TL folder_peers = folder_peers, }); - /// Delete a peer folder See Possible codes: 400 (details) - /// Peer folder ID, for more info click here - public static Task Folders_DeleteFolder(this Client client, int folder_id) - => client.Invoke(new Folders_DeleteFolder - { - folder_id = folder_id, - }); - /// Get channel statistics See Possible codes: 400,403 (details) /// Whether to enable dark theme for graph colors /// The channel @@ -5438,6 +5471,93 @@ namespace TL channel = channel, msg_id = msg_id, }); + + /// See + public static Task Chatlists_ExportChatlistInvite(this Client client, InputChatlist chatlist, string title, params InputPeer[] peers) + => client.Invoke(new Chatlists_ExportChatlistInvite + { + chatlist = chatlist, + title = title, + peers = peers, + }); + + /// See + public static Task Chatlists_DeleteExportedInvite(this Client client, InputChatlist chatlist, string slug) + => client.Invoke(new Chatlists_DeleteExportedInvite + { + chatlist = chatlist, + slug = slug, + }); + + /// See + public static Task Chatlists_EditExportedInvite(this Client client, InputChatlist chatlist, string slug, string title = null, InputPeer[] peers = null) + => client.Invoke(new Chatlists_EditExportedInvite + { + flags = (Chatlists_EditExportedInvite.Flags)((title != null ? 0x2 : 0) | (peers != null ? 0x4 : 0)), + chatlist = chatlist, + slug = slug, + title = title, + peers = peers, + }); + + /// See + public static Task Chatlists_GetExportedInvites(this Client client, InputChatlist chatlist) + => client.Invoke(new Chatlists_GetExportedInvites + { + chatlist = chatlist, + }); + + /// See + public static Task Chatlists_CheckChatlistInvite(this Client client, string slug) + => client.Invoke(new Chatlists_CheckChatlistInvite + { + slug = slug, + }); + + /// See + public static Task Chatlists_JoinChatlistInvite(this Client client, string slug, params InputPeer[] peers) + => client.Invoke(new Chatlists_JoinChatlistInvite + { + slug = slug, + peers = peers, + }); + + /// See + public static Task Chatlists_GetChatlistUpdates(this Client client, InputChatlist chatlist) + => client.Invoke(new Chatlists_GetChatlistUpdates + { + chatlist = chatlist, + }); + + /// See + public static Task Chatlists_JoinChatlistUpdates(this Client client, InputChatlist chatlist, params InputPeer[] peers) + => client.Invoke(new Chatlists_JoinChatlistUpdates + { + chatlist = chatlist, + peers = peers, + }); + + /// See + public static Task Chatlists_HideChatlistUpdates(this Client client, InputChatlist chatlist) + => client.Invoke(new Chatlists_HideChatlistUpdates + { + chatlist = chatlist, + }); + + /// See + public static Task Chatlists_GetLeaveChatlistSuggestions(this Client client, InputChatlist chatlist) + => client.Invoke(new Chatlists_GetLeaveChatlistSuggestions + { + chatlist = chatlist, + }); + + /// See + public static Task Chatlists_LeaveChatlist(this Client client, InputChatlist chatlist, params InputPeer[] peers) + => client.Invoke(new Chatlists_LeaveChatlist + { + chatlist = chatlist, + peers = peers, + }); } } @@ -6015,12 +6135,18 @@ namespace TL.Methods public InputWallPaperBase wallpaper; } - [TLDef(0xDD853661)] + [TLDef(0xE39A8F03)] public class Account_UploadWallPaper : IMethod { + public Flags flags; public InputFileBase file; public string mime_type; public WallPaperSettings settings; + + [Flags] public enum Flags : uint + { + for_chat = 0x1, + } } [TLDef(0x6C5A5B37)] @@ -7746,7 +7872,7 @@ namespace TL.Methods } [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } + public class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] public class Messages_GetSuggestedDialogFilters : IMethod { } @@ -7756,7 +7882,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 { @@ -8401,6 +8527,23 @@ namespace TL.Methods } } + [TLDef(0x8FFACAE1)] + public class Messages_SetChatWallPaper : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public InputWallPaperBase wallpaper; + [IfFlag(2)] public WallPaperSettings settings; + [IfFlag(1)] public int id; + + [Flags] public enum Flags : uint + { + has_wallpaper = 0x1, + has_id = 0x2, + has_settings = 0x4, + } + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -8434,22 +8577,25 @@ namespace TL.Methods } } - [TLDef(0x1C3D5956)] + [TLDef(0x09E82039)] public class Photos_UpdateProfilePhoto : IMethod { public Flags flags; + [IfFlag(1)] public InputUserBase bot; public InputPhoto id; [Flags] public enum Flags : uint { fallback = 0x1, + has_bot = 0x2, } } - [TLDef(0x093C9A51)] + [TLDef(0x0388A3B5)] public class Photos_UploadProfilePhoto : IMethod { public Flags flags; + [IfFlag(5)] public InputUserBase bot; [IfFlag(0)] public InputFileBase file; [IfFlag(1)] public InputFileBase video; [IfFlag(2)] public double video_start_ts; @@ -8462,6 +8608,7 @@ namespace TL.Methods has_video_start_ts = 0x4, fallback = 0x8, has_video_emoji_markup = 0x10, + has_bot = 0x20, } } @@ -9210,11 +9357,13 @@ namespace TL.Methods public ChatAdminRights admin_rights; } - [TLDef(0xA365DF7A)] + [TLDef(0x10CF3123)] public class Bots_SetBotInfo : IMethod { public Flags flags; + [IfFlag(2)] public InputUserBase bot; public string lang_code; + [IfFlag(3)] public string name; [IfFlag(0)] public string about; [IfFlag(1)] public string description; @@ -9222,13 +9371,37 @@ namespace TL.Methods { has_about = 0x1, has_description = 0x2, + has_bot = 0x4, + has_name = 0x8, } } - [TLDef(0x75EC12E6)] - public class Bots_GetBotInfo : IMethod + [TLDef(0xDCD914FD)] + public class Bots_GetBotInfo : IMethod { + public Flags flags; + [IfFlag(0)] public InputUserBase bot; public string lang_code; + + [Flags] public enum Flags : uint + { + has_bot = 0x1, + } + } + + [TLDef(0x9709B1C2)] + public class Bots_ReorderUsernames : IMethod + { + public InputUserBase bot; + public string[] order; + } + + [TLDef(0x053CA973)] + public class Bots_ToggleUsername : IMethod + { + public InputUserBase bot; + public string username; + public bool active; } [TLDef(0x37148DBB)] @@ -9766,12 +9939,6 @@ namespace TL.Methods public InputFolderPeer[] folder_peers; } - [TLDef(0x1C295881)] - public class Folders_DeleteFolder : IMethod - { - public int folder_id; - } - [TLDef(0xAB42441A)] public class Stats_GetBroadcastStats : IMethod { @@ -9832,4 +9999,86 @@ namespace TL.Methods dark = 0x1, } } + + [TLDef(0x8472478E)] + public class Chatlists_ExportChatlistInvite : IMethod + { + public InputChatlist chatlist; + public string title; + public InputPeer[] peers; + } + + [TLDef(0x719C5C5E)] + public class Chatlists_DeleteExportedInvite : IMethod + { + public InputChatlist chatlist; + public string slug; + } + + [TLDef(0x653DB63D)] + public class Chatlists_EditExportedInvite : IMethod + { + public Flags flags; + public InputChatlist chatlist; + public string slug; + [IfFlag(1)] public string title; + [IfFlag(2)] public InputPeer[] peers; + + [Flags] public enum Flags : uint + { + has_title = 0x2, + has_peers = 0x4, + } + } + + [TLDef(0xCE03DA83)] + public class Chatlists_GetExportedInvites : IMethod + { + public InputChatlist chatlist; + } + + [TLDef(0x41C10FFF)] + public class Chatlists_CheckChatlistInvite : IMethod + { + public string slug; + } + + [TLDef(0xA6B1E39A)] + public class Chatlists_JoinChatlistInvite : IMethod + { + public string slug; + public InputPeer[] peers; + } + + [TLDef(0x89419521)] + public class Chatlists_GetChatlistUpdates : IMethod + { + public InputChatlist chatlist; + } + + [TLDef(0xE089F8F5)] + public class Chatlists_JoinChatlistUpdates : IMethod + { + public InputChatlist chatlist; + public InputPeer[] peers; + } + + [TLDef(0x66E486FB)] + public class Chatlists_HideChatlistUpdates : IMethod + { + public InputChatlist chatlist; + } + + [TLDef(0xFDBCD714)] + public class Chatlists_GetLeaveChatlistSuggestions : IMethod + { + public InputChatlist chatlist; + } + + [TLDef(0x74FAE13A)] + public class Chatlists_LeaveChatlist : IMethod + { + public InputChatlist chatlist; + public InputPeer[] peers; + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f993e3c..441228b 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 = 156; // fetched 26/03/2023 17:25:51 + public const int Version = 158; // fetched 21/04/2023 14:33:19 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -190,11 +190,13 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), - [0xABA0F5C6] = typeof(MessageActionGiftPremium), + [0xC83D6AEC] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0xFE77345D] = typeof(MessageActionRequestedPeer), + [0xBC44A927] = typeof(MessageActionSetChatWallPaper), + [0xC0787D6D] = typeof(MessageActionSetSameChatWallPaper), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -222,7 +224,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xF8D32AED] = typeof(UserFull), + [0x93EADB53] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -508,7 +510,7 @@ namespace TL [0x35BBDB6B] = typeof(KeyboardButtonCallback), [0xB16A6C29] = typeof(KeyboardButtonRequestPhone), [0xFC796B3F] = typeof(KeyboardButtonRequestGeoLocation), - [0x0568A748] = typeof(KeyboardButtonSwitchInline), + [0x93B9FBB5] = typeof(KeyboardButtonSwitchInline), [0x50F41CCF] = typeof(KeyboardButtonGame), [0xAFD93FBB] = typeof(KeyboardButtonBuy), [0x10B78D29] = typeof(KeyboardButtonUrlAuth), @@ -756,7 +758,7 @@ namespace TL [0xF92424D2] = typeof(ChannelAdminLogEventActionParticipantMute), [0xE64429C0] = typeof(ChannelAdminLogEventActionParticipantUnmute), [0x56D6A247] = typeof(ChannelAdminLogEventActionToggleGroupCallSetting), - [0x5CDADA77] = typeof(ChannelAdminLogEventActionParticipantJoinByInvite), + [0xFE9FC158] = typeof(ChannelAdminLogEventActionParticipantJoinByInvite), [0x5A50FCA4] = typeof(ChannelAdminLogEventActionExportedInviteDelete), [0x410A134E] = typeof(ChannelAdminLogEventActionExportedInviteRevoke), [0xE90EBB59] = typeof(ChannelAdminLogEventActionExportedInviteEdit), @@ -915,6 +917,7 @@ namespace TL [0x3E24E573] = typeof(Payments_BankCardData), [0x7438F7E8] = typeof(DialogFilter), [0x363293AE] = null,//DialogFilterDefault + [0xD64A04A8] = typeof(DialogFilterChatlist), [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -1082,6 +1085,14 @@ namespace TL [0x3C1B4F0D] = typeof(AppWebViewResultUrl), [0xB57295D5] = typeof(InlineBotWebView), [0x4A4FF172] = typeof(ReadParticipantDate), + [0xF3E0DA33] = typeof(InputChatlistDialogFilter), + [0x0C5181AC] = typeof(ExportedChatlistInvite), + [0x10E6E3A6] = typeof(Chatlists_ExportedChatlistInvite), + [0x10AB6DC7] = typeof(Chatlists_ExportedInvites), + [0xFA87F659] = typeof(Chatlists_ChatlistInviteAlready), + [0x1DCD839D] = typeof(Chatlists_ChatlistInvite), + [0x93BD878D] = typeof(Chatlists_ChatlistUpdates), + [0xE8A775B0] = typeof(Bots_BotInfo), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1198,6 +1209,7 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: + [typeof(DialogFilterBase)] = 0x363293AE, //dialogFilterDefault [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 49d8aeb..46d77cb 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: 156 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 158 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From ee2f0bfee127cdf993e8f952f47726be6d4a439a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 23 Apr 2023 14:35:08 +0200 Subject: [PATCH 063/336] added Document.GetAttribute<> helpers, setters on Input* classes and more --- .github/dev.yml | 3 +- src/TL.Helpers.cs | 8 ++++- src/TL.Schema.cs | 72 +++++++++++++++++++------------------- src/WTelegramClient.csproj | 5 --- 4 files changed, 44 insertions(+), 44 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1eff107..d2d7e8e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.4.1-dev.$(Rev:r) +name: 3.4.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest @@ -35,4 +35,3 @@ steps: publishPackageMetadata: true nuGetFeedType: 'external' publishFeedCredentials: 'nuget.org' - diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 1fb8141..bfc0217 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -456,10 +456,11 @@ namespace TL { public override long ID => id; public override string ToString() => Filename is string filename ? base.ToString() + ": " + filename : base.ToString(); - public string Filename => attributes.OfType().FirstOrDefault()?.file_name; + public string Filename => GetAttribute()?.file_name; protected override InputDocument ToInputDocument() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type }; public PhotoSizeBase LargestThumbSize => thumbs?.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); + public T GetAttribute() where T : DocumentAttribute => attributes.OfType().FirstOrDefault(); } partial class SendMessageAction @@ -490,6 +491,9 @@ namespace TL partial class StickerSet { public static implicit operator InputStickerSetID(StickerSet stickerSet) => new() { id = stickerSet.id, access_hash = stickerSet.access_hash }; + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE0060")] + public InputStickerSetThumb ToFileLocation(PhotoSizeBase thumbSize) => new() { stickerset = this, thumb_version = thumb_version }; + public PhotoSizeBase LargestThumbSize => thumbs?.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); } partial class MessageEntity @@ -569,6 +573,8 @@ namespace TL partial class Messages_PeerDialogs { public IPeerInfo UserOrChat(DialogBase dialog) => dialog.Peer?.UserOrChat(users, chats); } partial class Game { public static implicit operator InputGameID(Game game) => new() { id = game.id, access_hash = game.access_hash }; } + + partial class WebDocumentBase { public T GetAttribute() where T : DocumentAttribute => Attributes.OfType().FirstOrDefault(); } partial class WebDocument { public static implicit operator InputWebFileLocation(WebDocument doc) => new() { url = doc.url, access_hash = doc.access_hash }; } partial class PhoneCallBase { public static implicit operator InputPhoneCall(PhoneCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 36f144e..445e53f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -132,11 +132,11 @@ namespace TL public abstract partial class InputFileBase : IObject { /// Random file identifier created by the client - public virtual long ID { get; } + public virtual long ID { get; set; } /// Number of parts saved - public virtual int Parts { get; } + public virtual int Parts { get; set; } /// Full name of the file - public virtual string Name { get; } + public virtual string Name { get; set; } } /// Defines a file saved in parts using the method Upload_SaveFilePart. See [TLDef(0xF52FF27F)] @@ -152,11 +152,11 @@ namespace TL public byte[] md5_checksum; /// Random file identifier created by the client - public override long ID => id; + public override long ID { get => id; set => id = value; } /// Number of parts saved - public override int Parts => parts; + public override int Parts { get => parts; set => parts = value; } /// Full name of the file - public override string Name => name; + public override string Name { get => name; set => name = value; } } /// Assigns a big file (over 10 MB in size), saved in part using the method Upload_SaveBigFilePart. See [TLDef(0xFA4F0BB5)] @@ -170,11 +170,11 @@ namespace TL public string name; /// Random file id, created by the client - public override long ID => id; + public override long ID { get => id; set => id = value; } /// Number of parts saved - public override int Parts => parts; + public override int Parts { get => parts; set => parts = value; } /// Full file name - public override string Name => name; + public override string Name { get => name; set => name = value; } } /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , @@ -5312,7 +5312,7 @@ namespace TL public abstract class InputEncryptedFileBase : IObject { /// Random file ID created by client - public virtual long ID { get; } + public virtual long ID { get; set; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] @@ -5328,7 +5328,7 @@ namespace TL public int key_fingerprint; /// Random file ID created by client - public override long ID => id; + public override long ID { get => id; set => id = value; } } /// Sets forwarded encrypted file for attachment. See [TLDef(0x5A17B5E5)] @@ -5340,7 +5340,7 @@ namespace TL public long access_hash; /// File ID, value of id parameter from - public override long ID => id; + public override long ID { get => id; set => id = value; } } /// Assigns a new big encrypted file (over 10 MB in size), saved in parts using the method Upload_SaveBigFilePart. See [TLDef(0x2DC173C8)] @@ -5354,7 +5354,7 @@ namespace TL public int key_fingerprint; /// Random file id, created by the client - public override long ID => id; + public override long ID { get => id; set => id = value; } } /// Object contains encrypted message. See Derived classes: , @@ -6883,7 +6883,7 @@ namespace TL public abstract class InputChannelBase : IObject { /// Channel ID - public virtual long ChannelId { get; } + public virtual long ChannelId { get; set; } } /// Represents a channel See [TLDef(0xF35AEC28)] @@ -6895,7 +6895,7 @@ namespace TL public long access_hash; /// Channel ID - public override long ChannelId => channel_id; + public override long ChannelId { get => channel_id; set => channel_id = value; } } /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0x5B934F9D)] @@ -6909,7 +6909,7 @@ namespace TL public long channel_id; /// The channel ID - public override long ChannelId => channel_id; + public override long ChannelId { get => channel_id; set => channel_id = value; } } /// Resolved peer See @@ -7445,9 +7445,9 @@ namespace TL public abstract class InputBotInlineResultBase : IObject { /// ID of result - public virtual string ID { get; } + public virtual string ID { get; set; } /// Message to send when the result is selected - public virtual InputBotInlineMessage SendMessage { get; } + public virtual InputBotInlineMessage SendMessage { get; set; } } /// An inline bot result See [TLDef(0x88BF9319)] @@ -7487,9 +7487,9 @@ namespace TL } /// ID of result - public override string ID => id; + public override string ID { get => id; set => id = value; } /// Message to send when the result is selected - public override InputBotInlineMessage SendMessage => send_message; + public override InputBotInlineMessage SendMessage { get => send_message; set => send_message = value; } } /// Photo See [TLDef(0xA8D864A7)] @@ -7505,9 +7505,9 @@ namespace TL public InputBotInlineMessage send_message; /// Result ID - public override string ID => id; + public override string ID { get => id; set => id = value; } /// Message to send when the result is selected - public override InputBotInlineMessage SendMessage => send_message; + public override InputBotInlineMessage SendMessage { get => send_message; set => send_message = value; } } /// Document (media of any type except for photos) See [TLDef(0xFFF8FDC4)] @@ -7537,9 +7537,9 @@ namespace TL } /// Result ID - public override string ID => id; + public override string ID { get => id; set => id = value; } /// Message to send when the result is selected - public override InputBotInlineMessage SendMessage => send_message; + public override InputBotInlineMessage SendMessage { get => send_message; set => send_message = value; } } /// Game See [TLDef(0x4FA417F2)] @@ -7553,9 +7553,9 @@ namespace TL public InputBotInlineMessage send_message; /// Result ID - public override string ID => id; + public override string ID { get => id; set => id = value; } /// Message to send when the result is selected - public override InputBotInlineMessage SendMessage => send_message; + public override InputBotInlineMessage SendMessage { get => send_message; set => send_message = value; } } /// Inline message See Derived classes: , , , , , @@ -8073,9 +8073,9 @@ namespace TL public abstract class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message - public virtual int DcId { get; } + public virtual int DcId { get; set; } /// Access hash of message - public virtual long AccessHash { get; } + public virtual long AccessHash { get; set; } } /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] @@ -8089,9 +8089,9 @@ namespace TL public long access_hash; /// DC ID to use when working with this inline message - public override int DcId => dc_id; + public override int DcId { get => dc_id; set => dc_id = value; } /// Access hash of message - public override long AccessHash => access_hash; + public override long AccessHash { get => access_hash; set => access_hash = value; } } /// Represents a sent inline message from the perspective of a bot See [TLDef(0xB6D915D7)] @@ -8107,9 +8107,9 @@ namespace TL public long access_hash; /// DC ID to use when working with this inline message - public override int DcId => dc_id; + public override int DcId { get => dc_id; set => dc_id = value; } /// Access hash of message - public override long AccessHash => access_hash; + public override long AccessHash { get => access_hash; set => access_hash = value; } } /// The bot requested the user to message them in private See @@ -9049,7 +9049,7 @@ namespace TL } /// Remote document See Derived classes: , - public abstract class WebDocumentBase : IObject + public abstract partial class WebDocumentBase : IObject { /// Document URL public virtual string Url { get; } @@ -10611,7 +10611,7 @@ namespace TL public abstract class InputSecureFileBase : IObject { /// Secure file ID - public virtual long ID { get; } + public virtual long ID { get; set; } } /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] @@ -10629,7 +10629,7 @@ namespace TL public byte[] secret; /// Secure file ID - public override long ID => id; + public override long ID { get => id; set => id = value; } } /// Pre-uploaded passport file, for more info see the passport docs » See [TLDef(0x5367E5BE)] @@ -10641,7 +10641,7 @@ namespace TL public long access_hash; /// Secure file ID - public override long ID => id; + public override long ID { get => id; set => id = value; } } /// Secure passport file, for more info see the passport docs » See diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 46d77cb..1f36516 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -28,11 +28,6 @@ TRACE;OBFUSCATION - - - - - From 7c7a2a062594fc2c846c86a4dafdb4ae76d8c5c6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 24 Apr 2023 22:03:03 +0200 Subject: [PATCH 064/336] =?UTF-8?q?Telegram=20suddenly=20removed=20Message?= =?UTF-8?q?s=5FGetAllChats=20method=20=F0=9F=A4=A6=F0=9F=8F=BB=E2=80=8D?= =?UTF-8?q?=E2=99=82=20So=20here=20it=20is=20back,=20as=20a=20helper=20bas?= =?UTF-8?q?ed=20on=20GetAllDialogs?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.Helpers.cs | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 7748d52..5b6d7d3 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -453,6 +453,13 @@ namespace WTelegram return true; } + /// Get all chats, channels and supergroups + public async Task Messages_GetAllChats() + { + var dialogs = await Messages_GetAllDialogs(); + return new Messages_Chats { chats = dialogs.chats }; + } + /// Returns the current user dialog list. Possible codes: 400 (details) /// Peer folder ID, for more info click here /// See From 6a75f0a9d85464cb75ca019e9505fca9ffbade1c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Apr 2023 13:19:15 +0200 Subject: [PATCH 065/336] Fix progressCallback abort/exception handling during DownloadFileAsync --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index d2d7e8e..c992487 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.4.2-dev.$(Rev:r) +name: 3.4.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 5b6d7d3..17f7db1 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -378,6 +378,7 @@ namespace WTelegram await outputStream.WriteAsync(fileData.bytes, 0, fileData.bytes.Length); maxOffsetSeen = Math.Max(maxOffsetSeen, offset + fileData.bytes.Length); transmitted += fileData.bytes.Length; + progress?.Invoke(transmitted, fileSize); } catch (Exception) { @@ -387,7 +388,6 @@ namespace WTelegram finally { writeSem.Release(); - progress?.Invoke(transmitted, fileSize); } } lock (tasks) tasks.Remove(offset); From e33184fabb2883418b7e2444b9192d3b9061ad9e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Apr 2023 16:51:39 +0200 Subject: [PATCH 066/336] improved api doc for Flags --- src/SecretChats.cs | 2 +- src/TL.Schema.cs | 575 +++++++++++++++++++------------------ src/TL.SchemaFuncs.cs | 34 +-- src/TL.Secret.cs | 4 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 312 insertions(+), 305 deletions(-) diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 422bc44..5df6b44 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -170,7 +170,7 @@ namespace WTelegram } /// Processes the you received from Telegram (). - /// If update.chat is , you might want to first make sure you want to accept this secret chat initiated by user + /// If update.chat is , you might want to first make sure you want to accept this secret chat initiated by user /// Incoming requests for secret chats are automatically: accepted (), rejected () or ignored () /// if the update was handled successfully /// diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 445e53f..8c3c566 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -184,7 +184,7 @@ namespace TL [TLDef(0x1E287D04)] public class InputMediaUploadedPhoto : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The uploaded file public InputFileBase file; @@ -207,7 +207,7 @@ namespace TL [TLDef(0xB3BA0635)] public class InputMediaPhoto : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Photo to be forwarded public InputPhoto id; @@ -246,7 +246,7 @@ namespace TL [TLDef(0x5B38C6C1)] public partial class InputMediaUploadedDocument : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The uploaded file public InputFileBase file; @@ -281,7 +281,7 @@ namespace TL [TLDef(0x33473058)] public class InputMediaDocument : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The document to be forwarded. public InputDocument id; @@ -321,7 +321,7 @@ namespace TL [TLDef(0xE5BBFE1A)] public class InputMediaPhotoExternal : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// URL of the photo public string url; @@ -340,7 +340,7 @@ namespace TL [TLDef(0xFB52DC99)] public class InputMediaDocumentExternal : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// URL of the document public string url; @@ -366,7 +366,7 @@ namespace TL [TLDef(0x8EB5A6D5)] public class InputMediaInvoice : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Product name, 1-32 characters public string title; @@ -400,7 +400,7 @@ namespace TL [TLDef(0x971FA843)] public class InputMediaGeoLive : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current geolocation public InputGeoPoint geo_point; @@ -427,7 +427,7 @@ namespace TL [TLDef(0x0F94E5F1)] public class InputMediaPoll : InputMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The poll to send public Poll poll; @@ -442,7 +442,7 @@ namespace TL { /// Field has a value has_correct_answers = 0x1, - /// Field has a value + /// Fields and have a value has_solution = 0x2, } } @@ -461,7 +461,7 @@ namespace TL [TLDef(0xBDCDAEC0)] public class InputChatUploadedPhoto : InputChatPhotoBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// File saved in parts using the method Upload_SaveFilePart [IfFlag(0)] public InputFileBase file; @@ -497,7 +497,7 @@ namespace TL [TLDef(0x48222FAF)] public class InputGeoPoint : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Latitude public double lat; @@ -609,7 +609,7 @@ namespace TL [TLDef(0x37257E99)] public class InputPeerPhotoFileLocation : InputFileLocationBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The peer whose profile picture should be downloaded public InputPeer peer; @@ -635,7 +635,7 @@ namespace TL [TLDef(0x0598A92A)] public class InputGroupCallStream : InputFileLocationBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Livestream info public InputGroupCall call; @@ -650,7 +650,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields and have a value has_video_channel = 0x1, } } @@ -717,9 +717,9 @@ namespace TL [TLDef(0x8F97C628)] public partial class User : UserBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; /// ID of the user public long id; @@ -823,7 +823,7 @@ namespace TL [TLDef(0x82D1F706)] public class UserProfilePhoto : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the respective photo public long photo_id; @@ -892,7 +892,7 @@ namespace TL [TLDef(0x41CBF256)] public partial class Chat : ChatBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the group public long id; @@ -958,9 +958,9 @@ namespace TL [TLDef(0x83259464)] public partial class Channel : ChatBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; /// ID of the channel public long id; @@ -1058,7 +1058,7 @@ namespace TL [TLDef(0x17D493D5)] public partial class ChannelForbidden : ChatBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Channel ID public long id; @@ -1123,7 +1123,7 @@ namespace TL [TLDef(0xC9D31138)] public partial class ChatFull : ChatFullBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the chat public long id; @@ -1182,7 +1182,7 @@ namespace TL has_groupcall_default_join_as = 0x8000, /// Field has a value has_theme_emoticon = 0x10000, - /// Field has a value + /// Fields and have a value has_requests_pending = 0x20000, /// Field has a value has_available_reactions = 0x40000, @@ -1225,9 +1225,9 @@ namespace TL [TLDef(0xF2355507)] public partial class ChannelFull : ChatFullBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; /// ID of the channel public long id; @@ -1306,11 +1306,11 @@ namespace TL has_participants_count = 0x1, /// Field has a value has_admins_count = 0x2, - /// Field has a value + /// Fields and have a value has_kicked_count = 0x4, /// Can we view the participant list? can_view_participants = 0x8, - /// Field has a value + /// Fields and have a value has_migrated_from_chat_id = 0x10, /// Field has a value has_pinned_msg_id = 0x20, @@ -1358,7 +1358,7 @@ namespace TL has_groupcall_default_join_as = 0x4000000, /// Field has a value has_theme_emoticon = 0x8000000, - /// Field has a value + /// Fields and have a value has_requests_pending = 0x10000000, /// Field has a value has_default_send_as = 0x20000000, @@ -1456,7 +1456,7 @@ namespace TL [TLDef(0x8763D3E1)] public partial class ChatParticipantsForbidden : ChatParticipantsBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Group ID public long chat_id; @@ -1492,7 +1492,7 @@ namespace TL [TLDef(0x1C6E1C11)] public class ChatPhoto : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Photo ID public long photo_id; @@ -1530,7 +1530,7 @@ namespace TL [TLDef(0x90A6CA84)] public partial class MessageEmpty : MessageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message identifier public int id; @@ -1552,7 +1552,7 @@ namespace TL [TLDef(0x38116EE0)] public partial class Message : MessageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the message public int id; @@ -1615,7 +1615,7 @@ namespace TL has_from_id = 0x100, /// Field has a value has_media = 0x200, - /// Field has a value + /// Fields and have a value has_views = 0x400, /// Field has a value has_via_bot_id = 0x800, @@ -1666,7 +1666,7 @@ namespace TL [TLDef(0x2B085862)] public partial class MessageService : MessageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message ID public int id; @@ -1726,7 +1726,7 @@ namespace TL [TLDef(0x695150D7)] public partial class MessageMediaPhoto : MessageMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Photo [IfFlag(0)] public PhotoBase photo; @@ -1772,7 +1772,7 @@ namespace TL [TLDef(0x9CB070D7)] public partial class MessageMediaDocument : MessageMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; @@ -1826,7 +1826,7 @@ namespace TL [TLDef(0xF6A548D3)] public class MessageMediaInvoice : MessageMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Product name, 1-32 characters public string title; @@ -1862,7 +1862,7 @@ namespace TL [TLDef(0xB940C666)] public partial class MessageMediaGeoLive : MessageMedia { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Geolocation public GeoPoint geo; @@ -1900,7 +1900,7 @@ namespace TL public string emoticon; } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See @@ -1992,7 +1992,7 @@ namespace TL [TLDef(0x8F31B327)] public class MessageActionPaymentSentMe : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Three-letter ISO 4217 currency code public string currency; @@ -2023,7 +2023,7 @@ namespace TL [TLDef(0x96163F56)] public class MessageActionPaymentSent : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Three-letter ISO 4217 currency code public string currency; @@ -2046,7 +2046,7 @@ namespace TL [TLDef(0x80E11A7F)] public class MessageActionPhoneCall : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Call ID public long call_id; @@ -2079,7 +2079,7 @@ namespace TL [TLDef(0xC516D679)] public class MessageActionBotAllowed : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// We have authorized the bot to send us messages by logging into a website via Telegram Login »; this field contains the domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; @@ -2130,7 +2130,7 @@ namespace TL [TLDef(0x7A0D7F42)] public class MessageActionGroupCall : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Group call public InputGroupCall call; @@ -2156,7 +2156,7 @@ namespace TL [TLDef(0x3C134D7B)] public class MessageActionSetMessagesTTL : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// New Time-To-Live of all messages sent in this chat; if 0, autodeletion was disabled. public int period; @@ -2206,6 +2206,7 @@ namespace TL [TLDef(0xC83D6AEC)] public class MessageActionGiftPremium : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Three-letter ISO 4217 currency code public string currency; @@ -2218,7 +2219,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields and have a value has_crypto_currency = 0x1, } } @@ -2226,7 +2227,7 @@ namespace TL [TLDef(0x0D999256)] public class MessageActionTopicCreate : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Topic name. public string title; @@ -2245,7 +2246,7 @@ namespace TL [TLDef(0xC0944820)] public class MessageActionTopicEdit : MessageAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Topic title. [IfFlag(0)] public string title; @@ -2306,7 +2307,7 @@ namespace TL [TLDef(0xD58A08C6)] public class Dialog : DialogBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The chat public Peer peer; @@ -2358,7 +2359,7 @@ namespace TL [TLDef(0x71BD134C)] public class DialogFolder : DialogBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The folder public Folder folder; @@ -2400,7 +2401,7 @@ namespace TL [TLDef(0xFB197A65)] public partial class Photo : PhotoBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID public long id; @@ -2520,7 +2521,7 @@ namespace TL [TLDef(0xB2A2F663)] public partial class GeoPoint : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Longitude public double lon; @@ -2544,7 +2545,7 @@ namespace TL [TLDef(0x5E002502)] public class Auth_SentCode : Auth_SentCodeBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Phone code type public Auth_SentCodeType type; @@ -2576,7 +2577,7 @@ namespace TL [TLDef(0x2EA2C0D4)] public class Auth_Authorization : Auth_AuthorizationBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Iff setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass. [IfFlag(1)] public int otherwise_relogin_days; @@ -2601,7 +2602,7 @@ namespace TL [TLDef(0x44747E9A)] public class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Telegram's terms of service: the user must read and accept the terms of service before signing up to telegram [IfFlag(0)] public Help_TermsOfService terms_of_service; @@ -2655,7 +2656,7 @@ namespace TL [TLDef(0xDF1F002B)] public class InputPeerNotifySettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If the text of the message shall be displayed in notification [IfFlag(0)] public bool show_previews; @@ -2683,7 +2684,7 @@ namespace TL [TLDef(0xA83B0426)] public class PeerNotifySettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// (Ternary value) If set, indicates whether or not to display previews of messages in notifications; otherwise the default behavior should be used. [IfFlag(0)] public bool show_previews; @@ -2719,7 +2720,7 @@ namespace TL [TLDef(0xA518110D)] public class PeerSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Distance in meters between us and this peer [IfFlag(6)] public int geo_distance; @@ -2748,7 +2749,7 @@ namespace TL autoarchived = 0x80, /// If set, this is a recently created group chat to which new members can be invited invite_members = 0x100, - /// Field has a value + /// Fields and have a value has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, @@ -2769,7 +2770,7 @@ namespace TL { /// Identifier public long id; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Access hash public long access_hash; @@ -2805,7 +2806,7 @@ namespace TL { /// Wallpaper ID public long id; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Info on how to generate the wallpaper. [IfFlag(2)] public WallPaperSettings settings; @@ -2855,7 +2856,7 @@ namespace TL [TLDef(0x93EADB53)] public class UserFull : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User ID public long id; @@ -3095,7 +3096,7 @@ namespace TL [TLDef(0x3A54685E)] public partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of messages in the list public int count; @@ -3118,7 +3119,7 @@ namespace TL [TLDef(0xC776BA4E)] public partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Event count after generation public int pts; @@ -3233,7 +3234,7 @@ namespace TL [TLDef(0x80C99768)] public class InputMessagesFilterPhoneCalls : MessagesFilter { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -3413,7 +3414,7 @@ namespace TL [TLDef(0xEBE46819)] public class UpdateServiceNotification : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// When was the notification received
The message must also be stored locally as part of the message history with the user id 777000 (Telegram Notifications).
[IfFlag(1)] public DateTime inbox_date; @@ -3454,7 +3455,7 @@ namespace TL [TLDef(0x9C974FDF)] public class UpdateReadHistoryInbox : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; @@ -3514,7 +3515,7 @@ namespace TL [TLDef(0x108D941F)] public class UpdateChannelTooLong : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The channel public long channel_id; @@ -3541,7 +3542,7 @@ namespace TL [TLDef(0x922E6E10)] public class UpdateReadChannelInbox : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; @@ -3605,7 +3606,7 @@ namespace TL [TLDef(0x31C24808)] public class UpdateStickerSets : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -3623,7 +3624,7 @@ namespace TL [TLDef(0x496F379C)] public class UpdateBotInlineQuery : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Query ID public long query_id; @@ -3650,7 +3651,7 @@ namespace TL [TLDef(0x12F12A07)] public class UpdateBotInlineSend : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The user that chose the result public long user_id; @@ -3678,7 +3679,7 @@ namespace TL [TLDef(0xB9CFC48D)] public class UpdateBotCallbackQuery : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Query ID public long query_id; @@ -3718,7 +3719,7 @@ namespace TL [TLDef(0x691E9052)] public class UpdateInlineBotCallbackQuery : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Query ID public long query_id; @@ -3754,7 +3755,7 @@ namespace TL [TLDef(0x1B49EC6D)] public class UpdateDraftMessage : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The peer to which the draft is associated public Peer peer; @@ -3792,7 +3793,7 @@ namespace TL [TLDef(0x6E6FE51C)] public class UpdateDialogPinned : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer folder ID, for more info click here [IfFlag(1)] public int folder_id; @@ -3811,7 +3812,7 @@ namespace TL [TLDef(0xFA0F3CA2)] public class UpdatePinnedDialogs : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer folder ID, for more info click here [IfFlag(1)] public int folder_id; @@ -3861,7 +3862,7 @@ namespace TL [TLDef(0x8CAA9A96)] public class UpdateBotPrecheckoutQuery : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Unique query identifier public long query_id; @@ -3914,7 +3915,7 @@ namespace TL [TLDef(0xEA29055D)] public class UpdateChannelReadMessagesContents : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Channel/supergroup ID public long channel_id; @@ -3943,7 +3944,7 @@ namespace TL [TLDef(0xE16459C3)] public class UpdateDialogUnreadMark : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The dialog public DialogPeerBase peer; @@ -3958,7 +3959,7 @@ namespace TL [TLDef(0xACA1657B)] public class UpdateMessagePoll : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Poll ID public long poll_id; @@ -4063,7 +4064,7 @@ namespace TL [TLDef(0x26FFDE7D)] public class UpdateDialogFilter : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Folder ID public int id; @@ -4108,7 +4109,7 @@ namespace TL [TLDef(0xD6B19546)] public class UpdateReadChannelDiscussionInbox : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Discussion group ID public long channel_id; @@ -4123,7 +4124,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields and have a value has_broadcast_id = 0x1, } } @@ -4151,7 +4152,7 @@ namespace TL [TLDef(0x8C88C923)] public class UpdateChannelUserTyping : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Channel ID public long channel_id; @@ -4172,7 +4173,7 @@ namespace TL [TLDef(0xED85EAB5)] public class UpdatePinnedMessages : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer public Peer peer; @@ -4193,7 +4194,7 @@ namespace TL [TLDef(0x5BB98608)] public class UpdatePinnedChannelMessages : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Channel ID public long channel_id; @@ -4241,7 +4242,7 @@ namespace TL [TLDef(0xBB9BB9A5)] public class UpdatePeerHistoryTTL : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The chat public Peer peer; @@ -4258,7 +4259,7 @@ namespace TL [TLDef(0xD087663A)] public class UpdateChatParticipant : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Chat ID public long chat_id; @@ -4291,7 +4292,7 @@ namespace TL [TLDef(0x985D3ABB)] public class UpdateChannelParticipant : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Channel ID public long channel_id; @@ -4338,7 +4339,7 @@ namespace TL [TLDef(0x0B783982)] public class UpdateGroupCallConnection : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// WebRTC parameters public DataJSON params_; @@ -4392,7 +4393,7 @@ namespace TL [TLDef(0x5E1B3CB8)] public class UpdateMessageReactions : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer public Peer peer; @@ -4435,7 +4436,7 @@ namespace TL [TLDef(0x0084CD5A)] public class UpdateTranscribedAudio : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer of the transcribed message public Peer peer; @@ -4472,7 +4473,7 @@ namespace TL [TLDef(0x86FCCF85)] public class UpdateMoveStickerSetToTop : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Stickerset ID public long stickerset; @@ -4497,7 +4498,7 @@ namespace TL [TLDef(0x192EFBE3)] public class UpdateChannelPinnedTopic : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The forum ID public long channel_id; @@ -4514,7 +4515,7 @@ namespace TL [TLDef(0xFE198602)] public class UpdateChannelPinnedTopics : Update { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Forum ID. public long channel_id; @@ -4669,7 +4670,7 @@ namespace TL [TLDef(0x313BC7F8)] public partial class UpdateShortMessage : UpdatesBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The message ID public int id; @@ -4725,7 +4726,7 @@ namespace TL [TLDef(0x4D6DEEA5)] public partial class UpdateShortChatMessage : UpdatesBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the message public int id; @@ -4839,7 +4840,7 @@ namespace TL [TLDef(0x9015E101)] public partial class UpdateShortSentMessage : UpdatesBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the sent message public int id; @@ -4934,7 +4935,7 @@ namespace TL [TLDef(0x18B7A10D)] public class DcOption : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// DC ID public int id; @@ -4968,7 +4969,7 @@ namespace TL [TLDef(0xCC1A241E)] public class Config : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current date at the server public DateTime date; @@ -5059,7 +5060,7 @@ namespace TL { /// Field has a value has_tmp_sessions = 0x1, - /// Field has a value + /// Fields , and have a value has_suggested_lang_code = 0x4, /// Whether the client should use P2P by default for phone calls with contacts default_p2p_contacts = 0x8, @@ -5105,7 +5106,7 @@ namespace TL [TLDef(0xCCBBCE30)] public class Help_AppUpdate : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Update ID public int id; @@ -5197,7 +5198,7 @@ namespace TL [TLDef(0x48F1D94C)] public class EncryptedChatRequested : EncryptedChatBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer folder ID, for more info click here [IfFlag(0)] public int folder_id; @@ -5265,7 +5266,7 @@ namespace TL [TLDef(0x1E1C7C45)] public class EncryptedChatDiscarded : EncryptedChatBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Chat ID public int id; @@ -5480,7 +5481,7 @@ namespace TL [TLDef(0x8FD4C4D8)] public partial class Document : DocumentBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Document ID public long id; @@ -5831,7 +5832,7 @@ namespace TL [TLDef(0x6319D612)] public class DocumentAttributeSticker : DocumentAttribute { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Alternative emoji representation of sticker public string alt; @@ -5852,7 +5853,7 @@ namespace TL [TLDef(0x0EF02CE6)] public class DocumentAttributeVideo : DocumentAttribute { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Duration in seconds public int duration; @@ -5873,7 +5874,7 @@ namespace TL [TLDef(0x9852F9C6)] public class DocumentAttributeAudio : DocumentAttribute { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Duration in seconds public int duration; @@ -5910,7 +5911,7 @@ namespace TL [TLDef(0xFD149899)] public class DocumentAttributeCustomEmoji : DocumentAttribute { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The actual emoji public string alt; @@ -6000,7 +6001,7 @@ namespace TL [TLDef(0xE89C45B2)] public class WebPage : WebPageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Preview ID public long id; @@ -6051,9 +6052,9 @@ namespace TL has_description = 0x8, /// Field has a value has_photo = 0x10, - /// Field has a value + /// Fields and have a value has_embed_url = 0x20, - /// Field has a value + /// Fields and have a value has_embed_width = 0x40, /// Field has a value has_duration = 0x80, @@ -6074,7 +6075,7 @@ namespace TL [TLDef(0x7311CA11)] public class WebPageNotModified : WebPageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Page view count [IfFlag(0)] public int cached_page_views; @@ -6090,7 +6091,7 @@ namespace TL [TLDef(0xAD01D61D)] public class Authorization : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier public long hash; @@ -6146,7 +6147,7 @@ namespace TL [TLDef(0x957B50FB)] public class Account_Password : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The KDF algorithm for SRP two-factor authentication of the current password [IfFlag(2)] public PasswordKdfAlgo current_algo; @@ -6192,7 +6193,7 @@ namespace TL [TLDef(0x9A5C33E5)] public class Account_PasswordSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// 2FA Recovery email [IfFlag(0)] public string email; @@ -6212,7 +6213,7 @@ namespace TL [TLDef(0xC23727C9)] public class Account_PasswordInputSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The SRP algorithm to use [IfFlag(0)] public PasswordKdfAlgo new_algo; @@ -6227,7 +6228,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields , and have a value has_new_algo = 0x1, /// Field has a value has_email = 0x2, @@ -6260,7 +6261,7 @@ namespace TL [TLDef(0x0AB4A819)] public class ChatInviteExported : ExportedChatInvite { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Chat invitation link public string link; @@ -6320,7 +6321,7 @@ namespace TL [TLDef(0x300C44C1)] public class ChatInvite : ChatInviteBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Chat/supergroup/channel title public string title; @@ -6410,7 +6411,7 @@ namespace TL [TLDef(0x2DD14EDC)] public partial class StickerSet : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// When was this stickerset installed [IfFlag(0)] public DateTime installed_date; @@ -6445,7 +6446,7 @@ namespace TL official = 0x4, /// Is this a mask stickerset masks = 0x8, - /// Field has a value + /// Fields , and have a value has_thumbs = 0x10, /// Is this an animated stickerpack animated = 0x20, @@ -6487,7 +6488,7 @@ namespace TL [TLDef(0x8F300B57)] public class BotInfo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the bot [IfFlag(0)] public long user_id; @@ -6546,7 +6547,7 @@ namespace TL [TLDef(0x35BBDB6B)] public class KeyboardButtonCallback : KeyboardButtonBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Button text public string text; @@ -6576,7 +6577,7 @@ namespace TL [TLDef(0x93B9FBB5)] public class KeyboardButtonSwitchInline : KeyboardButtonBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Button label public string text; @@ -6609,7 +6610,7 @@ namespace TL [TLDef(0x10B78D29)] public class KeyboardButtonUrlAuth : KeyboardButtonBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Button label public string text; @@ -6633,7 +6634,7 @@ namespace TL [TLDef(0xD02E7FD4)] public class InputKeyboardButtonUrlAuth : KeyboardButtonBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Button text public string text; @@ -6659,7 +6660,7 @@ namespace TL [TLDef(0xBBC7515D)] public class KeyboardButtonRequestPoll : KeyboardButton { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, only quiz polls can be sent [IfFlag(0)] public bool quiz; @@ -6725,7 +6726,7 @@ namespace TL [TLDef(0xA03E5B85)] public class ReplyKeyboardHide : ReplyMarkup { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -6738,7 +6739,7 @@ namespace TL [TLDef(0x86B40B08)] public class ReplyKeyboardForceReply : ReplyMarkup { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The placeholder to be shown in the input field when the keyboard is active; 1-64 characters. [IfFlag(3)] public string placeholder; @@ -6757,7 +6758,7 @@ namespace TL [TLDef(0x85DD99D1)] public class ReplyKeyboardMarkup : ReplyMarkup { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Button row public KeyboardButtonRow[] rows; @@ -6946,7 +6947,7 @@ namespace TL [TLDef(0x3E11AFFB)] public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The latest PTS public int pts; @@ -6967,7 +6968,7 @@ namespace TL [TLDef(0xA4BCC6FE)] public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed [IfFlag(1)] public int timeout; @@ -6994,7 +6995,7 @@ namespace TL [TLDef(0x2064674E)] public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The PTS from which to start getting updates the next time public int pts; @@ -7025,7 +7026,7 @@ namespace TL [TLDef(0xCD77D957)] public class ChannelMessagesFilter : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// A range of messages to fetch public MessageRange[] ranges; @@ -7052,7 +7053,7 @@ namespace TL [TLDef(0x35A8BFA7)] public partial class ChannelParticipantSelf : ChannelParticipantBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User ID public long user_id; @@ -7071,7 +7072,7 @@ namespace TL [TLDef(0x2FE601D3)] public partial class ChannelParticipantCreator : ChannelParticipantBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User ID public long user_id; @@ -7090,7 +7091,7 @@ namespace TL [TLDef(0x34C3BB53)] public partial class ChannelParticipantAdmin : ChannelParticipantBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Admin user ID public long user_id; @@ -7119,7 +7120,7 @@ namespace TL [TLDef(0x6DF8014E)] public partial class ChannelParticipantBanned : ChannelParticipantBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The banned peer public Peer peer; @@ -7187,7 +7188,7 @@ namespace TL [TLDef(0xE04B5CEB)] public class ChannelParticipantsMentions : ChannelParticipantsFilter { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Filter by user name or username [IfFlag(0)] public string q; @@ -7238,7 +7239,7 @@ namespace TL [TLDef(0x780A0310)] public class Help_TermsOfService : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the new terms public DataJSON id; @@ -7275,7 +7276,7 @@ namespace TL [TLDef(0x3380C786)] public class InputBotInlineMessageMediaAuto : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Caption public string message; @@ -7296,7 +7297,7 @@ namespace TL [TLDef(0x3DCD7A87)] public class InputBotInlineMessageText : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message public string message; @@ -7319,7 +7320,7 @@ namespace TL [TLDef(0x96929A85)] public class InputBotInlineMessageMediaGeo : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Geolocation public InputGeoPoint geo_point; @@ -7348,7 +7349,7 @@ namespace TL [TLDef(0x417BBF11)] public class InputBotInlineMessageMediaVenue : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Geolocation public InputGeoPoint geo_point; @@ -7375,7 +7376,7 @@ namespace TL [TLDef(0xA6EDBFFD)] public class InputBotInlineMessageMediaContact : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Phone number public string phone_number; @@ -7398,7 +7399,7 @@ namespace TL [TLDef(0x4B425864)] public class InputBotInlineMessageGame : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; @@ -7413,7 +7414,7 @@ namespace TL [TLDef(0xD7E78225)] public class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Product name, 1-32 characters public string title; @@ -7453,7 +7454,7 @@ namespace TL [TLDef(0x88BF9319)] public class InputBotInlineResult : InputBotInlineResultBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of result public string id; @@ -7513,7 +7514,7 @@ namespace TL [TLDef(0xFFF8FDC4)] public class InputBotInlineResultDocument : InputBotInlineResultBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Result ID public string id; @@ -7564,7 +7565,7 @@ namespace TL [TLDef(0x764CF810)] public class BotInlineMessageMediaAuto : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Caption public string message; @@ -7585,7 +7586,7 @@ namespace TL [TLDef(0x8C7F65E2)] public class BotInlineMessageText : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The message public string message; @@ -7608,7 +7609,7 @@ namespace TL [TLDef(0x051846FD)] public class BotInlineMessageMediaGeo : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Geolocation public GeoPoint geo; @@ -7637,7 +7638,7 @@ namespace TL [TLDef(0x8A86659C)] public class BotInlineMessageMediaVenue : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Geolocation of venue public GeoPoint geo; @@ -7664,7 +7665,7 @@ namespace TL [TLDef(0x18D1CDC2)] public class BotInlineMessageMediaContact : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Phone number public string phone_number; @@ -7687,7 +7688,7 @@ namespace TL [TLDef(0x354A9B09)] public class BotInlineMessageMediaInvoice : BotInlineMessage { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Product name, 1-32 characters public string title; @@ -7733,7 +7734,7 @@ namespace TL [TLDef(0x11965F3A)] public class BotInlineResult : BotInlineResultBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Result ID public string id; @@ -7781,7 +7782,7 @@ namespace TL [TLDef(0x17DB940B)] public class BotInlineMediaResult : BotInlineResultBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Result ID public string id; @@ -7826,7 +7827,7 @@ namespace TL [TLDef(0xE021F2F6)] public class Messages_BotResults : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Query ID public long query_id; @@ -7870,7 +7871,7 @@ namespace TL [TLDef(0x5F777DCE)] public class MessageFwdHeader : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The ID of the user that originally sent the message [IfFlag(0)] public Peer from_id; @@ -7897,7 +7898,7 @@ namespace TL has_channel_post = 0x4, /// Field has a value has_post_author = 0x8, - /// Field has a value + /// Fields and have a value has_saved_from_peer = 0x10, /// Field has a value has_from_name = 0x20, @@ -7964,7 +7965,7 @@ namespace TL [TLDef(0xF450F59B)] public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Pattern of the email public string email_pattern; @@ -7989,7 +7990,7 @@ namespace TL [TLDef(0xA5491DEA)] public class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -8011,7 +8012,7 @@ namespace TL [TLDef(0xE57B1432)] public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; @@ -8022,7 +8023,7 @@ namespace TL { /// Field has a value has_nonce = 0x1, - /// Field has a value + /// Fields and have a value has_receipt = 0x2, } } @@ -8031,7 +8032,7 @@ namespace TL [TLDef(0x36585EA4)] public class Messages_BotCallbackAnswer : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Alert to show [IfFlag(0)] public string message; @@ -8059,7 +8060,7 @@ namespace TL [TLDef(0x26B5DDE6)] public class Messages_MessageEditData : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -8209,7 +8210,7 @@ namespace TL [TLDef(0x1B0C841A)] public class DraftMessageEmpty : DraftMessageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// When was the draft last updated [IfFlag(0)] public DateTime date; @@ -8224,7 +8225,7 @@ namespace TL [TLDef(0xFD8E711F)] public class DraftMessage : DraftMessageBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The message this message will reply to [IfFlag(0)] public int reply_to_msg_id; @@ -8259,7 +8260,7 @@ namespace TL [TLDef(0xBE382906)] public class Messages_FeaturedStickers : Messages_FeaturedStickersBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Hash for pagination, for more info click here public long hash; @@ -8407,7 +8408,7 @@ namespace TL [TLDef(0xBDF9653B)] public partial class Game : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of the game public long id; @@ -8701,7 +8702,7 @@ namespace TL [TLDef(0x1759C560)] public class PageBlockPhoto : PageBlock { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Photo ID public long photo_id; @@ -8714,7 +8715,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields and have a value has_url = 0x1, } } @@ -8722,7 +8723,7 @@ namespace TL [TLDef(0x7C8FE7B6)] public class PageBlockVideo : PageBlock { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Video ID public long video_id; @@ -8748,7 +8749,7 @@ namespace TL [TLDef(0xA8718DC5)] public class PageBlockEmbed : PageBlock { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Web page URL, if available [IfFlag(1)] public string url; @@ -8775,7 +8776,7 @@ namespace TL allow_scrolling = 0x8, /// Field has a value has_poster_photo_id = 0x10, - /// Field has a value + /// Fields and have a value has_w = 0x20, } } @@ -8843,7 +8844,7 @@ namespace TL [TLDef(0xBF4DEA82)] public class PageBlockTable : PageBlock { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Title public RichText title; @@ -8869,7 +8870,7 @@ namespace TL [TLDef(0x76768BED)] public class PageBlockDetails : PageBlock { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Block contents public PageBlock[] blocks; @@ -8942,7 +8943,7 @@ namespace TL [TLDef(0x3E85A91B)] public class Invoice : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Three-letter ISO 4217 currency code public string currency; @@ -8973,7 +8974,7 @@ namespace TL phone_to_provider = 0x40, /// Set this flag if user's email address should be sent to provider email_to_provider = 0x80, - /// Field has a value + /// Fields and have a value has_max_tip_amount = 0x100, /// Whether this is a recurring payment recurring = 0x200, @@ -9012,7 +9013,7 @@ namespace TL [TLDef(0x909C3F94)] public class PaymentRequestedInfo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User's full name [IfFlag(0)] public string name; @@ -9153,7 +9154,7 @@ namespace TL [TLDef(0xF46FE924)] public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The audio file in question: must NOT be provided in secret chats, provide the title and performer fields instead. [IfFlag(0)] public InputDocument document; @@ -9166,7 +9167,7 @@ namespace TL { /// Field has a value has_document = 0x1, - /// Field has a value + /// Fields and have a value has_title = 0x2, /// Used to return a thumbnail with 100x100 resolution (instead of the default 600x600) small = 0x4, @@ -9193,7 +9194,7 @@ namespace TL [TLDef(0xA0058751)] public class Payments_PaymentForm : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Form ID public long form_id; @@ -9234,7 +9235,7 @@ namespace TL can_save_credentials = 0x4, /// Indicates that the user can save payment credentials, but only after setting up a 2FA password (currently the account doesn't have a 2FA password) password_missing = 0x8, - /// Field has a value + /// Fields and have a value has_native_provider = 0x10, /// Field has a value has_photo = 0x20, @@ -9247,7 +9248,7 @@ namespace TL [TLDef(0xD1451883)] public class Payments_ValidatedRequestedInfo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID [IfFlag(0)] public string id; @@ -9284,7 +9285,7 @@ namespace TL [TLDef(0x70C4FE03)] public class Payments_PaymentReceipt : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Date of generation public DateTime date; @@ -9332,7 +9333,7 @@ namespace TL [TLDef(0xFB8FE43C)] public class Payments_SavedInfo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Saved server-side order information [IfFlag(0)] public PaymentRequestedInfo saved_info; @@ -9361,7 +9362,7 @@ namespace TL [TLDef(0x3417D728)] public class InputPaymentCredentials : InputPaymentCredentialsBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Payment credentials public DataJSON data; @@ -9413,7 +9414,7 @@ namespace TL [TLDef(0x32DA9E9C)] public class InputStickerSetItem : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The sticker public InputDocument document; @@ -9473,7 +9474,7 @@ namespace TL [TLDef(0xC5226F17)] public class PhoneCallWaiting : PhoneCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Call ID public long id; @@ -9515,7 +9516,7 @@ namespace TL [TLDef(0x14B0ED0C)] public class PhoneCallRequested : PhoneCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Phone call ID public long id; @@ -9555,7 +9556,7 @@ namespace TL [TLDef(0x3660C311)] public class PhoneCallAccepted : PhoneCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of accepted phone call public long id; @@ -9595,7 +9596,7 @@ namespace TL [TLDef(0x967F7C67)] public class PhoneCall : PhoneCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Call ID public long id; @@ -9643,7 +9644,7 @@ namespace TL [TLDef(0x50CA4DE1)] public class PhoneCallDiscarded : PhoneCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Call ID public long id; @@ -9686,7 +9687,7 @@ namespace TL [TLDef(0x9CC123C7)] public class PhoneConnection : PhoneConnectionBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Endpoint ID public long id; @@ -9718,7 +9719,7 @@ namespace TL [TLDef(0x635FE375)] public class PhoneConnectionWebrtc : PhoneConnectionBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Endpoint ID public long id; @@ -9755,7 +9756,7 @@ namespace TL [TLDef(0xFC878FC8)] public class PhoneCallProtocol : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Minimum layer for remote libtgvoip public int min_layer; @@ -9840,7 +9841,7 @@ namespace TL [TLDef(0x6C47AC9F)] public class LangPackStringPluralized : LangPackStringBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Localization key public string key; @@ -9903,7 +9904,7 @@ namespace TL [TLDef(0xEECA5CE3)] public class LangPackLanguage : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Language name public string name; @@ -10139,6 +10140,7 @@ namespace TL [TLDef(0xFE9FC158)] public class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The invite link used to join the supergroup/channel public ExportedChatInvite invite; @@ -10262,7 +10264,7 @@ namespace TL [TLDef(0x5D8D353B)] public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Previous topic information [IfFlag(0)] public ForumTopicBase prev_topic; @@ -10317,7 +10319,7 @@ namespace TL [TLDef(0xEA107AE4)] public partial class ChannelAdminLogEventsFilter : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -10440,7 +10442,7 @@ namespace TL [TLDef(0x1CC6E91F)] public class InputSingleMedia : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The media public InputMedia media; @@ -10729,7 +10731,7 @@ namespace TL [TLDef(0x187FA0CA)] public class SecureValue : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Secure passport value type public SecureValueType type; @@ -10773,7 +10775,7 @@ namespace TL [TLDef(0xDB21D0A7)] public class InputSecureValue : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Secure passport value type public SecureValueType type; @@ -10970,7 +10972,7 @@ namespace TL [TLDef(0xAD2E1CD8)] public class Account_AuthorizationForm : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Required Telegram Passport documents public SecureRequiredTypeBase[] required_types; @@ -11005,7 +11007,7 @@ namespace TL [TLDef(0x6A4EE832)] public class Help_DeepLinkInfo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message to show to the user public string message; @@ -11107,7 +11109,7 @@ namespace TL [TLDef(0x829D99DA)] public class SecureRequiredType : SecureRequiredTypeBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Secure value type public SecureValueType type; @@ -11210,7 +11212,7 @@ namespace TL [TLDef(0x34566B6A)] public class PageTableCell : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Content [IfFlag(7)] public RichText text; @@ -11300,7 +11302,7 @@ namespace TL [TLDef(0xB390DC08)] public class PageRelatedArticle : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// URL of article public string url; @@ -11336,7 +11338,7 @@ namespace TL [TLDef(0x98657F0D)] public class Page : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Original page HTTP URL public string url; @@ -11401,7 +11403,7 @@ namespace TL { /// ID of the poll public long id; - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The question of the poll public string question; @@ -11433,7 +11435,7 @@ namespace TL [TLDef(0x3B6DDAD2)] public class PollAnswerVoters : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The param that has to be passed to Messages_SendVote. public byte[] option; @@ -11453,7 +11455,7 @@ namespace TL [TLDef(0xDCB82EA3)] public class PollResults : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Poll results [IfFlag(1)] public PollAnswerVoters[] results; @@ -11476,7 +11478,7 @@ namespace TL has_total_voters = 0x4, /// Field has a value has_recent_voters = 0x8, - /// Field has a value + /// Fields and have a value has_solution = 0x10, } } @@ -11501,7 +11503,7 @@ namespace TL [TLDef(0x5FB224D5)] public class ChatAdminRights : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -11537,7 +11539,7 @@ namespace TL [TLDef(0x9F120418)] public class ChatBannedRights : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Validity of said permissions (it is considered forever any value less then 30 seconds or more then 366 days). public DateTime until_date; @@ -11628,7 +11630,7 @@ namespace TL [TLDef(0xAD253D78)] public class CodeSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Previously stored future auth tokens, see the documentation for more info » [IfFlag(6)] public byte[][] logout_tokens; @@ -11649,7 +11651,7 @@ namespace TL has_logout_tokens = 0x40, /// Whether Firebase auth is supported allow_firebase = 0x80, - /// Field has a value + /// Fields and have a value has_token = 0x100, } } @@ -11658,7 +11660,7 @@ namespace TL [TLDef(0x1DC1BCA4)] public class WallPaperSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Used for solid », gradient » and freeform gradient » fills. [IfFlag(0)] public int background_color; @@ -11683,7 +11685,7 @@ namespace TL motion = 0x4, /// Field has a value has_intensity = 0x8, - /// Field has a value + /// Fields and have a value has_second_background_color = 0x10, /// Field has a value has_third_background_color = 0x20, @@ -11696,7 +11698,7 @@ namespace TL [TLDef(0x8EFAB953)] public class AutoDownloadSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Maximum size of photos to preload public int photo_size_max; @@ -11779,7 +11781,7 @@ namespace TL [TLDef(0xFF544E65)] public class Folder : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Folder ID public int id; @@ -11825,7 +11827,7 @@ namespace TL [TLDef(0xE844EBFF)] public class Messages_SearchCounter : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Provided message filter public MessagesFilter filter; @@ -11846,7 +11848,7 @@ namespace TL [TLDef(0x92D33A0E)] public class UrlAuthResultRequest : UrlAuthResult { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Username of a bot, which will be used for user authorization. If not specified, the current bot's username will be assumed. The url's domain must be the same as the domain linked with the bot. See Linking your domain to the bot for more details. public UserBase bot; @@ -11944,7 +11946,7 @@ namespace TL [TLDef(0xA00E67D6)] public partial class Theme : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Theme ID public long id; @@ -12025,7 +12027,7 @@ namespace TL [TLDef(0x57E28221)] public class Account_ContentSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -12070,7 +12072,7 @@ namespace TL [TLDef(0x8FDE504F)] public class InputThemeSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Default theme on which this theme is based public BaseTheme base_theme; @@ -12089,7 +12091,7 @@ namespace TL { /// Field has a value has_message_colors = 0x1, - /// Field has a value + /// Fields and have a value has_wallpaper = 0x2, /// If set, the freeform gradient fill needs to be animated on every sent message message_colors_animated = 0x4, @@ -12102,7 +12104,7 @@ namespace TL [TLDef(0xFA58B6D4)] public class ThemeSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Base theme public BaseTheme base_theme; @@ -12134,7 +12136,7 @@ namespace TL [TLDef(0x54B56617)] public class WebPageAttributeTheme : WebPageAttribute { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Theme files [IfFlag(0)] public DocumentBase[] documents; @@ -12209,7 +12211,7 @@ namespace TL [TLDef(0x0823F649)] public class Messages_VotesList : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of votes for all options (or only for the chosen option, if provided to Messages_GetPollVotes) public int count; @@ -12247,7 +12249,7 @@ namespace TL public BankCardOpenUrl[] open_urls; } - /// Dialog filter (folder ») See Derived classes: + /// Dialog filter (folder ») See Derived classes: , /// a value means dialogFilterDefault public abstract class DialogFilterBase : IObject { @@ -12266,7 +12268,7 @@ namespace TL [TLDef(0x7438F7E8)] public class DialogFilter : DialogFilterBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Folder ID public int id; @@ -12318,6 +12320,7 @@ namespace TL [TLDef(0xD64A04A8)] public class DialogFilterChatlist : DialogFilterBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int id; public string title; @@ -12327,6 +12330,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_emoticon = 0x2000000, has_my_invites = 0x4000000, } @@ -12398,7 +12402,7 @@ namespace TL [TLDef(0x8EA464B6)] public class StatsGraph : StatsGraphBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Statistics data public DataJSON json; @@ -12473,7 +12477,7 @@ namespace TL [TLDef(0x8C39793F)] public class Help_PromoData : Help_PromoDataBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Expiry of PSA/MTProxy info public DateTime expires; @@ -12507,7 +12511,7 @@ namespace TL [TLDef(0xDE33B094)] public class VideoSize : VideoSizeBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// u for animated profile pictures, and v for trimmed and downscaled video previews public string type; @@ -12627,7 +12631,7 @@ namespace TL [TLDef(0xBEA2F424)] public class GlobalPrivacySettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Whether to archive and mute new chats from non-contacts [IfFlag(0)] public bool archive_and_mute_new_noncontact_peers; @@ -12643,7 +12647,7 @@ namespace TL [TLDef(0x4203C5EF)] public class Help_CountryCode : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ISO country code public string country_code; @@ -12665,7 +12669,7 @@ namespace TL [TLDef(0xC3878E23)] public class Help_Country : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ISO code of country public string iso2; @@ -12700,7 +12704,7 @@ namespace TL [TLDef(0x455B853D)] public class MessageViews : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// View count of message [IfFlag(0)] public int views; @@ -12738,7 +12742,7 @@ namespace TL [TLDef(0xA6341782)] public class Messages_DiscussionMessage : IObject, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Discussion messages public MessageBase[] messages; @@ -12772,7 +12776,7 @@ namespace TL [TLDef(0xA6D57763)] public class MessageReplyHeader : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of message to which this message is replying public int reply_to_msg_id; @@ -12798,7 +12802,7 @@ namespace TL [TLDef(0x83D60FC2)] public class MessageReplies : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Contains the total number of replies in this thread or comment section. public int replies; @@ -12872,7 +12876,7 @@ namespace TL [TLDef(0xD597650C)] public class GroupCall : GroupCallBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Group call ID public long id; @@ -12945,7 +12949,7 @@ namespace TL [TLDef(0xEBA636FE)] public class GroupCallParticipant : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer information public Peer peer; @@ -13070,7 +13074,7 @@ namespace TL [TLDef(0x5E0FB7B9)] public class Messages_HistoryImportParsed : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Title of the chat. [IfFlag(2)] public string title; @@ -13104,7 +13108,7 @@ namespace TL [TLDef(0x8C5ADFD9)] public class ChatInviteImporter : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The user public long user_id; @@ -13256,7 +13260,7 @@ namespace TL [TLDef(0x67753AC8)] public class GroupCallParticipantVideo : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Endpoint public string endpoint; @@ -13336,7 +13340,7 @@ namespace TL [TLDef(0xFC25B828)] public class SponsoredMessage : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message ID public byte[] random_id; @@ -13369,7 +13373,7 @@ namespace TL has_channel_post = 0x4, /// Field has a value has_from_id = 0x8, - /// Field has a value + /// Fields and have a value has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, @@ -13387,7 +13391,7 @@ namespace TL [TLDef(0xC9EE1D87)] public class Messages_SponsoredMessages : IObject, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; @@ -13425,7 +13429,7 @@ namespace TL [TLDef(0x147EE23C)] public class Messages_SearchResultsCalendar : IObject, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of results matching query public int count; @@ -13525,7 +13529,7 @@ namespace TL [TLDef(0xC3A2835F)] public class Auth_LoggedOut : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Future auth token » to be used on subsequent authorizations [IfFlag(0)] public byte[] future_auth_token; @@ -13541,7 +13545,7 @@ namespace TL [TLDef(0xA3D1CB80)] public class ReactionCount : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, indicates that the current user also sent this reaction.
The integer value indicates when was the reaction added: the bigger the value, the newer the reaction.
[IfFlag(0)] public int chosen_order; @@ -13561,7 +13565,7 @@ namespace TL [TLDef(0x4F2B9479)] public class MessageReactions : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Reactions public ReactionCount[] results; @@ -13583,7 +13587,7 @@ namespace TL [TLDef(0x31BD492D)] public class Messages_MessageReactionsList : IObject, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of reactions matching query public int count; @@ -13609,7 +13613,7 @@ namespace TL [TLDef(0xC077EC01)] public class AvailableReaction : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Reaction emoji public string reaction; @@ -13634,7 +13638,7 @@ namespace TL { /// If not set, the reaction can be added to new messages and enabled in chats. inactive = 0x1, - /// Field has a value + /// Fields and have a value has_around_animation = 0x2, /// Whether this reaction can only be used by Telegram Premium users premium = 0x4, @@ -13656,7 +13660,7 @@ namespace TL [TLDef(0x8C79B63C)] public class MessagePeerReaction : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer that reacted to the message public Peer peer_id; @@ -13718,7 +13722,7 @@ namespace TL [TLDef(0xB2A7386B)] public class AttachMenuBotIcon : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot web app.

default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
public string name; @@ -13738,7 +13742,7 @@ namespace TL [TLDef(0xC8AA2CD2)] public class AttachMenuBot : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Bot ID public long bot_id; @@ -13809,7 +13813,7 @@ namespace TL [TLDef(0x0C94511C)] public class WebViewMessageSent : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message ID [IfFlag(0)] public InputBotInlineMessageIDBase msg_id; @@ -13928,7 +13932,7 @@ namespace TL [TLDef(0x93752C52)] public class Messages_TranscribedAudio : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Transcription ID public long transcription_id; @@ -13966,7 +13970,7 @@ namespace TL [TLDef(0xA6751E66)] public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -13993,7 +13997,7 @@ namespace TL [TLDef(0x74C34319)] public class PremiumGiftOption : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Duration of gifted Telegram Premium subscription public int months; @@ -14075,7 +14079,7 @@ namespace TL [TLDef(0x52928BCA)] public class ChatReactionsAll : ChatReactions { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -14164,7 +14168,7 @@ namespace TL [TLDef(0x5F2D1DF2)] public class PremiumSubscriptionOption : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the last in-store transaction for the currently used subscription on the current account. [IfFlag(3)] public string transaction; @@ -14196,7 +14200,7 @@ namespace TL [TLDef(0xB81C7034)] public class SendAsPeer : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer public Peer peer; @@ -14214,7 +14218,7 @@ namespace TL [TLDef(0xAD628CC8)] public class MessageExtendedMediaPreview : MessageExtendedMediaBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public int w; [IfFlag(0)] public int h; @@ -14223,7 +14227,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value + /// Fields and have a value has_w = 0x1, /// Field has a value has_thumb = 0x2, @@ -14252,7 +14256,7 @@ namespace TL [TLDef(0xB4073647)] public class Username : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The username. public string username; @@ -14286,7 +14290,7 @@ namespace TL [TLDef(0x71701DA9)] public class ForumTopic : ForumTopicBase { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Topic ID public int id; @@ -14343,7 +14347,7 @@ namespace TL [TLDef(0x367617D3)] public class Messages_ForumTopics : IObject, IPeerResolver { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of topics matching query; may be less than the topics contained in topics, in which case pagination is required. public int count; @@ -14391,7 +14395,7 @@ namespace TL [TLDef(0x5F3B8A00)] public class RequestPeerTypeUser : RequestPeerType { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Whether to allow choosing only bots. [IfFlag(0)] public bool bot; @@ -14410,7 +14414,7 @@ namespace TL [TLDef(0xC9F06E1B)] public class RequestPeerTypeChat : RequestPeerType { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If specified, allows only choosing channels with or without a username, according to the value of . [IfFlag(3)] public bool has_username; @@ -14441,7 +14445,7 @@ namespace TL [TLDef(0x339BEF6C)] public class RequestPeerTypeBroadcast : RequestPeerType { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If specified, allows only choosing channels with or without a username, according to the value of . [IfFlag(3)] public bool has_username; @@ -14521,7 +14525,7 @@ namespace TL [TLDef(0xC84834CE)] public class AutoSaveSettings : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, specifies a size limit for autosavable videos [IfFlag(2)] public long video_max_size; @@ -14604,7 +14608,7 @@ namespace TL [TLDef(0x95FCD1D6)] public class BotApp : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Bot web app ID public long id; @@ -14634,7 +14638,7 @@ namespace TL [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { - /// Flags, see TL conditional fields + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Bot app information public BotApp app; @@ -14678,7 +14682,7 @@ namespace TL public DateTime date; } - /// See + /// See Derived classes: public abstract class InputChatlist : IObject { } /// See [TLDef(0xF3E0DA33)] @@ -14691,6 +14695,7 @@ namespace TL [TLDef(0x0C5181AC)] public class ExportedChatlistInvite : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string title; public string url; @@ -14720,7 +14725,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , public abstract class Chatlists_ChatlistInviteBase : IObject { public virtual Dictionary Chats { get; } @@ -14745,6 +14750,7 @@ namespace TL [TLDef(0x1DCD839D)] public class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string title; [IfFlag(0)] public string emoticon; @@ -14754,6 +14760,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_emoticon = 0x1, } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e15471c..f1b7b23 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -183,6 +183,7 @@ namespace TL }); /// Login as a bot See [bots: ✓] Possible codes: 400 (details) + /// Reserved for future use /// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// Bot token (see bots) @@ -312,7 +313,7 @@ namespace TL ios_push_secret = ios_push_secret, }); - /// See + /// See [bots: ✓] public static Task Auth_ResetLoginEmail(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResetLoginEmail { @@ -2371,8 +2372,7 @@ namespace TL limit = limit, }); - /// Get all chats, channels and supergroups See - /// Except these chats/channels/supergroups + /// See public static Task Messages_GetAllChats(this Client client, long[] except_ids = null) => client.Invoke(new Messages_GetAllChats { @@ -3639,7 +3639,7 @@ namespace TL platform = platform, }); - /// See + /// See [bots: ✓] public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null) => client.Invoke(new Messages_SetChatWallPaper { @@ -4747,7 +4747,7 @@ namespace TL lang_code = lang_code, }); - /// See + /// See [bots: ✓] public static Task Bots_ReorderUsernames(this Client client, InputUserBase bot, params string[] order) => client.Invoke(new Bots_ReorderUsernames { @@ -4755,7 +4755,7 @@ namespace TL order = order, }); - /// See + /// See [bots: ✓] public static Task Bots_ToggleUsername(this Client client, InputUserBase bot, string username, bool active) => client.Invoke(new Bots_ToggleUsername { @@ -5472,7 +5472,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See [bots: ✓] public static Task Chatlists_ExportChatlistInvite(this Client client, InputChatlist chatlist, string title, params InputPeer[] peers) => client.Invoke(new Chatlists_ExportChatlistInvite { @@ -5481,7 +5481,7 @@ namespace TL peers = peers, }); - /// See + /// See [bots: ✓] public static Task Chatlists_DeleteExportedInvite(this Client client, InputChatlist chatlist, string slug) => client.Invoke(new Chatlists_DeleteExportedInvite { @@ -5489,7 +5489,7 @@ namespace TL slug = slug, }); - /// See + /// See [bots: ✓] public static Task Chatlists_EditExportedInvite(this Client client, InputChatlist chatlist, string slug, string title = null, InputPeer[] peers = null) => client.Invoke(new Chatlists_EditExportedInvite { @@ -5500,21 +5500,21 @@ namespace TL peers = peers, }); - /// See + /// See [bots: ✓] public static Task Chatlists_GetExportedInvites(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetExportedInvites { chatlist = chatlist, }); - /// See + /// See [bots: ✓] public static Task Chatlists_CheckChatlistInvite(this Client client, string slug) => client.Invoke(new Chatlists_CheckChatlistInvite { slug = slug, }); - /// See + /// See [bots: ✓] public static Task Chatlists_JoinChatlistInvite(this Client client, string slug, params InputPeer[] peers) => client.Invoke(new Chatlists_JoinChatlistInvite { @@ -5522,14 +5522,14 @@ namespace TL peers = peers, }); - /// See + /// See [bots: ✓] public static Task Chatlists_GetChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetChatlistUpdates { chatlist = chatlist, }); - /// See + /// See [bots: ✓] public static Task Chatlists_JoinChatlistUpdates(this Client client, InputChatlist chatlist, params InputPeer[] peers) => client.Invoke(new Chatlists_JoinChatlistUpdates { @@ -5537,21 +5537,21 @@ namespace TL peers = peers, }); - /// See + /// See [bots: ✓] public static Task Chatlists_HideChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_HideChatlistUpdates { chatlist = chatlist, }); - /// See + /// See [bots: ✓] public static Task Chatlists_GetLeaveChatlistSuggestions(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetLeaveChatlistSuggestions { chatlist = chatlist, }); - /// See + /// See [bots: ✓] public static Task Chatlists_LeaveChatlist(this Client client, InputChatlist chatlist, params InputPeer[] peers) => client.Invoke(new Chatlists_LeaveChatlist { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 605f1b2..aa35ff2 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -575,7 +575,7 @@ namespace TL [TLDef(0x36B091DE)] public class DecryptedMessage : DecryptedMessageBase { - /// Flags, see TL conditional fields (added in layer 45) + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; @@ -747,7 +747,7 @@ namespace TL [TLDef(0x91CC4674)] public class DecryptedMessage : DecryptedMessageBase { - /// Flags, see TL conditional fields (added in layer 45) + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1f36516..ad1e28b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -24,7 +24,7 @@ Telegram;MTProto;Client;Api;UserBot;TLSharp README.md $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - IDE0079;0419;1573;1591;NETSDK1138 + 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From 35c492de4fcf745efac719fa0c1c7ad2c5226b8d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 25 Apr 2023 20:47:57 +0200 Subject: [PATCH 067/336] moved IsGroup IsChannel up to ChatBase --- src/TL.Helpers.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index bfc0217..cac2c87 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -186,6 +186,8 @@ namespace TL { /// Is this chat among current user active chats? public abstract bool IsActive { get; } + public virtual bool IsChannel => false; + public bool IsGroup => !IsChannel; public virtual string MainUsername => null; public abstract ChatPhoto Photo { get; } /// returns true if you're banned of any of these rights @@ -220,18 +222,18 @@ namespace TL partial class Channel { public override bool IsActive => (flags & Flags.left) == 0; + public override bool IsChannel => (flags & Flags.broadcast) != 0; public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); public static implicit operator InputChannel(Channel channel) => new(channel.id, channel.access_hash); public override string ToString() => (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (MainUsername is string uname ? '@' + uname : $"\"{title}\""); - public bool IsChannel => (flags & Flags.broadcast) != 0; - public bool IsGroup => (flags & Flags.broadcast) == 0; } partial class ChannelForbidden { public override bool IsActive => false; + public override bool IsChannel => (flags & Flags.broadcast) != 0; public override ChatPhoto Photo => null; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => true; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); From 5adde27f88d8264666a83b96a2b7a5734c524355 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 29 Apr 2023 16:45:03 +0200 Subject: [PATCH 068/336] new TLS client hello generation --- src/Client.Helpers.cs | 18 +++---- src/TlsStream.cs | 115 +++++++++++++++++++++++++++++------------- 2 files changed, 88 insertions(+), 45 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 17f7db1..bfb1d5e 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -152,17 +152,7 @@ namespace WTelegram reply_to_msg_id: reply_to_msg_id == 0 ? null : reply_to_msg_id, schedule_date: schedule_date == default ? null : schedule_date); RaiseUpdate(updates); int msgId = -1; - foreach (var update in updates.UpdateList) - { - switch (update) - { - case UpdateMessageID updMsgId when updMsgId.random_id == random_id: msgId = updMsgId.id; break; - case UpdateNewMessage { message: Message message } when message.id == msgId: return message; - case UpdateNewScheduledMessage { message: Message schedMsg } when schedMsg.id == msgId: return schedMsg; - } - } if (updates is UpdateShortSentMessage sent) - { return new Message { flags = (Message.Flags)sent.flags | (reply_to_msg_id == 0 ? 0 : Message.Flags.has_reply_to) | (peer is InputPeerSelf ? 0 : Message.Flags.has_from_id), @@ -171,6 +161,14 @@ namespace WTelegram from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, peer_id = InputToPeer(peer) }; + foreach (var update in updates.UpdateList) + { + switch (update) + { + case UpdateMessageID updMsgId when updMsgId.random_id == random_id: msgId = updMsgId.id; break; + case UpdateNewMessage { message: Message message } when message.id == msgId: return message; + case UpdateNewScheduledMessage { message: Message schedMsg } when schedMsg.id == msgId: return schedMsg; + } } return null; } diff --git a/src/TlsStream.cs b/src/TlsStream.cs index a4b4e9f..97ed1e5 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -85,39 +85,43 @@ namespace WTelegram throw new WTException("TLS Handshake failed"); } - static readonly byte[] TlsClientHello1 = new byte[11] { + static readonly byte[] TlsClientHello1 = new byte[11] { // https://tls13.xargs.org/#client-hello/annotated 0x16, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03 }; // digest[32] // 0x20 // random[32] - // 0x00, 0x20, grease(0) GREASE are two identical bytes ending with nibble 'A' + // 0x00, 0x20 + // grease(0) GREASE are two identical bytes ending with nibble 'A' static readonly byte[] TlsClientHello2 = new byte[34] { 0x13, 0x01, 0x13, 0x02, 0x13, 0x03, 0xc0, 0x2b, 0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30, 0xcc, 0xa9, - 0xcc, 0xa8, 0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d, 0x00, 0x2f, 0x00, 0x35, 0x01, 0x00, 0x01, 0x93 }; - // grease(2), 0x00, 0x00, 0x00, 0x00 - // len { len { 0x00 len { domain } } } len is 16-bit big-endian length of the following block of data - static readonly byte[] TlsClientHello3 = new byte[101] { - 0x00, 0x17, 0x00, 0x00, 0xff, 0x01, 0x00, 0x01, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, - 0x4A, 0x4A, // = grease(4) - 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, - 0x2e, 0x31, 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0d, 0x00, 0x12, 0x00, - 0x10, 0x04, 0x03, 0x08, 0x04, 0x04, 0x01, 0x05, 0x03, 0x08, 0x05, 0x05, 0x01, 0x08, 0x06, 0x06, - 0x01, 0x00, 0x12, 0x00, 0x00, 0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, - 0x4A, 0x4A, // = grease(4) - 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20 }; - // random[32] = public key - static readonly byte[] TlsClientHello4 = new byte[35] { - 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, 0x00, 0x2b, 0x00, 0x0b, 0x0a, - 0x6A, 0x6A, // = grease(6) - 0x03, 0x04, 0x03, 0x03, 0x03, 0x02, 0x03, 0x01, 0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02, - 0x3A, 0x3A, // = grease(3) + 0xcc, 0xa8, 0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d, 0x00, 0x2f, 0x00, 0x35, + 0x01, 0x00, 0x01, 0x93 }; + // grease(2) + // 0x00, 0x00 + static readonly byte[] TlsClientHello3 = new byte[134] { + // 0x00, 0x00, len { len { 0x00 len { domain } } } len is 16-bit big-endian length of the following block of data + 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A,/*=grease(4)*/ 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, + 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, + 0x00, 0x0d, 0x00, 0x12, 0x00, 0x10, 0x04, 0x03, 0x08, 0x04, 0x04, 0x01, 0x05, 0x03, 0x08, 0x05, 0x05, 0x01, 0x08, 0x06, 0x06, 0x01, + 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, + 0x00, 0x12, 0x00, 0x00, + 0x00, 0x17, 0x00, 0x00, + 0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02, + 0x00, 0x23, 0x00, 0x00, + 0x00, 0x2b, 0x00, 0x07, 0x06, 0x6A, 0x6A,/*=grease(6) */ 0x03, 0x04, 0x03, 0x03, + 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, + 0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A,/*=grease(4) */ 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */ + 0x44, 0x69, 0x00, 0x05, 0x00, 0x03, 0x02, 0x68, 0x32, + 0xff, 0x01, 0x00, 0x01, 0x00, + }; + // grease(3) + static readonly byte[] TlsClientHello4 = new byte[5] { 0x00, 0x01, 0x00, 0x00, 0x15 }; // len { padding } padding with NUL bytes to reach 517 bytes static byte[] TlsClientHello(byte[] key, byte[] domain) { - int dlen = domain.Length; var greases = new byte[7]; Encryption.RNG.GetBytes(greases); for (int i = 0; i < 7; i++) greases[i] = (byte)((greases[i] & 0xF0) + 0x0A); @@ -130,19 +134,54 @@ namespace WTelegram buffer[78] = buffer[79] = greases[0]; TlsClientHello2.CopyTo(buffer, 80); buffer[114] = buffer[115] = greases[2]; - buffer[121] = (byte)(dlen + 5); - buffer[123] = (byte)(dlen + 3); - buffer[126] = (byte)dlen; - domain.CopyTo(buffer, 127); - TlsClientHello3.CopyTo(buffer, 127 + dlen); - buffer[142 + dlen] = buffer[143 + dlen] = greases[4]; - buffer[219 + dlen] = buffer[220 + dlen] = greases[4]; - Encryption.RNG.GetBytes(buffer, 228 + dlen, 32); // public key - buffer[228 + dlen + 31] &= 0x7F; // must be positive - TlsClientHello4.CopyTo(buffer, 260 + dlen); - buffer[271 + dlen] = buffer[272 + dlen] = greases[6]; - buffer[288 + dlen] = buffer[289 + dlen] = greases[3]; - buffer[296 + dlen] = (byte)(220 - dlen); + + int dlen = domain.Length; + var server_name = new byte[dlen + 9]; + server_name[3] = (byte)(dlen + 5); + server_name[5] = (byte)(dlen + 3); + server_name[8] = (byte)dlen; + domain.CopyTo(server_name, 9); + + var key_share = new byte[47]; + Array.Copy(TlsClientHello3, 105, key_share, 0, 15); + key_share[6] = key_share[7] = greases[4]; + Encryption.RNG.GetBytes(key_share, 15, 32); // public key + key_share[46] &= 0x7F; // must be positive + + var random = new Random(); + var permutations = new ArraySegment[15]; + for (var i = 0; i < permutations.Length; i++) + { + var j = random.Next(0, i + 1); + if (i != j) permutations[i] = permutations[j]; + permutations[j] = i switch + { + 0 => new(server_name), + 1 => new(TlsClientHello3, 0, 9), + 2 => PatchGrease(TlsClientHello3[9..23], 6, greases[4]), + 3 => new(TlsClientHello3, 23, 6), + 4 => new(TlsClientHello3, 29, 22), + 5 => new(TlsClientHello3, 51, 18), + 6 => new(TlsClientHello3, 69, 4), + 7 => new(TlsClientHello3, 73, 4), + 8 => new(TlsClientHello3, 77, 7), + 9 => new(TlsClientHello3, 84, 4), + 10 => PatchGrease(TlsClientHello3[88..99], 5, greases[6]), + 11 => new(TlsClientHello3, 99, 6), + 12 => new(key_share), + 13 => new(TlsClientHello3, 120, 9), + _ => new(TlsClientHello3, 129, 5), + }; + } + int offset = 118; + foreach (var perm in permutations) + { + Array.Copy(perm.Array, perm.Offset, buffer, offset, perm.Count); + offset += perm.Count; + } + buffer[offset++] = buffer[offset++] = greases[3]; + TlsClientHello4.CopyTo(buffer, offset); + buffer[offset + 6] = (byte)(510 - offset); // patch-in digest with timestamp using var hmac = new HMACSHA256(key); @@ -152,6 +191,12 @@ namespace WTelegram BinaryPrimitives.WriteInt32LittleEndian(digest.AsSpan(28), stamp); digest.CopyTo(buffer, 11); return buffer; + + static ArraySegment PatchGrease(byte[] buffer, int offset, byte grease) + { + buffer[offset] = buffer[offset + 1] = grease; + return new(buffer); + } } } } From 753ac12eb1af981044dde543ede647cbb6a1045f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 1 May 2023 18:21:03 +0200 Subject: [PATCH 069/336] OnUpdate is now only for updates. OnOther is used for other notifications --- Examples/Program_DownloadSavedMedia.cs | 5 ++--- Examples/Program_Heroku.cs | 3 +-- Examples/Program_ListenUpdates.cs | 3 +-- Examples/Program_SecretChats.cs | 3 +-- src/Client.cs | 8 +++++--- 5 files changed, 10 insertions(+), 12 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index c65c13a..186ddbb 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -18,10 +18,9 @@ namespace WTelegramClientTest client.OnUpdate += Client_OnUpdate; Console.ReadKey(); - async Task Client_OnUpdate(IObject arg) + async Task Client_OnUpdate(UpdatesBase updates) { - if (arg is not Updates { updates: var updates } upd) return; - foreach (var update in updates) + foreach (var update in updates.UpdateList) { if (update is not UpdateNewMessage { message: Message message }) continue; // if it's not about a new message, ignore the update diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 70fffdf..23555ae 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -39,9 +39,8 @@ namespace WTelegramClientTest } } - private static async Task Client_OnUpdate(IObject arg) + private static async Task Client_OnUpdate(UpdatesBase updates) { - if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) { diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index b94165e..c69ebb0 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -33,9 +33,8 @@ namespace WTelegramClientTest } // if not using async/await, we could just return Task.CompletedTask - private static async Task Client_OnUpdate(IObject arg) + private static async Task Client_OnUpdate(UpdatesBase updates) { - if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 4b0edf0..637ead7 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -76,9 +76,8 @@ Type a command, or a message to send to the active secret chat:"); } while (true); } - private static async Task Client_OnUpdate(IObject arg) + private static async Task Client_OnUpdate(UpdatesBase updates) { - if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) diff --git a/src/Client.cs b/src/Client.cs index c9006a5..ecf75a7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -25,7 +25,9 @@ namespace WTelegram { /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
- public event Func OnUpdate; + public event Func OnUpdate; + /// This event is called for other types of notifications (login states, reactor errors, ...) + public event Func OnOther; /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler; public delegate Task TcpFactory(string host, int port); @@ -646,7 +648,7 @@ namespace WTelegram } break; case 48: // incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it) - _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; + _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; //TODO: GetFutureSalts break; default: retryLast = false; @@ -688,7 +690,7 @@ namespace WTelegram { try { - var task = OnUpdate?.Invoke(obj); + var task = obj is UpdatesBase updates ? OnUpdate?.Invoke(updates) : OnOther?.Invoke(obj); if (task != null) await task; } catch (Exception ex) From 30618cb316f9ec0109cc11bb9d40c38174b5e543 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 2 May 2023 22:49:38 +0200 Subject: [PATCH 070/336] Implement Future Salts mecanism to prevent replay attacks --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.Helpers.cs | 16 +++++++-------- src/Client.cs | 47 ++++++++++++++++++++++++++++++++++--------- src/Session.cs | 1 + 5 files changed, 49 insertions(+), 19 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index c992487..ffec59b 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.4.3-dev.$(Rev:r) +name: 3.5.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index f5b9a10..78c152a 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.4.$(Rev:r) +name: 3.5.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index bfb1d5e..4512f87 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -684,7 +684,7 @@ namespace WTelegram private static readonly char[] QueryOrFragment = new[] { '?', '#' }; /// Return information about a chat/channel based on Invite Link - /// Channel or Invite Link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname + /// Public link or Invite link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname
Also work without https:// prefix /// to also join the chat/channel /// a Chat or Channel, possibly partial Channel information only (with flag ) public async Task AnalyzeInviteLink(string url, bool join = false) @@ -693,7 +693,7 @@ namespace WTelegram start = url.IndexOf('/', start + 2) + 1; int end = url.IndexOfAny(QueryOrFragment, start); if (end == -1) end = url.Length; - if (start == 0 || end == start) throw new ArgumentException("Invalid URI"); + if (start == 0 || end == start) throw new ArgumentException("Invalid URL"); string hash; if (url[start] == '+') hash = url[(start + 1)..end]; @@ -740,11 +740,11 @@ namespace WTelegram return !ci.flags.HasFlag(ChatInvite.Flags.channel) ? new Chat { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count } : new Channel { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count, - restriction_reason = rrAbout, - flags = (ci.flags.HasFlag(ChatInvite.Flags.broadcast) ? Channel.Flags.broadcast | Channel.Flags.min : Channel.Flags.min) | - (ci.flags.HasFlag(ChatInvite.Flags.public_) ? Channel.Flags.has_username : 0) | - (ci.flags.HasFlag(ChatInvite.Flags.megagroup) ? Channel.Flags.megagroup : 0) | - (ci.flags.HasFlag(ChatInvite.Flags.request_needed) ? Channel.Flags.join_request : 0) }; + restriction_reason = rrAbout, flags = Channel.Flags.min | + (ci.flags.HasFlag(ChatInvite.Flags.broadcast) ? Channel.Flags.broadcast : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.public_) ? Channel.Flags.has_username : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.megagroup) ? Channel.Flags.megagroup : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.request_needed) ? Channel.Flags.join_request : 0) }; } return null; } @@ -758,7 +758,7 @@ namespace WTelegram int start = url.IndexOf("//"); start = url.IndexOf('/', start + 2) + 1; int slash = url.IndexOf('/', start + 2); - if (start == 0 || slash == -1) throw new ArgumentException("Invalid URI"); + if (start == 0 || slash == -1) throw new ArgumentException("Invalid URL"); int end = url.IndexOfAny(QueryOrFragment, slash + 1); if (end == -1) end = url.Length; ChatBase chat; diff --git a/src/Client.cs b/src/Client.cs index ecf75a7..83431ac 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -430,13 +430,13 @@ namespace WTelegram _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); - if (serverSalt != _dcSession.Salt) // salt change happens every 30 min + if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) { - Helpers.Log(2, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); + Helpers.Log(3, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); _dcSession.Salt = serverSalt; - _saltChangeCounter += 1200; // counter is decreased by KeepAlive (we have margin of 10 min) - if (_saltChangeCounter >= 1800) + if (++_saltChangeCounter >= 10) throw new WTException("Server salt changed too often! Security issue?"); + CheckSalt(); } if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); @@ -473,6 +473,35 @@ namespace WTelegram }; } + internal void CheckSalt() + { + lock (_session) + { + _dcSession.Salts ??= new(); + if (_dcSession.Salts.Count != 0) + { + var keys = _dcSession.Salts.Keys; + if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing + var now = DateTime.UtcNow.AddTicks(_dcSession.ServerTicksOffset); + for (; keys.Count > 1 && keys[1] < now; _dcSession.Salt = _dcSession.Salts.Values[0]) + _dcSession.Salts.RemoveAt(0); + if (_dcSession.Salts.Count > 48) return; + } + _dcSession.Salts[DateTime.MaxValue] = 0; + } + Task.Delay(5000).ContinueWith(_ => this.GetFutureSalts(128).ContinueWith(gfs => + { + lock (_session) + { + _dcSession.Salts.Remove(DateTime.MaxValue); + foreach (var entry in gfs.Result.salts) + _dcSession.Salts[entry.valid_since] = entry.salt; + _dcSession.Salt = _dcSession.Salts.Values[0]; + _session.Save(); + } + })); + } + internal MsgContainer ReadMsgContainer(BinaryReader reader) { int count = reader.ReadInt32(); @@ -648,7 +677,8 @@ namespace WTelegram } break; case 48: // incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it) - _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; //TODO: GetFutureSalts + _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; + CheckSalt(); break; default: retryLast = false; @@ -817,7 +847,7 @@ namespace WTelegram #endif await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _saltChangeCounter = 0; + _dcSession.Salts?.Remove(DateTime.MaxValue); _reactorTask = Reactor(_networkStream, _cts); _sendSemaphore.Release(); @@ -840,7 +870,6 @@ namespace WTelegram query = new TL.Methods.Help_GetConfig() }); _session.DcOptions = TLConfig.dc_options; - _saltChangeCounter = 0; if (_dcSession.DataCenter == null) { _dcSession.DataCenter = _session.DcOptions.Where(dc => dc.id == TLConfig.this_dc) @@ -856,7 +885,7 @@ namespace WTelegram { lock (_session) _session.Save(); } - Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0xE00U}"); + Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0x18E00U}"); } private async Task KeepAlive(CancellationToken ct) @@ -865,7 +894,6 @@ namespace WTelegram while (!ct.IsCancellationRequested) { await Task.Delay(Math.Abs(PingInterval) * 1000, ct); - if (_saltChangeCounter > 0) _saltChangeCounter -= Math.Abs(PingInterval); if (PingInterval <= 0) await this.Ping(ping_id++); else // see https://core.telegram.org/api/optimisation#grouping-updates @@ -1224,6 +1252,7 @@ namespace WTelegram } else { + CheckSalt(); using var clearStream = new MemoryStream(1024); using var clearWriter = new BinaryWriter(clearStream); clearWriter.Write(_dcSession.AuthKey, 88, 32); diff --git a/src/Session.cs b/src/Session.cs index 8b06975..535374b 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -24,6 +24,7 @@ namespace WTelegram public byte[] AuthKey; // 2048-bit = 256 bytes public long UserId; public long Salt; + public SortedList Salts; public int Seqno; public long ServerTicksOffset; public long LastSentMsgId; From c052ac2e2ca1e8cb0a180b9cc9b17b795e609442 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 3 May 2023 14:24:52 +0200 Subject: [PATCH 071/336] fix issue with Channels_GetAdminLog helper --- src/Client.Helpers.cs | 7 +++---- src/TL.Helpers.cs | 2 +- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 4512f87..cff35f6 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -553,16 +553,15 @@ namespace WTelegram { var admins = admin == null ? null : new[] { admin }; var result = await this.Channels_GetAdminLog(channel, q, events_filter: events_filter, admins: admins); - if (result.events.Length < 100) return result; var resultFull = result; - List events = new(result.events); - do + var events = new List(result.events); + while (result.events.Length > 0) { result = await this.Channels_GetAdminLog(channel, q, max_id: result.events[^1].id, events_filter: events_filter, admins: admins); events.AddRange(result.events); foreach (var kvp in result.chats) resultFull.chats[kvp.Key] = kvp.Value; foreach (var kvp in result.users) resultFull.users[kvp.Key] = kvp.Value; - } while (result.events.Length >= 100); + } resultFull.events = events.ToArray(); return resultFull; } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index cac2c87..b108333 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -583,7 +583,7 @@ namespace TL partial class ChannelAdminLogEventsFilter { - public static implicit operator ChannelAdminLogEventsFilter(Flags flags) => new() { flags = flags }; + public static implicit operator ChannelAdminLogEventsFilter(Flags flags) => flags == 0 ? null : new() { flags = flags }; } partial class InputMessage From 30fc1cad8d1b092d46062d8be61217f3453e4a58 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 4 May 2023 17:07:47 +0200 Subject: [PATCH 072/336] Support chats cache in AnalyzeInviteLink/GetMessageByLink (closes #148) --- src/Client.Helpers.cs | 49 +++++++++++++++++++++++++++---------------- src/TL.Helpers.cs | 14 ++++++++++++- 2 files changed, 44 insertions(+), 19 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index cff35f6..4bfc62c 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -680,31 +680,31 @@ namespace WTelegram public async Task ReadHistory(InputPeer peer, int max_id = default) => peer is InputPeerChannel channel ? await this.Channels_ReadHistory(channel, max_id) : (await this.Messages_ReadHistory(peer, max_id)) != null; - private static readonly char[] QueryOrFragment = new[] { '?', '#' }; + private static readonly char[] UrlSeparator = new[] { '?', '#', '/' }; /// Return information about a chat/channel based on Invite Link /// Public link or Invite link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname
Also work without https:// prefix /// to also join the chat/channel + /// previously collected chats, to prevent unnecessary ResolveUsername /// a Chat or Channel, possibly partial Channel information only (with flag ) - public async Task AnalyzeInviteLink(string url, bool join = false) + public async Task AnalyzeInviteLink(string url, bool join = false, IDictionary chats = null) { int start = url.IndexOf("//"); start = url.IndexOf('/', start + 2) + 1; - int end = url.IndexOfAny(QueryOrFragment, start); + int end = url.IndexOfAny(UrlSeparator, start); if (end == -1) end = url.Length; if (start == 0 || end == start) throw new ArgumentException("Invalid URL"); string hash; if (url[start] == '+') - hash = url[(start + 1)..end]; + hash = url[(start + 1)..end]; else if (string.Compare(url, start, "joinchat/", 0, 9, StringComparison.OrdinalIgnoreCase) == 0) - hash = url[(start + 9)..end]; + hash = url[(end + 1)..]; else { - var resolved = await this.Contacts_ResolveUsername(url[start..end]); - var chat = resolved.Chat; - if (join && chat != null) + var chat = await CachedOrResolveUsername(url[start..end], chats); + if (join && chat is Channel channel) { - var res = await this.Channels_JoinChannel((Channel)chat); + var res = await this.Channels_JoinChannel(channel); chat = res.Chats[chat.ID]; } return chat; @@ -750,32 +750,45 @@ namespace WTelegram /// Return chat and message details based on a message URL /// Message Link, like https://t.me/c/1234567890/1234 or https://t.me/channelname/1234 + /// previously collected chats, to prevent unnecessary ResolveUsername /// Structure containing the message, chat and user details /// If link is for private group (t.me/c/..), user must have joined the group - public async Task GetMessageByLink(string url) + public async Task GetMessageByLink(string url, IDictionary chats = null) { int start = url.IndexOf("//"); start = url.IndexOf('/', start + 2) + 1; int slash = url.IndexOf('/', start + 2); if (start == 0 || slash == -1) throw new ArgumentException("Invalid URL"); - int end = url.IndexOfAny(QueryOrFragment, slash + 1); + int end = url.IndexOfAny(UrlSeparator, slash + 1); if (end == -1) end = url.Length; + int msgId = int.Parse(url[(slash + 1)..end]); ChatBase chat; if (url[start] is 'c' or 'C' && url[start + 1] == '/') { long chatId = long.Parse(url[(start + 2)..slash]); - var chats = await this.Channels_GetChannels(new InputChannel(chatId, 0)); - if (!chats.chats.TryGetValue(chatId, out chat)) + var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0)); + if (!mc.chats.TryGetValue(chatId, out chat)) throw new WTException($"Channel {chatId} not found"); } else + chat = await CachedOrResolveUsername(url[start..slash], chats); + if (chat is not Channel channel) throw new WTException($"URL does not identify a valid Channel"); + return await this.Channels_GetMessages(channel, msgId) as Messages_ChannelMessages; + } + + private async Task CachedOrResolveUsername(string username, IDictionary chats = null) + { + if (chats == null) + return (await this.Contacts_ResolveUsername(username)).Chat; + ChatBase chat; + lock (chats) + chat = chats.Values.OfType().FirstOrDefault(ch => ch.ActiveUsernames.Contains(username, StringComparer.OrdinalIgnoreCase)); + if (chat == null) { - var resolved = await this.Contacts_ResolveUsername(url[start..slash]); - chat = resolved.Chat; - if (chat is null) throw new WTException($"@{url[start..slash]} is not a Chat/Channel"); + chat = (await this.Contacts_ResolveUsername(username)).Chat; + if (chat != null) lock (chats) chats[chat.ID] = chat; } - int msgId = int.Parse(url[(slash + 1)..end]); - return await this.Channels_GetMessages((Channel)chat, msgId) as Messages_ChannelMessages; + return chat; } #endregion } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index b108333..8e99634 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -223,12 +223,24 @@ namespace TL { public override bool IsActive => (flags & Flags.left) == 0; public override bool IsChannel => (flags & Flags.broadcast) != 0; - public override string MainUsername => username ?? usernames?.FirstOrDefault(u => u.flags.HasFlag(Username.Flags.active))?.username; + public override string MainUsername => username ?? usernames?.FirstOrDefault(un => un.flags.HasFlag(Username.Flags.active))?.username; public override ChatPhoto Photo => photo; public override bool IsBanned(ChatBannedRights.Flags flags = 0) => ((banned_rights?.flags ?? 0) & flags) != 0 || ((default_banned_rights?.flags ?? 0) & flags) != 0; public override InputPeer ToInputPeer() => new InputPeerChannel(id, access_hash); public static implicit operator InputChannel(Channel channel) => new(channel.id, channel.access_hash); public override string ToString() => (flags.HasFlag(Flags.broadcast) ? "Channel " : "Group ") + (MainUsername is string uname ? '@' + uname : $"\"{title}\""); + public IEnumerable ActiveUsernames + { + get + { + if (username != null) + yield return username; + if (usernames != null) + foreach (var un in usernames) + if (un.flags.HasFlag(Username.Flags.active)) + yield return un.username; + } + } } partial class ChannelForbidden { From be0a357b9b250709995252c4e37eacd5506e234f Mon Sep 17 00:00:00 2001 From: wiz0u <11647984+wiz0u@users.noreply.github.com> Date: Tue, 9 May 2023 03:44:27 +0200 Subject: [PATCH 073/336] Added section: Get chat and user info from a message --- EXAMPLES.md | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index c3cb81a..74f1df1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -484,6 +484,32 @@ else if (firstPeer is ChatBase firstChat) Console.WriteLine($"First dialog is {f *Note: If you need to save/restore those dictionaries between runs of your program, it's up to you to serialize their content to disk* + +## Get chat and user info from a message +First, you should read the above [section about collecting users/chats](#collect-users-chats), and the [FAQ about dealing with IDs](FAQ.md#access-hash). + +A message contains those two fields/properties: +- `peer_id`/`Peer` that identify WHERE the message was posted +- `from_id`/`From` that identify WHO posted the message (it can be `null` in some case of anonymous posting) + +These two fields derive from class `Peer` and can be of type `PeerChat`, `PeerChannel` or `PeerUser` depending on the nature of WHERE & WHO (private chat with a user? message posted BY a channel IN a chat? ...) + +The root structure where you obtained the message (typically `UpdatesBase` or `Messages_MessagesBase`) inherits from `IPeerResolver`. This allows you to call `.UserOrChat(peer)` on the root structure, in order to resolve those fields into a `User` class, or a `ChatBase`-derived class (typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID. + +However, in some case _(typically when dealing with updates)_, Telegram might choose to not include details about a peer because it expects you to already know about it (`UserOrChat` returns `null`). That's why you should collect users/chats details each time you're dealing with Updates or other API results inheriting from `IPeerResolver`, and use the collected dictionaries to find details about users/chats ([see previous section](#collect-users-chats) and [Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) example) + +And finally, it may happen that you receive updates of type `UpdateShortMessage` or `UpdateShortChatMessage` with totally unknown peers (even in your collected dictionaries). +In this case, [Telegram recommends](https://core.telegram.org/api/updates#recovering-gaps) that you use the [`Updates_GetDifference`](https://corefork.telegram.org/method/updates.getDifference) method to retrieve the full information associated with the short message. +Here is an example showing how to deal with `UpdateShortMessage`: (same for `UpdateShortChatMessage`) +```csharp +if (updates is UpdateShortMessage usm && !_users.ContainsKey(usm.user_id)) +{ + var fullDiff = await client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0) + fullDiff.CollectUsersChats(_users, _chats); +} +``` + + ## Use a proxy or MTProxy to connect to Telegram SOCKS/HTTPS proxies can be used through the `client.TcpHandler` delegate and a proxy library like [StarkSoftProxy](https://www.nuget.org/packages/StarkSoftProxy/) or [xNetStandard](https://www.nuget.org/packages/xNetStandard/): @@ -546,4 +572,4 @@ This can be done easily using the helper class `WTelegram.SecretChats` offering You can view a full working example at [Examples/Program_SecretChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_SecretChats.cs?ts=4#L11). Secret Chats have been tested successfully with Telegram Android & iOS official clients. -You can also check our [FAQ for more implementation details](FAQ.md#14-secret-chats-implementation-details). \ No newline at end of file +You can also check our [FAQ for more implementation details](FAQ.md#14-secret-chats-implementation-details). From 98f6a26b09a5c12a03ded180107b7e4687168ffa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 11 May 2023 12:46:34 +0200 Subject: [PATCH 074/336] api doc --- src/TL.Schema.cs | 130 ++++++++++++++++++++++++++++++++---------- src/TL.SchemaFuncs.cs | 92 +++++++++++++++++++++--------- 2 files changed, 165 insertions(+), 57 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 8c3c566..f239e33 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -384,6 +384,7 @@ namespace TL public DataJSON provider_data; /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. [IfFlag(1)] public string start_param; + /// Extended media [IfFlag(2)] public InputMedia extended_media; [Flags] public enum Flags : uint @@ -814,6 +815,7 @@ namespace TL { /// Field has a value has_usernames = 0x1, + /// Whether we can edit the profile picture, name, about text and description of this bot because we own it. bot_can_edit = 0x2, } } @@ -1842,6 +1844,7 @@ namespace TL public long total_amount; /// Unique bot deep-linking parameter that can be used to generate this invoice public string start_param; + /// Extended media [IfFlag(4)] public MessageExtendedMediaBase extended_media; [Flags] public enum Flags : uint @@ -2214,7 +2217,9 @@ namespace TL public long amount; /// Duration of the gifted Telegram Premium subscription public int months; + /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; + /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. [IfFlag(0)] public long crypto_amount; [Flags] public enum Flags : uint @@ -2285,13 +2290,14 @@ namespace TL /// The shared peer public Peer peer; } - /// See + /// The wallpaper » of the current chat was changed. See [TLDef(0xBC44A927)] public class MessageActionSetChatWallPaper : MessageAction { + /// New wallpaper public WallPaperBase wallpaper; } - /// See + /// The user applied a wallpaper » previously sent by the other user in a message. See [TLDef(0xC0787D6D)] public class MessageActionSetSameChatWallPaper : MessageActionSetChatWallPaper { } @@ -2564,10 +2570,11 @@ namespace TL has_timeout = 0x4, } } - /// See + /// The user successfully authorized using future auth tokens See [TLDef(0x2390FE44)] public class Auth_SentCodeSuccess : Auth_SentCodeBase { + /// Authorization info public Auth_AuthorizationBase authorization; } @@ -2884,7 +2891,7 @@ namespace TL [IfFlag(14)] public int ttl_period; /// Emoji associated with chat theme [IfFlag(15)] public string theme_emoticon; - /// Anonymized text to be shown instead of the the user's name on forwarded messages + /// Anonymized text to be shown instead of the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a group, see here for more info on how to handle them ». [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; @@ -2892,6 +2899,7 @@ namespace TL [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; /// Telegram Premium subscriptions gift options [IfFlag(19)] public PremiumGiftOption[] premium_gifts; + /// Wallpaper to use in the private chat with the user. [IfFlag(24)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint @@ -4119,7 +4127,7 @@ namespace TL public int read_max_id; /// If set, contains the ID of the channel that contains the post that started the comment thread in the discussion group (channel_id) [IfFlag(0)] public long broadcast_id; - /// If set, contains the ID of the channel post that started the the comment thread + /// If set, contains the ID of the channel post that started the comment thread [IfFlag(0)] public int broadcast_post; [Flags] public enum Flags : uint @@ -4319,6 +4327,7 @@ namespace TL has_new_participant = 0x2, /// Field has a value has_invite = 0x4, + /// Whether the participant joined using a chat folder deep link ». via_chatlist = 0x8, } } @@ -4486,12 +4495,15 @@ namespace TL emojis = 0x2, } } - /// See + /// Extended media update See [TLDef(0x5A73A98C)] public class UpdateMessageExtendedMedia : Update { + /// Peer public Peer peer; + /// Message ID public int msg_id; + /// Extended media public MessageExtendedMediaBase extended_media; } /// A forum topic » was pinned or unpinned. See @@ -6573,7 +6585,7 @@ namespace TL public class KeyboardButtonRequestGeoLocation : KeyboardButton { } - /// Button to force a user to switch to inline mode Pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See + /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See [TLDef(0x93B9FBB5)] public class KeyboardButtonSwitchInline : KeyboardButtonBase { @@ -6583,6 +6595,7 @@ namespace TL public string text; /// The inline query to use public string query; + /// Filter to use when selecting chats. [IfFlag(1)] public InlineQueryPeerType[] peer_types; [Flags] public enum Flags : uint @@ -7971,7 +7984,9 @@ namespace TL public string email_pattern; /// Length of the sent verification code public int length; + /// The login email can be reset by invoking Auth_ResetLoginEmail and waiting for the specified amount of seconds. [IfFlag(3)] public int reset_available_period; + /// An email reset was already requested, and will occur at the specified date. [IfFlag(4)] public DateTime reset_pending_date; [Flags] public enum Flags : uint @@ -8016,7 +8031,9 @@ namespace TL public Flags flags; /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; + /// On iOS, must be compared with the receipt extracted from the received push notification. [IfFlag(1)] public string receipt; + /// On iOS: if a push notification with the ios_push_secret isn't received within push_timeout seconds, the next_type authentication method must be used, with Auth_ResendCode. [IfFlag(1)] public int push_timeout; [Flags] public enum Flags : uint @@ -10147,6 +10164,7 @@ namespace TL [Flags] public enum Flags : uint { + /// The participant joined by importing a chat folder deep link ». via_chatlist = 0x1, } } @@ -11634,7 +11652,9 @@ namespace TL public Flags flags; /// Previously stored future auth tokens, see the documentation for more info » [IfFlag(6)] public byte[][] logout_tokens; + /// Used only by official iOS apps for Firebase auth: device token for apple push. [IfFlag(8)] public string token; + /// Used only by official iOS apps for firebase auth: whether a sandbox-certificate will be used during transmission of the push notification. [IfFlag(8)] public bool app_sandbox; [Flags] public enum Flags : uint @@ -12257,7 +12277,7 @@ namespace TL public virtual int ID { get; } /// Folder name public virtual string Title { get; } - /// Folder emoticon + /// Emoji to use as icon for the folder. public virtual string Emoticon { get; } /// Pinned chats, folders can have unlimited pinned chats public virtual InputPeer[] PinnedPeers { get; } @@ -12274,7 +12294,7 @@ namespace TL public int id; /// Folder name public string title; - /// Folder emoticon + /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; @@ -12309,36 +12329,47 @@ namespace TL public override int ID => id; /// Folder name public override string Title => title; - /// Folder emoticon + /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; /// Include the following chats in this folder public override InputPeer[] IncludePeers => include_peers; } - /// See + /// A folder imported using a chat folder deep link ». See [TLDef(0xD64A04A8)] public class DialogFilterChatlist : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the folder public int id; + /// Name of the folder public string title; + /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; + /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; + /// Chats to include in the folder public InputPeer[] include_peers; [Flags] public enum Flags : uint { /// Field has a value has_emoticon = 0x2000000, + /// Whether the current user has created some chat folder deep links » to share the folder as well. has_my_invites = 0x4000000, } + /// ID of the folder public override int ID => id; + /// Name of the folder public override string Title => title; + /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; + /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; + /// Chats to include in the folder public override InputPeer[] IncludePeers => include_peers; } @@ -13045,20 +13076,20 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Type of the chat from which the inline query was sent. See + /// Inline query peer type. See public enum InlineQueryPeerType : uint { - ///The inline query was sent in a private chat with the bot itself + ///Peer type: private chat with the bot itself SameBotPM = 0x3081ED9D, - ///The inline query was sent in a private chat + ///Peer type: private chat PM = 0x833C0FAC, - ///The inline query was sent in a chat + ///Peer type: chat Chat = 0xD766C50A, - ///The inline query was sent in a supergroup + ///Peer type: supergroup Megagroup = 0x5EC4BE43, - ///The inline query was sent in a channel + ///Peer type: channel Broadcast = 0x6334EE9A, - ///See + ///Peer type: private chat with a bot. BotPM = 0x0E3B2D0C, } @@ -13127,6 +13158,7 @@ namespace TL has_approved_by = 0x2, /// Field has a value has_about = 0x4, + /// The participant joined by importing a chat folder deep link ». via_chatlist = 0x8, } } @@ -14212,17 +14244,21 @@ namespace TL } } - /// See Derived classes: , + /// Extended media See Derived classes: , public abstract class MessageExtendedMediaBase : IObject { } - /// See + /// Extended media preview See [TLDef(0xAD628CC8)] public class MessageExtendedMediaPreview : MessageExtendedMediaBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Width [IfFlag(0)] public int w; + /// Height [IfFlag(0)] public int h; + /// Thumbnail [IfFlag(1)] public PhotoSizeBase thumb; + /// Video duration [IfFlag(2)] public int video_duration; [Flags] public enum Flags : uint @@ -14235,10 +14271,11 @@ namespace TL has_video_duration = 0x4, } } - /// See + /// Extended media See [TLDef(0xEE479C64)] public class MessageExtendedMedia : MessageExtendedMediaBase { + /// Media public MessageMedia media; } @@ -14682,23 +14719,27 @@ namespace TL public DateTime date; } - /// See Derived classes: + /// Represents a folder See Derived classes: public abstract class InputChatlist : IObject { } - /// See + /// Folder ID See [TLDef(0xF3E0DA33)] public class InputChatlistDialogFilter : InputChatlist { + /// Folder ID public int filter_id; } - /// See + /// Exported chat folder deep link ». See [TLDef(0x0C5181AC)] public class ExportedChatlistInvite : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Name of the link public string title; + /// The chat folder deep link ». public string url; + /// Peers to import public Peer[] peers; [Flags] public enum Flags : uint @@ -14706,56 +14747,75 @@ namespace TL } } - /// See + /// Info about an exported chat folder deep link ». See [TLDef(0x10E6E3A6)] public class Chatlists_ExportedChatlistInvite : IObject { + /// Folder ID public DialogFilterBase filter; + /// The exported chat folder deep link ». public ExportedChatlistInvite invite; } - /// See + /// Info about multiple chat folder deep links ». See [TLDef(0x10AB6DC7)] public class Chatlists_ExportedInvites : IObject, IPeerResolver { + /// The chat folder deep links ». public ExportedChatlistInvite[] invites; + /// Related chat information public Dictionary chats; + /// Related user information public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See Derived classes: , + /// Info about a chat folder deep link ». See Derived classes: , public abstract class Chatlists_ChatlistInviteBase : IObject { + /// Related chat information public virtual Dictionary Chats { get; } + /// Related user information public virtual Dictionary Users { get; } } - /// See + /// Updated info about a chat folder deep link » we already imported. See [TLDef(0xFA87F659)] public class Chatlists_ChatlistInviteAlready : Chatlists_ChatlistInviteBase, IPeerResolver { + /// ID of the imported folder public int filter_id; + /// New peers to be imported public Peer[] missing_peers; + /// Peers that were already imported public Peer[] already_peers; + /// Related chat information public Dictionary chats; + /// Related user information public Dictionary users; + /// Related chat information public override Dictionary Chats => chats; + /// Related user information public override Dictionary Users => users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Info about a chat folder deep link ». See [TLDef(0x1DCD839D)] public class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Name of the link public string title; + /// Emoji to use as icon for the folder. [IfFlag(0)] public string emoticon; + /// Supergroups and channels to join public Peer[] peers; + /// Related chat information public Dictionary chats; + /// Related user information public Dictionary users; [Flags] public enum Flags : uint @@ -14764,29 +14824,37 @@ namespace TL has_emoticon = 0x1, } + /// Related chat information public override Dictionary Chats => chats; + /// Related user information public override Dictionary Users => users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Updated information about a chat folder deep link ». See [TLDef(0x93BD878D)] public class Chatlists_ChatlistUpdates : IObject, IPeerResolver { + /// New peers to join public Peer[] missing_peers; + /// Related chat information public Dictionary chats; + /// Related user information public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Localized information about a bot. See [TLDef(0xE8A775B0)] public class Bots_BotInfo : IObject { + /// Bot name public string name; + /// Bot about text public string about; + /// Bot description public string description; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index f1b7b23..70ed69c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -303,6 +303,7 @@ namespace TL /// Phone number /// Phone code hash returned by Auth_SendCode /// On Android, a JWS object obtained as described in the auth documentation » + /// Secret token received via an apple push notification public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) => client.Invoke(new Auth_RequestFirebaseSms { @@ -313,7 +314,9 @@ namespace TL ios_push_secret = ios_push_secret, }); - /// See [bots: ✓] + /// Reset the login email ». See Possible codes: 400 (details) + /// Phone number of the account + /// Phone code hash, obtained as described in the documentation » public static Task Auth_ResetLoginEmail(this Client client, string phone_number, string phone_code_hash) => client.Invoke(new Auth_ResetLoginEmail { @@ -772,6 +775,7 @@ namespace TL }); /// Create and upload a new wallpaper See Possible codes: 400 (details) + /// Set this flag when uploading wallpapers to be passed to Messages_SetChatWallPaper. /// The JPG/PNG wallpaper /// MIME type of uploaded wallpaper /// Wallpaper settings @@ -1086,9 +1090,9 @@ namespace TL order = order, }); - /// Associate or dissociate a purchased fragment.com username to the currently logged-in user. See Possible codes: 400 (details) + /// Activate or deactivate a purchased fragment.com username associated to the currently logged-in user. See Possible codes: 400 (details) /// Username - /// Whether to associate or dissociate it + /// Whether to activate or deactivate it public static Task Account_ToggleUsername(this Client client, string username, bool active) => client.Invoke(new Account_ToggleUsername { @@ -3199,7 +3203,7 @@ namespace TL /// Add this reaction to the recent reactions list ». /// Peer /// Message ID to react to - /// Reaction (a UTF8 emoji) + /// A list of reactions public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, Reaction[] reaction = null, bool big = false, bool add_to_recent = false) => client.Invoke(new Messages_SendReaction { @@ -3527,7 +3531,9 @@ namespace TL { }); - /// See + /// Get information about extended media See + /// Peer + /// Message IDs public static Task Messages_GetExtendedMedia(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_GetExtendedMedia { @@ -3639,7 +3645,11 @@ namespace TL platform = platform, }); - /// See [bots: ✓] + /// Set a custom wallpaper » in a specific private chat with another user. See [bots: ✓] Possible codes: 400 (details) + /// The private chat where the wallpaper will be set + /// The wallpaper », obtained as described in the wallpaper documentation » or from a service message. + /// Wallpaper settings, obtained as described in the wallpaper documentation » or from .wallpaper.settings. + /// If the wallpaper was obtained from a service message, must contain the ID of that message. public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null) => client.Invoke(new Messages_SetChatWallPaper { @@ -3687,8 +3697,9 @@ namespace TL limit = limit, }); - /// Installs a previously uploaded photo as a profile photo. See Possible codes: 400 (details) + /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400 (details) /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. + /// Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user. /// Input photo public static Task Photos_UpdateProfilePhoto(this Client client, InputPhoto id, InputUserBase bot = null, bool fallback = false) => client.Invoke(new Photos_UpdateProfilePhoto @@ -3698,8 +3709,9 @@ namespace TL id = id, }); - /// Updates current user profile photo. See Possible codes: 400 (details) + /// Updates current user profile photo. See [bots: ✓] Possible codes: 400 (details) /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. + /// Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user. /// Profile photo /// Animated profile picture video /// Floating point UNIX timestamp in seconds, indicating the frame of the video/sticker that should be used as static preview; can only be used if video or video_emoji_markup is set. @@ -3971,7 +3983,7 @@ namespace TL { }); - /// Internal use See Possible codes: 403 (details) + /// Can only be used by TSF members to obtain internal information. See Possible codes: 403 (details) /// User ID /// a null value means help.userInfoEmpty public static Task Help_GetUserInfo(this Client client, InputUserBase user_id) @@ -4474,10 +4486,10 @@ namespace TL order = order, }); - /// Associate or dissociate a purchased fragment.com username to a supergroup or channel. See [bots: ✓] Possible codes: 400 (details) + /// Activate or deactivate a purchased fragment.com username associated to a supergroup or channel we own. See [bots: ✓] Possible codes: 400 (details) /// Supergroup or channel /// Username - /// Whether to associate or dissociate the username + /// Whether to activate or deactivate the username public static Task Channels_ToggleUsername(this Client client, InputChannelBase channel, string username, bool active) => client.Invoke(new Channels_ToggleUsername { @@ -4722,8 +4734,10 @@ namespace TL admin_rights = admin_rights, }); - /// Set our about text and description (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Set localized name, about text and description of a bot (or of the current account, if called by a bot). See [bots: ✓] Possible codes: 400 (details) + /// If called by a user, must contain the peer of a bot we own. /// Language code, if left empty update the fallback about text and description + /// New bot name /// New about text /// New description public static Task Bots_SetBotInfo(this Client client, string lang_code, string about = null, string description = null, InputUserBase bot = null, string name = null) @@ -4737,7 +4751,8 @@ namespace TL description = description, }); - /// Get our about text and description (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Get localized name, about text and description of a bot (or of the current account, if called by a bot). See [bots: ✓] Possible codes: 400 (details) + /// If called by a user, must contain the peer of a bot we own. /// Language code, if left empty this method will return the fallback about text and description. public static Task Bots_GetBotInfo(this Client client, string lang_code, InputUserBase bot = null) => client.Invoke(new Bots_GetBotInfo @@ -4747,7 +4762,9 @@ namespace TL lang_code = lang_code, }); - /// See [bots: ✓] + /// Reorder usernames associated to a bot we own. See [bots: ✓] Possible codes: 400 (details) + /// The bot + /// The new order for active usernames. All active usernames must be specified. public static Task Bots_ReorderUsernames(this Client client, InputUserBase bot, params string[] order) => client.Invoke(new Bots_ReorderUsernames { @@ -4755,7 +4772,10 @@ namespace TL order = order, }); - /// See [bots: ✓] + /// Activate or deactivate a purchased fragment.com username associated to a bot we own. See [bots: ✓] Possible codes: 400 (details) + /// The bot + /// Username + /// Whether to activate or deactivate it public static Task Bots_ToggleUsername(this Client client, InputUserBase bot, string username, bool active) => client.Invoke(new Bots_ToggleUsername { @@ -5472,7 +5492,10 @@ namespace TL msg_id = msg_id, }); - /// See [bots: ✓] + /// Export a folder », creating a chat folder deep link ». See Possible codes: 400 (details) + /// The folder to export + /// An optional name for the link + /// The list of channels, group and supergroups to share with the link. Basic groups will automatically be converted to supergroups when invoking the method. public static Task Chatlists_ExportChatlistInvite(this Client client, InputChatlist chatlist, string title, params InputPeer[] peers) => client.Invoke(new Chatlists_ExportChatlistInvite { @@ -5481,7 +5504,9 @@ namespace TL peers = peers, }); - /// See [bots: ✓] + /// Delete a previously created chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// The related folder + /// slug obtained from the chat folder deep link ». public static Task Chatlists_DeleteExportedInvite(this Client client, InputChatlist chatlist, string slug) => client.Invoke(new Chatlists_DeleteExportedInvite { @@ -5489,7 +5514,11 @@ namespace TL slug = slug, }); - /// See [bots: ✓] + /// Edit a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Folder ID + /// slug obtained from the chat folder deep link ». + /// If set, sets a new name for the link + /// If set, changes the list of peers shared with the link public static Task Chatlists_EditExportedInvite(this Client client, InputChatlist chatlist, string slug, string title = null, InputPeer[] peers = null) => client.Invoke(new Chatlists_EditExportedInvite { @@ -5500,21 +5529,25 @@ namespace TL peers = peers, }); - /// See [bots: ✓] + /// List all chat folder deep links » associated to a folder See [bots: ✓] + /// The folder public static Task Chatlists_GetExportedInvites(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetExportedInvites { chatlist = chatlist, }); - /// See [bots: ✓] + /// Obtain information about a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// slug obtained from the chat folder deep link » public static Task Chatlists_CheckChatlistInvite(this Client client, string slug) => client.Invoke(new Chatlists_CheckChatlistInvite { slug = slug, }); - /// See [bots: ✓] + /// Import a chat folder deep link », joining some or all the chats in the folder. See [bots: ✓] Possible codes: 400 (details) + /// slug obtained from a chat folder deep link ». + /// List of new chats to join, fetched using Chatlists_CheckChatlistInvite and filtered as specified in the documentation ». public static Task Chatlists_JoinChatlistInvite(this Client client, string slug, params InputPeer[] peers) => client.Invoke(new Chatlists_JoinChatlistInvite { @@ -5522,14 +5555,17 @@ namespace TL peers = peers, }); - /// See [bots: ✓] + /// Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »). See [bots: ✓] + /// The folder public static Task Chatlists_GetChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetChatlistUpdates { chatlist = chatlist, }); - /// See [bots: ✓] + /// Join channels and supergroups recently added to a chat folder deep link ». See [bots: ✓] + /// The folder + /// List of new chats to join, fetched using Chatlists_GetChatlistUpdates and filtered as specified in the documentation ». public static Task Chatlists_JoinChatlistUpdates(this Client client, InputChatlist chatlist, params InputPeer[] peers) => client.Invoke(new Chatlists_JoinChatlistUpdates { @@ -5537,21 +5573,25 @@ namespace TL peers = peers, }); - /// See [bots: ✓] + /// Dismiss new pending peers recently added to a chat folder deep link ». See [bots: ✓] + /// The folder public static Task Chatlists_HideChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_HideChatlistUpdates { chatlist = chatlist, }); - /// See [bots: ✓] + /// Returns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted. See [bots: ✓] + /// Folder ID public static Task Chatlists_GetLeaveChatlistSuggestions(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetLeaveChatlistSuggestions { chatlist = chatlist, }); - /// See [bots: ✓] + /// Delete a folder imported using a chat folder deep link » See [bots: ✓] + /// Folder ID + /// Also leave the specified channels and groups public static Task Chatlists_LeaveChatlist(this Client client, InputChatlist chatlist, params InputPeer[] peers) => client.Invoke(new Chatlists_LeaveChatlist { From e8b0bb92452409c0b8f9772c5ebaeb87f56a29a5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 17 May 2023 11:45:06 +0200 Subject: [PATCH 075/336] ActiveUsernames helpers Github action telegram-api --- .github/workflows/telegram-api.yml | 22 ++++++++++++++++++++++ src/TL.Helpers.cs | 12 ++++++++++++ 2 files changed, 34 insertions(+) create mode 100644 .github/workflows/telegram-api.yml diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml new file mode 100644 index 0000000..19ade4b --- /dev/null +++ b/.github/workflows/telegram-api.yml @@ -0,0 +1,22 @@ +name: 'Telegram API issues' + +on: + issues: + types: [labeled] + +permissions: + issues: write + +jobs: + action: + runs-on: ubuntu-latest + steps: + - uses: dessant/support-requests@v3.0.0 + with: + support-label: 'telegram api' + issue-comment: > + **Github Issues** should be used only for problems with the library itself. + + Questions about Telegram API usage should be asked on **StackOverflow** so the whole community can help and benefit. + Click here to open a question: https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api + close-issue: true diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 8e99634..d2c888a 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -169,6 +169,18 @@ namespace TL /// An estimation of the number of days ago the user was last seen (Online=0, Recently=1, LastWeek=5, LastMonth=20, LongTimeAgo=150) public TimeSpan LastSeenAgo => status?.LastSeenAgo ?? TimeSpan.FromDays(150); public bool IsBot => (flags & Flags.bot) != 0; + public IEnumerable ActiveUsernames + { + get + { + if (username != null) + yield return username; + if (usernames != null) + foreach (var un in usernames) + if (un.flags.HasFlag(Username.Flags.active)) + yield return un.username; + } + } } /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) From 131fd361064afa0e33c0bd2cefe7ffb053443496 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 17 May 2023 18:26:53 +0200 Subject: [PATCH 076/336] Fix ReactorError not correctly raised. Added Program_ReactorError example --- .github/dev.yml | 2 +- .github/workflows/telegram-api.yml | 7 +-- EXAMPLES.md | 3 +- Examples/Program_ReactorError.cs | 71 ++++++++++++++++++++++++++++++ FAQ.md | 2 +- README.md | 2 +- src/Client.cs | 4 +- 7 files changed, 81 insertions(+), 10 deletions(-) create mode 100644 Examples/Program_ReactorError.cs diff --git a/.github/dev.yml b/.github/dev.yml index ffec59b..c719a3b 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ pr: none trigger: - master -name: 3.5.1-dev.$(Rev:r) +name: 3.5.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index 19ade4b..b9f2a14 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -9,6 +9,7 @@ permissions: jobs: action: + if: contains(github.event.issue.labels.*.name, 'telegram api') runs-on: ubuntu-latest steps: - uses: dessant/support-requests@v3.0.0 @@ -16,7 +17,7 @@ jobs: support-label: 'telegram api' issue-comment: > **Github Issues** should be used only for problems with the library itself. - - Questions about Telegram API usage should be asked on **StackOverflow** so the whole community can help and benefit. - Click here to open a question: https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api + + For questions about Telegram API usage, you can search the [API official documentation](https://core.telegram.org/api#getting-started) + or [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. close-issue: true diff --git a/EXAMPLES.md b/EXAMPLES.md index 74f1df1..2ffdeae 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -469,9 +469,8 @@ private Dictionary _chats = new(); var dialogs = await client.Messages_GetAllDialogs(); dialogs.CollectUsersChats(_users, _chats); -private async Task OnUpdate(IObject arg) +private async Task OnUpdate(UpdatesBase updates) { - if (arg is not UpdatesBase updates) return; updates.CollectUsersChats(_users, _chats); ... } diff --git a/Examples/Program_ReactorError.cs b/Examples/Program_ReactorError.cs new file mode 100644 index 0000000..5a8a0a8 --- /dev/null +++ b/Examples/Program_ReactorError.cs @@ -0,0 +1,71 @@ +using System; +using System.Threading.Tasks; +using Telegram.Bot.Types; +using TL; + +namespace WTelegramClientTest +{ + static class Program_ReactorError + { + static WTelegram.Client Client; + + // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + static async Task Main(string[] _) + { + Console.WriteLine("The program demonstrate how to handle ReactorError. Press any key to terminate"); + WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); + try + { + await CreateAndConnect(); + Console.ReadKey(); + } + finally + { + Client?.Dispose(); + } + } + + private static async Task CreateAndConnect() + { + Client = new WTelegram.Client(Environment.GetEnvironmentVariable); + Client.OnUpdate += Client_OnUpdate; + Client.OnOther += Client_OnOther; + var my = await Client.LoginUserIfNeeded(); + Console.WriteLine($"We are logged-in as " + my); + } + + private static async Task Client_OnOther(IObject arg) + { + if (arg is ReactorError err) + { + // typically: network connection was totally lost + Console.WriteLine($"Fatal reactor error: {err.Exception.Message}"); + while (true) + { + Console.WriteLine("Disposing the client and trying to reconnect in 5 seconds..."); + Client?.Dispose(); + Client = null; + await Task.Delay(5000); + try + { + await CreateAndConnect(); + break; + } + catch (Exception ex) + { + Console.WriteLine("Connection still failing: " + ex.Message); + } + } + } + else + Console.WriteLine("Other: " + arg.GetType().Name); + } + + private static Task Client_OnUpdate(UpdatesBase updates) + { + foreach (var update in updates.UpdateList) + Console.WriteLine(update.GetType().Name); + return Task.CompletedTask; + } + } +} diff --git a/FAQ.md b/FAQ.md index 4ebb202..99875b6 100644 --- a/FAQ.md +++ b/FAQ.md @@ -203,7 +203,7 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is This should be transparent and pending API calls should automatically be resent upon reconnection. You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable. -3) If you reach `MaxAutoReconnects` disconnections, then the **OnUpdate** event handler will receive a `ReactorError` object to notify you of the problem, +3) If you reach `MaxAutoReconnects` disconnections, then the **OnOther** event handler will receive a `ReactorError` object to notify you of the problem, and pending API calls throw the network IOException. In this case, the recommended action would be to dispose the client and recreate one diff --git a/README.md b/README.md index 0d91114..655e5b3 100644 --- a/README.md +++ b/README.md @@ -161,7 +161,7 @@ See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn m # Other things to know -The Client class also offers an `OnUpdate` event that is triggered when Telegram servers sends Updates (like new messages or status), independently of your API requests. +The Client class also offers `OnUpdate` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other structures, independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. diff --git a/src/Client.cs b/src/Client.cs index 83431ac..794a251 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -46,7 +46,7 @@ namespace WTelegram /// Size of chunks when uploading/downloading files. Reduce this if you don't have much memory public int FilePartSize { get; set; } = 512 * 1024; /// Is this Client instance the main or a secondary DC session - public bool IsMainDC => (_dcSession?.DataCenter?.id ?? 0) == _session.MainDC; + public bool IsMainDC => (_dcSession?.DataCenter?.id - _session.MainDC) is null or 0; /// Has this Client established connection been disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); /// ID of the current logged-in user or 0 @@ -164,7 +164,7 @@ namespace WTelegram public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); /// Builds a structure that is used to validate a 2FA password - /// Password validation configuration. You can obtain this via Account_GetPassword or through OnUpdate as part of the login process + /// Password validation configuration. You can obtain this via Account_GetPassword or through OnOther as part of the login process /// The password to validate public static Task InputCheckPassword(Account_Password accountPassword, string password) => Check2FA(accountPassword, () => Task.FromResult(password)); From d1e583cc8640ebcd0a3b69c538908bd206b35493 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 18 May 2023 21:50:19 +0200 Subject: [PATCH 077/336] Prevent "You must connect to Telegram first" during network loss (closes #157) --- EXAMPLES.md | 13 ++++++++++--- FAQ.md | 2 +- README.md | 4 ++-- src/Client.cs | 2 +- 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2ffdeae..985d4f9 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -491,11 +491,18 @@ A message contains those two fields/properties: - `peer_id`/`Peer` that identify WHERE the message was posted - `from_id`/`From` that identify WHO posted the message (it can be `null` in some case of anonymous posting) -These two fields derive from class `Peer` and can be of type `PeerChat`, `PeerChannel` or `PeerUser` depending on the nature of WHERE & WHO (private chat with a user? message posted BY a channel IN a chat? ...) +These two fields derive from class `Peer` and can be of type `PeerChat`, `PeerChannel` or `PeerUser` depending on the nature of WHERE & WHO +(private chat with a user? message posted BY a channel IN a chat? ...) -The root structure where you obtained the message (typically `UpdatesBase` or `Messages_MessagesBase`) inherits from `IPeerResolver`. This allows you to call `.UserOrChat(peer)` on the root structure, in order to resolve those fields into a `User` class, or a `ChatBase`-derived class (typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID. +The root structure where you obtained the message (typically `UpdatesBase` or `Messages_MessagesBase`) inherits from `IPeerResolver`. +This allows you to call `.UserOrChat(peer)` on the root structure, in order to resolve those fields into a `User` class, or a `ChatBase`-derived class +(typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID. -However, in some case _(typically when dealing with updates)_, Telegram might choose to not include details about a peer because it expects you to already know about it (`UserOrChat` returns `null`). That's why you should collect users/chats details each time you're dealing with Updates or other API results inheriting from `IPeerResolver`, and use the collected dictionaries to find details about users/chats ([see previous section](#collect-users-chats) and [Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) example) +However, in some case _(typically when dealing with updates)_, Telegram might choose to not include details about a peer +because it expects you to already know about it (`UserOrChat` returns `null`). +That's why you should collect users/chats details each time you're dealing with Updates or other API results inheriting from `IPeerResolver`, +and use the collected dictionaries to find details about users/chats +([see previous section](#collect-users-chats) and [Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) example) And finally, it may happen that you receive updates of type `UpdateShortMessage` or `UpdateShortChatMessage` with totally unknown peers (even in your collected dictionaries). In this case, [Telegram recommends](https://core.telegram.org/api/updates#recovering-gaps) that you use the [`Updates_GetDifference`](https://corefork.telegram.org/method/updates.getDifference) method to retrieve the full information associated with the short message. diff --git a/FAQ.md b/FAQ.md index 99875b6..63bae26 100644 --- a/FAQ.md +++ b/FAQ.md @@ -205,7 +205,7 @@ You can choose to increase `MaxAutoReconnects` if it happens too often because y 3) If you reach `MaxAutoReconnects` disconnections, then the **OnOther** event handler will receive a `ReactorError` object to notify you of the problem, and pending API calls throw the network IOException. -In this case, the recommended action would be to dispose the client and recreate one +In this case, the recommended action would be to dispose the client and recreate one (see example [Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs)) 4) In case of slow Internet connection or if you break in the debugger for some time, you might also get Connection shutdown because your client couldn't send Pings to Telegram in the allotted time. diff --git a/README.md b/README.md index 655e5b3..04bece6 100644 --- a/README.md +++ b/README.md @@ -161,8 +161,8 @@ See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn m # Other things to know -The Client class also offers `OnUpdate` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other structures, independently of your API requests. -See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) +The Client class also offers `OnUpdate` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) and [Examples/Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs?ts=4#L32) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. diff --git a/src/Client.cs b/src/Client.cs index 794a251..dd3835e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -198,7 +198,7 @@ namespace WTelegram _reactorTask?.Wait(1000); } catch { } - _reactorTask = null; + _reactorTask = resetSessions ? null : Task.CompletedTask; _networkStream?.Close(); _tcpClient?.Dispose(); #if OBFUSCATION From b282d2e007ca94fce6cf09e6c93fe8b552474273 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 18 May 2023 22:02:53 +0200 Subject: [PATCH 078/336] Prevent 'You must connect to Telegram first' during network loss api doc --- src/TL.Schema.cs | 4 ++-- src/TL.SchemaFuncs.cs | 8 ++++---- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f239e33..378bd19 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -6842,7 +6842,7 @@ namespace TL /// Programming language of the code public string language; } - /// Message entity representing a text url: for in-text urls like https://google.com use . See + /// Message entity representing a text url: for in-text urls like https://google.com use . See [TLDef(0x76A6D327, inheritBefore = true)] public class MessageEntityTextUrl : MessageEntity { @@ -7984,7 +7984,7 @@ namespace TL public string email_pattern; /// Length of the sent verification code public int length; - /// The login email can be reset by invoking Auth_ResetLoginEmail and waiting for the specified amount of seconds. + /// Clients should wait for the specified amount of seconds before allowing the user to invoke Auth_ResetLoginEmail (will be 0 for Premium users). [IfFlag(3)] public int reset_available_period; /// An email reset was already requested, and will occur at the specified date. [IfFlag(4)] public DateTime reset_pending_date; diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 70ed69c..e8baed5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3198,7 +3198,7 @@ namespace TL send_as = send_as, }); - /// React to message See Possible codes: 400,403 (details) + /// React to message. See Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown /// Add this reaction to the recent reactions list ». /// Peer @@ -3647,7 +3647,7 @@ namespace TL /// Set a custom wallpaper » in a specific private chat with another user. See [bots: ✓] Possible codes: 400 (details) /// The private chat where the wallpaper will be set - /// The wallpaper », obtained as described in the wallpaper documentation » or from a service message. + /// The wallpaper », obtained as described in the wallpaper documentation »; must not be provided when installing a wallpaper obtained from a service message (id must be provided, instead). /// Wallpaper settings, obtained as described in the wallpaper documentation » or from .wallpaper.settings. /// If the wallpaper was obtained from a service message, must contain the ID of that message. public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null) @@ -4196,9 +4196,9 @@ namespace TL username = username, }); - /// Change the username of a supergroup/channel See Possible codes: 400,403 (details) + /// Change or remove the username of a supergroup/channel See Possible codes: 400,403 (details) /// Channel - /// New username + /// New username, pass an empty string to remove the username public static Task Channels_UpdateUsername(this Client client, InputChannelBase channel, string username) => client.Invoke(new Channels_UpdateUsername { From 7feb4a40ec572a4cd81468de7c51c83786a85e35 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 18:05:24 +0200 Subject: [PATCH 079/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 4 ++-- EXAMPLES.md | 2 +- Examples/Program_ListenUpdates.cs | 10 +++++++--- src/Helpers.cs | 2 +- src/TL.Schema.cs | 4 ++-- 5 files changed, 13 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index c719a3b..a0ed581 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,4 +1,4 @@ -pr: none +pr: none trigger: - master @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage)"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage.Replace("\"", "″"))"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 diff --git a/EXAMPLES.md b/EXAMPLES.md index 985d4f9..c0aa92c 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -197,7 +197,7 @@ See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. -See the `DisplayMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). +See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index c69ebb0..baf09ca 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -36,11 +36,15 @@ namespace WTelegramClientTest private static async Task Client_OnUpdate(UpdatesBase updates) { updates.CollectUsersChats(Users, Chats); + if (updates is UpdateShortMessage usm && !Users.ContainsKey(usm.user_id)) + (await Client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0)).CollectUsersChats(Users, Chats); + else if (updates is UpdateShortChatMessage uscm && (!Users.ContainsKey(uscm.from_id) || !Chats.ContainsKey(uscm.chat_id))) + (await Client.Updates_GetDifference(uscm.pts - uscm.pts_count, uscm.date, 0)).CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) switch (update) { - case UpdateNewMessage unm: await DisplayMessage(unm.message); break; - case UpdateEditMessage uem: await DisplayMessage(uem.message, true); break; + case UpdateNewMessage unm: await HandleMessage(unm.message); break; + case UpdateEditMessage uem: await HandleMessage(uem.message, true); break; // Note: UpdateNewChannelMessage and UpdateEditChannelMessage are also handled by above cases case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break; case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; @@ -56,7 +60,7 @@ namespace WTelegramClientTest } // in this example method, we're not using async/await, so we just return Task.CompletedTask - private static Task DisplayMessage(MessageBase messageBase, bool edit = false) + private static Task HandleMessage(MessageBase messageBase, bool edit = false) { if (edit) Console.Write("(Edit): "); switch (messageBase) diff --git a/src/Helpers.cs b/src/Helpers.cs index 6bc628d..3231d95 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -246,10 +246,10 @@ namespace WTelegram public override long Length => ContentLength ?? _innerStream.Length; public override long Position { get => _innerStream.Position; set => _innerStream.Position = value; } public override void Flush() => _innerStream.Flush(); - public override int Read(byte[] buffer, int offset, int count) => _innerStream.Read(buffer, offset, count); public override long Seek(long offset, SeekOrigin origin) => _innerStream.Seek(offset, origin); public override void SetLength(long value) => _innerStream.SetLength(value); public override void Write(byte[] buffer, int offset, int count) => _innerStream.Write(buffer, offset, count); + public override int Read(byte[] buffer, int offset, int count) => _innerStream.Read(buffer, offset, count); protected override void Dispose(bool disposing) => _innerStream.Dispose(); } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 378bd19..f6b2a19 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -6721,7 +6721,7 @@ namespace TL { /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; - /// Filtering criteria to use for the peer selection list shown to the user. + /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use a peer of the specified type, if needed.
public RequestPeerType peer_type; } @@ -6842,7 +6842,7 @@ namespace TL /// Programming language of the code public string language; } - /// Message entity representing a text url: for in-text urls like https://google.com use . See + /// Message entity representing a text url: for in-text urls like https://google.com use . See [TLDef(0x76A6D327, inheritBefore = true)] public class MessageEntityTextUrl : MessageEntity { From de4b5e606da1ebfeb605e51083cb867937f22ae5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:01:04 +0200 Subject: [PATCH 080/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- README.md | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index a0ed581..2fa57bb 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage.Replace("\"", "″"))"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables['Build.SourceVersionMessage'], '"', '″')) }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 diff --git a/README.md b/README.md index 04bece6..ee61a5e 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![API Layer](https://img.shields.io/badge/API_Layer-158-blueviolet)](https://corefork.telegram.org/methods) [![NuGet version](https://img.shields.io/nuget/v/WTelegramClient?color=00508F)](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) +[![NuGet prerelease](https://img.shields.io/nuget/vpre/WTelegramClient?color=C09030&label=dev+nuget)](https://www.nuget.org/packages/WTelegramClient/) [![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://www.buymeacoffee.com/wizou) ## _Telegram Client API library written 100% in C# and .NET_ From f4d435b807779f06f021d7b855ada4cbee47af41 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:05:11 +0200 Subject: [PATCH 081/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2fa57bb..6f90b19 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables['Build.SourceVersionMessage'], '"', '″')) }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables["Build.SourceVersionMessage"], "\"", "″") }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 660933d8c7c3bb5e3e1ad461516427c28778cb6b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:08:39 +0200 Subject: [PATCH 082/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 6f90b19..3f53bd2 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables["Build.SourceVersionMessage"], "\"", "″") }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables[\'Build.SourceVersionMessage\'], \'"\', \'″\') }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From fc54a93d00b094494f6f11d1d8f0d2b30a730bb0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:10:37 +0200 Subject: [PATCH 083/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 3f53bd2..1bea875 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace(variables[\'Build.SourceVersionMessage\'], \'"\', \'″\') }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace($(Build.SourceVersionMessage), "\"", "″") }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From fd48ea29740a6a4b14a7e8cbeb205c030a2d874b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:15:21 +0200 Subject: [PATCH 084/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1bea875..2b10f19 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ replace($(Build.SourceVersionMessage), "\"", "″") }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ $(Build.SourceVersionMessage) }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From d054ae7eea6385eaaec7c918564a745e87d5ed2c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:17:53 +0200 Subject: [PATCH 085/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 2b10f19..25484c6 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ $(Build.SourceVersionMessage) }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ $BUILD_SOURCEVERSIONMESSAGE }}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From e4c961a69734f377ab0fbb5e49b7ae96bd4b2c1c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:20:26 +0200 Subject: [PATCH 086/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 25484c6..4a37bf0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{ $BUILD_SOURCEVERSIONMESSAGE }}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage)"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 082552786011e1495e8d041cf544172f00ebbecf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:25:06 +0200 Subject: [PATCH 087/336] yml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4a37bf0..4098d01 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(Build.SourceVersionMessage)"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables['Build.SourceVersionMessage'], "\"", "″")]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 2937d1c7b9b3a3971bf820e88d707a8990067300 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:27:43 +0200 Subject: [PATCH 088/336] yml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4098d01..16d728d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables['Build.SourceVersionMessage'], "\"", "″")]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage), "\"", "″")]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 3603b9e2e385975a459ea190caa67bc34a0682e1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:30:01 +0200 Subject: [PATCH 089/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 16d728d..e40bb49 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage), "\"", "″")]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage),"\"","″")]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From a69e032354930298284d6783c66866bcd2f97d58 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:33:08 +0200 Subject: [PATCH 090/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index e40bb49..f2247d9 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage),"\"","″")]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{replace($(Build_SourceVersionMessage),"\"","″")}}"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 6f8c964f60aa193e0d95ccb1419c4b359950dd40 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:35:14 +0200 Subject: [PATCH 091/336] updated "Program_ListenUpdates" example --- .github/dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index f2247d9..e0fb4fc 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,6 +9,7 @@ pool: variables: buildConfiguration: 'Release' + releaseNotes: $[replace(variables['Build_SourceVersionMessage'], '"', '″')] steps: - task: UseDotNet@2 @@ -25,7 +26,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="${{replace($(Build_SourceVersionMessage),"\"","″")}}"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(releaseNotes)"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From fb8d6948869baf092031ad06a6083c2580643d1a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:41:20 +0200 Subject: [PATCH 092/336] yml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index e0fb4fc..ee250ad 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables['Build_SourceVersionMessage'], '"', '″')] + releaseNotes: ${{ replace(variables['Build_SourceVersionMessage'], '"', '″') }} steps: - task: UseDotNet@2 From 25bfacb3f19fbc33c66d864e05259ff12960c8c6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:51:42 +0200 Subject: [PATCH 093/336] yml --- .github/dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ee250ad..81a3aa6 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,6 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: ${{ replace(variables['Build_SourceVersionMessage'], '"', '″') }} steps: - task: UseDotNet@2 @@ -26,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(releaseNotes)"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables['Build_SourceVersionMessage'], '"', '″')]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 2e41a1734aed9b77d4c8b2b57b96e4acc3791a49 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:52:51 +0200 Subject: [PATCH 094/336] yml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 81a3aa6..f42fc7b 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables['Build_SourceVersionMessage'], '"', '″')]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage), '"', '″')]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From 19d2c566eb2ef10c0dc5d9056d3d30c862aa8e57 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:54:18 +0200 Subject: [PATCH 095/336] yml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index f42fc7b..47f1119 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace($(Build_SourceVersionMessage), '"', '″')]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables[''Build_SourceVersionMessage''], ''"'', ''″\'')]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From a5d44bbd93023f2f62887b7fc74b3a7c3ee840a7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 May 2023 23:58:07 +0200 Subject: [PATCH 096/336] "yml" --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 47f1119..98bb119 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables[''Build_SourceVersionMessage''], ''"'', ''″\'')]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables[''Build_SourceVersionMessage''], ''"'', ''″'')]"' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From befac0e781c6718dbc41b59eecd49aa3bafecc9a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 28 May 2023 00:00:36 +0200 Subject: [PATCH 097/336] yml - "abc" 'def' --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 98bb119..1aadee0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$[replace(variables[''Build_SourceVersionMessage''], ''"'', ''″'')]"' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes=$(Build_SourceVersionMessage)' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From abc94356254cb67d9d1d4872f2b9b10a5e36288d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 28 May 2023 00:04:52 +0200 Subject: [PATCH 098/336] yml - "abc" 'def' --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1aadee0..9e472e0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes=$(Build_SourceVersionMessage)' + buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes=$(Build.SourceVersionMessage)' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From a31bcc3df679cb5e2b8a006170241a23fff9b96d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 28 May 2023 00:08:44 +0200 Subject: [PATCH 099/336] test "test" 'test' --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 9e472e0..3079351 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes=$(Build.SourceVersionMessage)' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(Build.SourceVersionMessage)' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 From d50ac0ba51efdc43ea7fc8f4f29bab2367050642 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 27 Jun 2023 16:00:55 +0200 Subject: [PATCH 100/336] - Fix Messages_GetAllDialogs (MessageEmpty) - Fix AnalyzeInviteLink (public channel with join request) - Added Contacts_ResolvedPeer.Channel property closes #166 --- .github/workflows/telegram-api.yml | 2 +- FAQ.md | 2 +- README.md | 4 +++- src/Client.Helpers.cs | 31 ++++++++++++++++++------------ src/TL.Helpers.cs | 4 +++- src/WTelegramClient.csproj | 2 +- 6 files changed, 28 insertions(+), 17 deletions(-) diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index b9f2a14..ca93ff0 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -17,7 +17,7 @@ jobs: support-label: 'telegram api' issue-comment: > **Github Issues** should be used only for problems with the library itself. - + For questions about Telegram API usage, you can search the [API official documentation](https://core.telegram.org/api#getting-started) or [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. close-issue: true diff --git a/FAQ.md b/FAQ.md index 63bae26..2a56bdd 100644 --- a/FAQ.md +++ b/FAQ.md @@ -203,7 +203,7 @@ If Telegram servers decide to shutdown this secondary connection, it's not an is This should be transparent and pending API calls should automatically be resent upon reconnection. You can choose to increase `MaxAutoReconnects` if it happens too often because your Internet connection is unstable. -3) If you reach `MaxAutoReconnects` disconnections, then the **OnOther** event handler will receive a `ReactorError` object to notify you of the problem, +3) If you reach `MaxAutoReconnects` disconnections or a reconnection fails, then the **OnOther** event handler will receive a `ReactorError` object to notify you of the problem, and pending API calls throw the network IOException. In this case, the recommended action would be to dispose the client and recreate one (see example [Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs)) diff --git a/README.md b/README.md index ee61a5e..d985682 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ [![API Layer](https://img.shields.io/badge/API_Layer-158-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/) +[![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://www.buymeacoffee.com/wizou) ## _Telegram Client API library written 100% in C# and .NET_ @@ -91,6 +91,8 @@ Since version 3.0.0, a new approach to login/configuration has been added. Some ```csharp WTelegram.Client client = new WTelegram.Client(YOUR_API_ID, "YOUR_API_HASH"); // this constructor doesn't need a Config method await DoLogin("+12025550156"); // initial call with user's phone_number +... +//client.Dispose(); // the client must be disposed when you're done running your userbot. async Task DoLogin(string loginInfo) // (add this method to your code) { diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 4bfc62c..28602c8 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -473,10 +473,15 @@ namespace WTelegram { dialogList.AddRange(dialogs.Dialogs); messageList.AddRange(dialogs.Messages); - var lastDialog = dialogs.Dialogs[^1]; - var lastMsg = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage); - var offsetPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); - dialogs = await this.Messages_GetDialogs(lastMsg?.Date ?? default, lastDialog.TopMessage, offsetPeer, folder_id: folder_id); + int last = dialogs.Dialogs.Length - 1; + var lastDialog = dialogs.Dialogs[last]; + var lastPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); + var lastMsgId = lastDialog.TopMessage; + retryDate: + var lastDate = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage)?.Date ?? default; + if (lastDate == default) + if (--last < 0) break; else { lastDialog = dialogs.Dialogs[last]; goto retryDate; } + dialogs = await this.Messages_GetDialogs(lastDate, lastMsgId, lastPeer, folder_id: folder_id); if (dialogs is not Messages_Dialogs md) break; foreach (var (key, value) in md.chats) mds.chats[key] = value; foreach (var (key, value) in md.users) mds.users[key] = value; @@ -682,8 +687,8 @@ namespace WTelegram private static readonly char[] UrlSeparator = new[] { '?', '#', '/' }; - /// Return information about a chat/channel based on Invite Link - /// Public link or Invite link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname
Also work without https:// prefix + /// Return information about a chat/channel based on Invite Link or Public Link + /// Public link or Invite link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname
Works also without https:// prefix /// to also join the chat/channel /// previously collected chats, to prevent unnecessary ResolveUsername /// a Chat or Channel, possibly partial Channel information only (with flag ) @@ -703,10 +708,12 @@ namespace WTelegram { var chat = await CachedOrResolveUsername(url[start..end], chats); if (join && chat is Channel channel) - { - var res = await this.Channels_JoinChannel(channel); - chat = res.Chats[chat.ID]; - } + try + { + var res = await this.Channels_JoinChannel(channel); + chat = res.Chats[channel.id]; + } + catch (RpcException ex) when (ex.Code == 400 && ex.Message == "INVITE_REQUEST_SENT") { } return chat; } var chatInvite = await this.Messages_CheckChatInvite(hash); @@ -748,11 +755,11 @@ namespace WTelegram return null; } - /// Return chat and message details based on a message URL + /// Return chat and message details based on a Message Link (URL) /// Message Link, like https://t.me/c/1234567890/1234 or https://t.me/channelname/1234 /// previously collected chats, to prevent unnecessary ResolveUsername /// Structure containing the message, chat and user details - /// If link is for private group (t.me/c/..), user must have joined the group + /// If link is for private group (t.me/c/..), user must have joined that group public async Task GetMessageByLink(string url, IDictionary chats = null) { int start = url.IndexOf("//"); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d2c888a..4ff1deb 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -543,8 +543,10 @@ namespace TL public static implicit operator InputPeer(Contacts_ResolvedPeer resolved) => resolved?.UserOrChat.ToInputPeer(); /// A , or if the username was for a channel public User User => peer is PeerUser pu ? users[pu.user_id] : null; - /// A or , or if the username was for a user + /// A or , or if the username was for a user public ChatBase Chat => peer is PeerChannel or PeerChat ? chats[peer.ID] : null; + /// A , or if the username was for a user or for a forbidden channel + public Channel Channel => peer is PeerChannel pc ? chats[pc.channel_id] as Channel : null; } partial class Updates_ChannelDifferenceBase diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ad1e28b..0fade3e 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;MTProto;Client;Api;UserBot;TLSharp README.md - $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes.Replace("\"", "%22").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From 472b10f1555e4966a25d5da6e0189440361afcc1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Jul 2023 05:03:08 +0200 Subject: [PATCH 101/336] Fix unencrypted padding length in Padded Intermediate (official doc says 0..15 bytes, but server & Android app sends 0..256 bytes) --- src/Client.cs | 4 ++-- src/WTelegramClient.csproj | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index dd3835e..a37705c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -392,7 +392,7 @@ namespace WTelegram if ((msgId & 1) == 0) throw new WTException($"Invalid server msgId {msgId}"); int length = reader.ReadInt32(); dataLen -= 20; - if (length > dataLen || length < dataLen - (_paddedMode ? 15 : 0)) + if (length > dataLen || dataLen - length > (_paddedMode ? 256 : 0)) throw new WTException($"Unexpected unencrypted/padding length {dataLen} - {length}"); var obj = reader.ReadTLObject(); @@ -1283,7 +1283,7 @@ namespace WTelegram } if (_paddedMode) // Padded intermediate mode => append random padding { - var padding = new byte[_random.Next(16)]; + var padding = new byte[_random.Next(_dcSession.AuthKeyID == 0 ? 257 : 16)]; RNG.GetBytes(padding); writer.Write(padding); } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 0fade3e..2544f37 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;MTProto;Client;Api;UserBot;TLSharp README.md - $(ReleaseNotes.Replace("\"", "%22").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes.Replace("\"", "''").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From 994e0deadec439a1eacaab0e1f77da69bc84589d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Jul 2023 05:08:28 +0200 Subject: [PATCH 102/336] test "ReleaseNotes" --- src/WTelegramClient.csproj | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 2544f37..578309d 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;MTProto;Client;Api;UserBot;TLSharp README.md - $(ReleaseNotes.Replace("\"", "''").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes.Replace("%22", "''").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From bcc62a13560bc52a9609b3de2ef2a60e17627406 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Jul 2023 15:53:48 +0200 Subject: [PATCH 103/336] test "yml" --- .github/dev.yml | 3 ++- src/WTelegramClient.csproj | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 3079351..fb4b759 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,6 +9,7 @@ pool: variables: buildConfiguration: 'Release' + releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', "''")] steps: - task: UseDotNet@2 @@ -25,7 +26,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(Build.SourceVersionMessage)' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(releaseNotes)' # buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' - task: NuGetCommand@2 diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 578309d..ad1e28b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -23,7 +23,7 @@ git Telegram;MTProto;Client;Api;UserBot;TLSharp README.md - $(ReleaseNotes.Replace("%22", "''").Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION From 1048af4dcfd602effb57b866992f21de054cb125 Mon Sep 17 00:00:00 2001 From: wiz0u <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Jul 2023 16:01:52 +0200 Subject: [PATCH 104/336] test "yml" --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index fb4b759..174fcca 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', "''")] + releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: - task: UseDotNet@2 From c631072ae43c40aabfe41ed96171c02a274aa53b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 6 Jul 2023 10:17:29 +0200 Subject: [PATCH 105/336] Prevent "recursive" MsgContainer --- .github/dev.yml | 3 +-- .github/release.yml | 2 +- src/Client.cs | 2 +- src/TL.cs | 4 ++-- 4 files changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 174fcca..575c2b5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -26,8 +26,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(releaseNotes)' -# buildProperties: 'NoWarn="0419;1573;1591";AllowedOutputExtensionsInPackageBuildOutputFolder=".dll;.xml;.pdb"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(releaseNotes)"' - task: NuGetCommand@2 inputs: diff --git a/.github/release.yml b/.github/release.yml index 78c152a..352507d 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -31,7 +31,7 @@ stages: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";Version=$(Build.BuildNumber);ContinuousIntegrationBuild=true;ReleaseNotes="$(ReleaseNotes)"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(releaseNotes)"' - task: NuGetCommand@2 inputs: diff --git a/src/Client.cs b/src/Client.cs index a37705c..61ca6ed 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -689,7 +689,7 @@ namespace WTelegram Rpc prevRequest; lock (_pendingRpcs) _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); - await SendAsync(lastSentMsg, true, prevRequest); + await SendAsync(lastSentMsg, lastSentMsg is not MsgContainer, prevRequest); lock (_pendingRpcs) _pendingRpcs.Remove(badMsgNotification.bad_msg_id); } diff --git a/src/TL.cs b/src/TL.cs index 1c4fab8..ba802a7 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -198,12 +198,12 @@ namespace TL writer.Write(msg.msg_id); writer.Write(msg.seqno); var patchPos = writer.BaseStream.Position; - writer.Write(0); // patched below - writer.WriteTLObject(msg.body); + writer.Write(0); // patched below if ((msg.seqno & 1) != 0) WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); + writer.WriteTLObject(msg.body); writer.BaseStream.Position = patchPos; writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field writer.Seek(0, SeekOrigin.End); From 8a9f886b62edc831ba22d0d065d498b34efaf45c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Jul 2023 01:34:31 +0200 Subject: [PATCH 106/336] Fix Naming Styles --- src/Client.cs | 6 +++--- src/Encryption.cs | 38 +++++++++++++++++++------------------- src/Session.cs | 34 +++++++++++++++++----------------- src/TL.Extensions.cs | 8 ++++---- src/TL.MTProto.cs | 2 ++ src/TL.Schema.cs | 3 ++- src/TL.SchemaFuncs.cs | 1 + src/TL.Secret.cs | 1 + src/TL.cs | 15 ++++++++------- 9 files changed, 57 insertions(+), 51 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 61ca6ed..0b15116 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -594,9 +594,9 @@ namespace WTelegram class Rpc { - public Type type; - public TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); - public long msgId; + internal Type type; + internal TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); + internal long msgId; public Task Task => tcs.Task; } diff --git a/src/Encryption.cs b/src/Encryption.cs index 41ca816..b94edf1 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -320,31 +320,31 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB #if OBFUSCATION internal class AesCtr : IDisposable { - readonly ICryptoTransform encryptor; - readonly byte[] ivec; - readonly byte[] ecount = new byte[16]; - int num; + readonly ICryptoTransform _encryptor; + readonly byte[] _ivec; + readonly byte[] _ecount = new byte[16]; + int _num; public AesCtr(byte[] key, byte[] iv) { - encryptor = AesECB.CreateEncryptor(key, null); - ivec = iv; + _encryptor = AesECB.CreateEncryptor(key, null); + _ivec = iv; } - public void Dispose() => encryptor.Dispose(); + public void Dispose() => _encryptor.Dispose(); public void EncryptDecrypt(byte[] buffer, int length) { for (int i = 0; i < length; i++) { - if (num == 0) + if (_num == 0) { - encryptor.TransformBlock(ivec, 0, 16, ecount, 0); + _encryptor.TransformBlock(_ivec, 0, 16, _ecount, 0); for (int n = 15; n >= 0; n--) // increment big-endian counter - if (++ivec[n] != 0) break; + if (++_ivec[n] != 0) break; } - buffer[i] ^= ecount[num]; - num = (num + 1) % 16; + buffer[i] ^= _ecount[_num]; + _num = (_num + 1) % 16; } } } @@ -526,15 +526,15 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB internal class AES_IGE_Stream : Helpers.IndirectStream { - private readonly ICryptoTransform aesCrypto; - private readonly byte[] prevBytes; + private readonly ICryptoTransform _aesCrypto; + private readonly byte[] _prevBytes; public AES_IGE_Stream(Stream stream, long size, byte[] key, byte[] iv) : this(stream, key, iv, false) { ContentLength = size; } public AES_IGE_Stream(Stream stream, byte[] key, byte[] iv, bool encrypt) : base(stream) { - aesCrypto = encrypt ? Encryption.AesECB.CreateEncryptor(key, null) : Encryption.AesECB.CreateDecryptor(key, null); - if (encrypt) prevBytes = (byte[])iv.Clone(); - else { prevBytes = new byte[32]; Array.Copy(iv, 0, prevBytes, 16, 16); Array.Copy(iv, 16, prevBytes, 0, 16); } + _aesCrypto = encrypt ? Encryption.AesECB.CreateEncryptor(key, null) : Encryption.AesECB.CreateDecryptor(key, null); + if (encrypt) _prevBytes = (byte[])iv.Clone(); + else { _prevBytes = new byte[32]; Array.Copy(iv, 0, _prevBytes, 16, 16); Array.Copy(iv, 16, _prevBytes, 0, 16); } } public override long Length => base.Length + 15 & ~15; @@ -563,11 +563,11 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { count = count + 15 & ~15; var span = MemoryMarshal.Cast(buffer.AsSpan(offset, count)); - var prev = MemoryMarshal.Cast(prevBytes); + var prev = MemoryMarshal.Cast(_prevBytes); for (offset = 0, count /= 8; offset < count;) { prev[0] ^= span[offset]; prev[1] ^= span[offset + 1]; - aesCrypto.TransformBlock(prevBytes, 0, 16, prevBytes, 0); + _aesCrypto.TransformBlock(_prevBytes, 0, 16, _prevBytes, 0); prev[0] ^= prev[2]; prev[1] ^= prev[3]; prev[2] = span[offset]; prev[3] = span[offset + 1]; span[offset++] = prev[0]; span[offset++] = prev[1]; diff --git a/src/Session.cs b/src/Session.cs index 535374b..d09b99d 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -37,39 +37,39 @@ namespace WTelegram internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); Id = Helpers.RandomLong(); Seqno = 0; LastSentMsgId = 0; } public void DisableUpdates(bool disable = true) { if (WithoutUpdates != disable) { WithoutUpdates = disable; Renew(); } } - const int msgIdsN = 512; - private long[] msgIds; - private int msgIdsHead; + const int MsgIdsN = 512; + private long[] _msgIds; + private int _msgIdsHead; internal bool CheckNewMsgId(long msg_id) { - if (msgIds == null) + if (_msgIds == null) { - msgIds = new long[msgIdsN]; - msgIds[0] = msg_id; + _msgIds = new long[MsgIdsN]; + _msgIds[0] = msg_id; msg_id -= 300L << 32; // until the array is filled with real values, allow ids up to 300 seconds in the past - for (int i = 1; i < msgIdsN; i++) msgIds[i] = msg_id; + for (int i = 1; i < MsgIdsN; i++) _msgIds[i] = msg_id; return true; } - int newHead = (msgIdsHead + 1) % msgIdsN; - if (msg_id > msgIds[msgIdsHead]) - msgIds[msgIdsHead = newHead] = msg_id; - else if (msg_id <= msgIds[newHead]) + int newHead = (_msgIdsHead + 1) % MsgIdsN; + if (msg_id > _msgIds[_msgIdsHead]) + _msgIds[_msgIdsHead = newHead] = msg_id; + else if (msg_id <= _msgIds[newHead]) return false; else { - int min = 0, max = msgIdsN - 1; + int min = 0, max = MsgIdsN - 1; while (min <= max) // binary search (rotated at newHead) { int mid = (min + max) / 2; - int sign = msg_id.CompareTo(msgIds[(mid + newHead) % msgIdsN]); + int sign = msg_id.CompareTo(_msgIds[(mid + newHead) % MsgIdsN]); if (sign == 0) return false; else if (sign < 0) max = mid - 1; else min = mid + 1; } - msgIdsHead = newHead; - for (min = (min + newHead) % msgIdsN; newHead != min;) - msgIds[newHead] = msgIds[newHead = newHead == 0 ? msgIdsN - 1 : newHead - 1]; - msgIds[min] = msg_id; + _msgIdsHead = newHead; + for (min = (min + newHead) % MsgIdsN; newHead != min;) + _msgIds[newHead] = _msgIds[newHead = newHead == 0 ? MsgIdsN - 1 : newHead - 1]; + _msgIds[min] = msg_id; } return true; } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 0e2a7fe..58fb5be 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -173,7 +173,7 @@ namespace TL if (i == sb.Length) break; for (; offset == nextEntity?.offset; nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null) { - if (entityToMD.TryGetValue(nextEntity.GetType(), out var md)) + if (EntityToMD.TryGetValue(nextEntity.GetType(), out var md)) { var closing = (nextEntity.offset + nextEntity.length, md); if (md[0] is '[' or '!') @@ -207,7 +207,7 @@ namespace TL return sb.ToString(); } - static readonly Dictionary entityToMD = new() + static readonly Dictionary EntityToMD = new() { [typeof(MessageEntityBold)] = "*", [typeof(MessageEntityItalic)] = "_", @@ -360,7 +360,7 @@ namespace TL if (i == sb.Length) break; for (; offset == nextEntity?.offset; nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null) { - if (entityToTag.TryGetValue(nextEntity.GetType(), out var tag)) + if (EntityToTag.TryGetValue(nextEntity.GetType(), out var tag)) { var closing = (nextEntity.offset + nextEntity.length, $""); if (tag[0] == 'a') @@ -397,7 +397,7 @@ namespace TL return sb.ToString(); } - static readonly Dictionary entityToTag = new() + static readonly Dictionary EntityToTag = new() { [typeof(MessageEntityBold)] = "b", [typeof(MessageEntityItalic)] = "i", diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index d4623f1..d6313b1 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -5,6 +5,7 @@ using Client = WTelegram.Client; namespace TL { + #pragma warning disable IDE1006 [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ public class ResPQ : IObject { @@ -365,6 +366,7 @@ namespace TL namespace TL.Methods { + #pragma warning disable IDE1006 [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ public class ReqPq : IMethod { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f6b2a19..6cc28d1 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3,6 +3,7 @@ using System.Collections.Generic; namespace TL { + #pragma warning disable IDE1006 /// Boolean type. See public enum Bool : uint { @@ -6811,7 +6812,7 @@ namespace TL /// Unknown message entity See [TLDef(0xBB92BA95)] public class MessageEntityUnknown : MessageEntity { } - /// Message entity mentioning the current user See + /// Message entity mentioning a user by @username; can also be used to mention users by their ID. See [TLDef(0xFA04579D)] public class MessageEntityMention : MessageEntity { } /// #hashtag message entity See diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e8baed5..73ca1c9 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -5603,6 +5603,7 @@ namespace TL namespace TL.Methods { + #pragma warning disable IDE1006 [TLDef(0xCB9F372D)] public class InvokeAfterMsg : IMethod { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index aa35ff2..6ab716a 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -2,6 +2,7 @@ namespace TL { + #pragma warning disable IDE1006 /// Object describes the contents of an encrypted message. See public abstract class DecryptedMessageBase : IObject { diff --git a/src/TL.cs b/src/TL.cs index ba802a7..60d84ba 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -7,6 +7,8 @@ using System.Reflection; using System.Security.Cryptography; using System.Text; +#pragma warning disable IDE1006 // Naming Styles + namespace TL { public interface IObject { } @@ -333,9 +335,9 @@ namespace TL public Int128(RNGCryptoServiceProvider rng) => rng.GetBytes(raw = new byte[16]); public static bool operator ==(Int128 left, Int128 right) { for (int i = 0; i < 16; i++) if (left.raw[i] != right.raw[i]) return false; return true; } public static bool operator !=(Int128 left, Int128 right) { for (int i = 0; i < 16; i++) if (left.raw[i] != right.raw[i]) return true; return false; } - public override bool Equals(object obj) => obj is Int128 other && this == other; - public override int GetHashCode() => BitConverter.ToInt32(raw, 0); - public override string ToString() => Convert.ToHexString(raw); + public override readonly bool Equals(object obj) => obj is Int128 other && this == other; + public override readonly int GetHashCode() => BitConverter.ToInt32(raw, 0); + public override readonly string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int128 int128) => int128.raw; } @@ -347,9 +349,9 @@ namespace TL public Int256(RNGCryptoServiceProvider rng) => rng.GetBytes(raw = new byte[32]); public static bool operator ==(Int256 left, Int256 right) { for (int i = 0; i < 32; i++) if (left.raw[i] != right.raw[i]) return false; return true; } public static bool operator !=(Int256 left, Int256 right) { for (int i = 0; i < 32; i++) if (left.raw[i] != right.raw[i]) return true; return false; } - public override bool Equals(object obj) => obj is Int256 other && this == other; - public override int GetHashCode() => BitConverter.ToInt32(raw, 0); - public override string ToString() => Convert.ToHexString(raw); + public override readonly bool Equals(object obj) => obj is Int256 other && this == other; + public override readonly int GetHashCode() => BitConverter.ToInt32(raw, 0); + public override readonly string ToString() => Convert.ToHexString(raw); public static implicit operator byte[](Int256 int256) => int256.raw; } @@ -369,7 +371,6 @@ namespace TL public object result; } - [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006")] [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message public class _Message { From 2b65e8f1ede18af5eab5a0633786f531f40cc378 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Jul 2023 01:35:15 +0200 Subject: [PATCH 107/336] CollectUsersChats allows null dictionaries --- src/TL.Extensions.cs | 24 +++++++++++++----------- 1 file changed, 13 insertions(+), 11 deletions(-) diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 58fb5be..60860cc 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -17,17 +17,19 @@ namespace TL internal IDictionary _chats; protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) { - lock (_users) - foreach (var user in users.Values) - if (user != null) - if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) - _users[user.id] = user; - lock (_chats) - foreach (var kvp in chats) - if (kvp.Value is not Channel channel) - _chats[kvp.Key] = kvp.Value; - else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) - _chats[kvp.Key] = channel; + if (_users != null) + lock (_users) + foreach (var user in users.Values) + if (user != null) + if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) + _users[user.id] = user; + if (_chats != null) + lock (_chats) + foreach (var kvp in chats) + if (kvp.Value is not Channel channel) + _chats[kvp.Key] = kvp.Value; + else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) + _chats[kvp.Key] = channel; return null; } } From c872a51a3161539679a2d814a846a3aeff3f0214 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 21 Jul 2023 10:52:46 +0200 Subject: [PATCH 108/336] API Layer 160: Stories & more... --- README.md | 2 +- src/Client.Helpers.cs | 6 +- src/TL.Schema.cs | 475 +++++++++++++++++++++++++++++------ src/TL.SchemaFuncs.cs | 502 ++++++++++++++++++++++++++++++------- src/TL.Secret.cs | 20 ++ src/TL.Table.cs | 58 +++-- src/WTelegramClient.csproj | 2 +- 7 files changed, 874 insertions(+), 191 deletions(-) diff --git a/README.md b/README.md index d985682..38cb622 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-158-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-160-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://www.buymeacoffee.com/wizou) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 28602c8..c4e29c1 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -146,10 +146,10 @@ namespace WTelegram long random_id = Helpers.RandomLong(); if (media == null) updates = await this.Messages_SendMessage(peer, text, random_id, no_webpage: disable_preview, entities: entities, - reply_to_msg_id: reply_to_msg_id == 0 ? null : reply_to_msg_id, schedule_date: schedule_date == default ? null : schedule_date); + reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date == default ? null : schedule_date); else updates = await this.Messages_SendMedia(peer, media, text, random_id, entities: entities, - reply_to_msg_id: reply_to_msg_id == 0 ? null : reply_to_msg_id, schedule_date: schedule_date == default ? null : schedule_date); + reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date == default ? null : schedule_date); RaiseUpdate(updates); int msgId = -1; if (updates is UpdateShortSentMessage sent) @@ -242,7 +242,7 @@ namespace WTelegram lastMedia.entities = entities; if (entities != null) lastMedia.flags = InputSingleMedia.Flags.has_entities; - var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to_msg_id: reply_to_msg_id, schedule_date: schedule_date); + var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date); RaiseUpdate(updates); var msgIds = new int[length]; var result = new Message[length]; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6cc28d1..d848398 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -455,6 +455,13 @@ namespace TL /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } + /// See + [TLDef(0x9A86B58F)] + public class InputMediaStory : InputMedia + { + public InputUserBase user_id; + public int id; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -716,7 +723,7 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0x8F97C628)] + [TLDef(0xABB5F120)] public partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -751,6 +758,7 @@ namespace TL [IfFlag(30)] public EmojiStatus emoji_status; /// Additional usernames [IfFlag(32)] public Username[] usernames; + [IfFlag(37)] public int stories_max_id; [Flags] public enum Flags : uint { @@ -818,6 +826,11 @@ namespace TL has_usernames = 0x1, /// Whether we can edit the profile picture, name, about text and description of this bot because we own it. bot_can_edit = 0x2, + close_friend = 0x4, + stories_hidden = 0x8, + stories_unavailable = 0x10, + /// Field has a value + has_stories_max_id = 0x20, } } @@ -1523,7 +1536,7 @@ namespace TL /// Peer ID, the chat where this message was sent public virtual Peer Peer { get; } /// Reply information - public virtual MessageReplyHeader ReplyTo { get; } + public virtual MessageReplyHeaderBase ReplyTo { get; } /// Date of the message public virtual DateTime Date { get; } /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. @@ -1568,7 +1581,7 @@ namespace TL /// ID of the inline bot that generated the message [IfFlag(11)] public long via_bot_id; /// Reply information - [IfFlag(3)] public MessageReplyHeader reply_to; + [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Date of the message public DateTime date; /// The message @@ -1659,7 +1672,7 @@ namespace TL /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; /// Reply information - public override MessageReplyHeader ReplyTo => reply_to; + public override MessageReplyHeaderBase ReplyTo => reply_to; /// Date of the message public override DateTime Date => date; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. @@ -1678,7 +1691,7 @@ namespace TL /// Sender of service message public Peer peer_id; /// Reply (thread) information - [IfFlag(3)] public MessageReplyHeader reply_to; + [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Message date public DateTime date; /// Event connected with the service message @@ -1715,7 +1728,7 @@ namespace TL /// Sender of service message public override Peer Peer => peer_id; /// Reply (thread) information - public override MessageReplyHeader ReplyTo => reply_to; + public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date public override DateTime Date => date; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. @@ -1772,13 +1785,14 @@ namespace TL [TLDef(0x9F84F49E)] public class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See - [TLDef(0x9CB070D7)] + [TLDef(0x4CF4D72D)] public partial class MessageMediaDocument : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; + [IfFlag(5)] public DocumentBase alt_document; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -1792,6 +1806,8 @@ namespace TL nopremium = 0x8, /// Whether this media should be hidden behind a spoiler warning spoiler = 0x10, + /// Field has a value + has_alt_document = 0x20, } } /// Preview of webpage See @@ -1903,6 +1919,21 @@ namespace TL /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } + /// See + [TLDef(0xCBB20D88)] + public class MessageMediaStory : MessageMedia + { + public Flags flags; + public long user_id; + public int id; + [IfFlag(0)] public StoryItemBase story; + + [Flags] public enum Flags : uint + { + has_story = 0x1, + via_mention = 0x2, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2661,7 +2692,7 @@ namespace TL } /// Notification settings. See - [TLDef(0xDF1F002B)] + [TLDef(0xCACB6AE2)] public class InputPeerNotifySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2674,6 +2705,9 @@ namespace TL [IfFlag(2)] public int mute_until; /// Name of an audio file for notification [IfFlag(3)] public NotificationSound sound; + [IfFlag(6)] public bool stories_muted; + [IfFlag(7)] public bool stories_hide_sender; + [IfFlag(8)] public NotificationSound stories_sound; [Flags] public enum Flags : uint { @@ -2685,11 +2719,17 @@ namespace TL has_mute_until = 0x4, /// Field has a value has_sound = 0x8, + /// Field has a value + has_stories_muted = 0x40, + /// Field has a value + has_stories_hide_sender = 0x80, + /// Field has a value + has_stories_sound = 0x100, } } /// Notification settings. See - [TLDef(0xA83B0426)] + [TLDef(0x99622C0C)] public class PeerNotifySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2706,6 +2746,11 @@ namespace TL [IfFlag(4)] public NotificationSound android_sound; /// Notification sound for other applications [IfFlag(5)] public NotificationSound other_sound; + [IfFlag(6)] public bool stories_muted; + [IfFlag(7)] public bool stories_hide_sender; + [IfFlag(8)] public NotificationSound stories_ios_sound; + [IfFlag(9)] public NotificationSound stories_android_sound; + [IfFlag(10)] public NotificationSound stories_other_sound; [Flags] public enum Flags : uint { @@ -2721,6 +2766,16 @@ namespace TL has_android_sound = 0x10, /// Field has a value has_other_sound = 0x20, + /// Field has a value + has_stories_muted = 0x40, + /// Field has a value + has_stories_hide_sender = 0x80, + /// Field has a value + has_stories_ios_sound = 0x100, + /// Field has a value + has_stories_android_sound = 0x200, + /// Field has a value + has_stories_other_sound = 0x400, } } @@ -2861,7 +2916,7 @@ namespace TL } /// Extended user info See - [TLDef(0x93EADB53)] + [TLDef(0x4FE1CC86)] public class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2902,6 +2957,7 @@ namespace TL [IfFlag(19)] public PremiumGiftOption[] premium_gifts; /// Wallpaper to use in the private chat with the user. [IfFlag(24)] public WallPaperBase wallpaper; + [IfFlag(25)] public UserStories stories; [Flags] public enum Flags : uint { @@ -2949,6 +3005,9 @@ namespace TL translations_disabled = 0x800000, /// Field has a value has_wallpaper = 0x1000000, + /// Field has a value + has_stories = 0x2000000, + stories_pinned_available = 0x4000000, } } @@ -4057,13 +4116,12 @@ namespace TL [TLDef(0x564FE691)] public class UpdateLoginToken : Update { } /// A specific user has voted in a poll See - [TLDef(0x106395C9)] + [TLDef(0x24F40E77)] public class UpdateMessagePollVote : Update { /// Poll ID public long poll_id; - /// User ID - public long user_id; + public Peer peer; /// Chosen option(s) public byte[][] options; /// New qts value, see updates » for more info. @@ -4558,6 +4616,27 @@ namespace TL /// ID of the user we couldn't add. public long user_id; } + /// See + [TLDef(0x205A4133)] + public class UpdateStory : Update + { + public long user_id; + public StoryItemBase story; + } + /// See + [TLDef(0xFEB5345A)] + public class UpdateReadStories : Update + { + public long user_id; + public int max_id; + } + /// See + [TLDef(0x1BF335B9)] + public class UpdateStoryID : Update + { + public int id; + public long random_id; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -4702,7 +4781,7 @@ namespace TL /// Info about the inline bot used to generate this message [IfFlag(11)] public long via_bot_id; /// Reply and thread information - [IfFlag(3)] public MessageReplyHeader reply_to; + [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Entities for styled text [IfFlag(7)] public MessageEntity[] entities; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. @@ -4760,7 +4839,7 @@ namespace TL /// Info about the inline bot used to generate this message [IfFlag(11)] public long via_bot_id; /// Reply (thread) information - [IfFlag(3)] public MessageReplyHeader reply_to; + [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Entities for styled text [IfFlag(7)] public MessageEntity[] entities; /// Time To Live of the message, once updateShortChatMessage.date+updateShortChatMessage.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. @@ -5694,6 +5773,8 @@ namespace TL AddedByPhone = 0xD1219BDD, ///Whether people can send you voice messages VoiceMessages = 0xAEE69D68, + ///See + About = 0x3823CC40, } /// Privacy key See @@ -5717,6 +5798,8 @@ namespace TL AddedByPhone = 0x42FFD42B, ///Whether the user accepts voice messages VoiceMessages = 0x0697F414, + ///See + About = 0xA486B761, } /// Privacy rule See Derived classes: , , , , , , , @@ -5761,6 +5844,9 @@ namespace TL /// Disallowed chat IDs public long[] chats; } + /// See + [TLDef(0x2F453E49)] + public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } /// Privacy rule See Derived classes: , , , , , , , public abstract class PrivacyRule : IObject { } @@ -5804,6 +5890,9 @@ namespace TL /// Disallowed chats public long[] chats; } + /// See + [TLDef(0xF7E8D89B)] + public class PrivacyValueAllowCloseFriends : PrivacyRule { } /// Privacy rules See [TLDef(0x50A04E45)] @@ -5863,17 +5952,18 @@ namespace TL } } /// Defines a video See - [TLDef(0x0EF02CE6)] + [TLDef(0xD38FF1C2)] public class DocumentAttributeVideo : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Duration in seconds - public int duration; + public double duration; /// Video width public int w; /// Video height public int h; + [IfFlag(2)] public int preload_prefix_size; [Flags] public enum Flags : uint { @@ -5881,6 +5971,9 @@ namespace TL round_message = 0x1, /// Whether the video supports streaming supports_streaming = 0x2, + /// Field has a value + has_preload_prefix_size = 0x4, + nosound = 0x8, } } /// Represents an audio file See @@ -11471,7 +11564,7 @@ namespace TL } /// Results of poll See - [TLDef(0xDCB82EA3)] + [TLDef(0x7ADF2420)] public class PollResults : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11481,7 +11574,7 @@ namespace TL /// Total number of people that voted in the poll [IfFlag(2)] public int total_voters; /// IDs of the last users that recently voted in the poll - [IfFlag(3)] public long[] recent_voters; + [IfFlag(3)] public Peer[] recent_voters; /// Explanation of quiz solution [IfFlag(4)] public string solution; /// Message entities for styled text in quiz solution @@ -11716,7 +11809,7 @@ namespace TL } /// Autodownload settings See - [TLDef(0x8EFAB953)] + [TLDef(0xBAA57628)] public class AutoDownloadSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11729,6 +11822,8 @@ namespace TL public long file_size_max; /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; + public int small_queue_active_operations_max; + public int large_queue_active_operations_max; [Flags] public enum Flags : uint { @@ -11740,6 +11835,7 @@ namespace TL audio_preload_next = 0x4, /// Whether to enable data saving mode in phone calls phonecalls_less_data = 0x8, + stories_preload = 0x10, } } @@ -12172,72 +12268,32 @@ namespace TL has_settings = 0x2, } } - - /// How a user voted in a poll See Derived classes: , , - public abstract class MessageUserVoteBase : IObject + /// See + [TLDef(0x939A4671)] + public class WebPageAttributeStory : WebPageAttribute { - /// User ID - public virtual long UserId { get; } - /// When did the user cast the vote - public virtual DateTime Date { get; } - } - /// How a user voted in a poll See - [TLDef(0x34D247B4)] - public class MessageUserVote : MessageUserVoteBase - { - /// User ID + public Flags flags; public long user_id; - /// The option chosen by the user - public byte[] option; - /// When did the user cast the vote - public DateTime date; + public int id; + [IfFlag(0)] public StoryItemBase story; - /// User ID - public override long UserId => user_id; - /// When did the user cast the vote - public override DateTime Date => date; - } - /// How a user voted in a poll (reduced constructor, returned if an option was provided to Messages_GetPollVotes) See - [TLDef(0x3CA5B0EC)] - public class MessageUserVoteInputOption : MessageUserVoteBase - { - /// The user that voted for the queried option - public long user_id; - /// When did the user cast the vote - public DateTime date; - - /// The user that voted for the queried option - public override long UserId => user_id; - /// When did the user cast the vote - public override DateTime Date => date; - } - /// How a user voted in a multiple-choice poll See - [TLDef(0x8A65E557)] - public class MessageUserVoteMultiple : MessageUserVoteBase - { - /// User ID - public long user_id; - /// Options chosen by the user - public byte[][] options; - /// When did the user cast their votes - public DateTime date; - - /// User ID - public override long UserId => user_id; - /// When did the user cast their votes - public override DateTime Date => date; + [Flags] public enum Flags : uint + { + has_story = 0x1, + } } /// How users voted in a poll See - [TLDef(0x0823F649)] - public class Messages_VotesList : IObject + [TLDef(0x4899484E)] + public class Messages_VotesList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of votes for all options (or only for the chosen option, if provided to Messages_GetPollVotes) public int count; /// Vote info for each user - public MessageUserVoteBase[] votes; + public MessagePeerVoteBase[] votes; + public Dictionary chats; /// Info about users that voted in the poll public Dictionary users; /// Offset to use with the next Messages_GetPollVotes request, empty string if no more results are available. @@ -12248,6 +12304,8 @@ namespace TL /// Field has a value has_next_offset = 0x1, } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Credit card info URL provided by the bank See @@ -12660,18 +12718,18 @@ namespace TL } /// Global privacy settings See - [TLDef(0xBEA2F424)] + [TLDef(0x734C4CCB)] public class GlobalPrivacySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Whether to archive and mute new chats from non-contacts - [IfFlag(0)] public bool archive_and_mute_new_noncontact_peers; [Flags] public enum Flags : uint { - /// Field has a value - has_archive_and_mute_new_noncontact_peers = 0x1, + /// Whether to archive and mute new chats from non-contacts + archive_and_mute_new_noncontact_peers = 0x1, + keep_archived_unmuted = 0x2, + keep_archived_folders = 0x4, } } @@ -12804,9 +12862,11 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Reply information See Derived classes: + public abstract class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See [TLDef(0xA6D57763)] - public class MessageReplyHeader : IObject + public class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12829,6 +12889,13 @@ namespace TL forum_topic = 0x8, } } + /// See + [TLDef(0x9C98BFC1)] + public class MessageReplyStoryHeader : MessageReplyHeaderBase + { + public long user_id; + public int story_id; + } /// Info about the comment section of a channel post, or a simple message thread See [TLDef(0x83D60FC2)] @@ -13370,7 +13437,7 @@ namespace TL public class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xFC25B828)] + [TLDef(0xDAAFFF6B)] public class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13387,6 +13454,7 @@ namespace TL [IfFlag(2)] public int channel_post; /// Parameter for the bot start message if the sponsored chat is a chat with a bot. [IfFlag(0)] public string start_param; + [IfFlag(9)] public SponsoredWebPage webpage; /// Sponsored message public string message; /// Message entities for styled text @@ -13416,6 +13484,8 @@ namespace TL has_sponsor_info = 0x80, /// Field has a value has_additional_info = 0x100, + /// Field has a value + has_webpage = 0x200, } } @@ -13708,6 +13778,8 @@ namespace TL big = 0x1, /// Whether the reaction wasn't yet marked as read by the current user unread = 0x2, + /// Starting from layer 159, Messages_SendReaction will send reactions from the peer (user or channel) specified using Messages_SaveDefaultSendAs.
If set, this flag indicates that this reaction was sent by us, even if the peer doesn't point to the current account.
+ my = 0x4, } } @@ -14858,4 +14930,245 @@ namespace TL /// Bot description public string description; } + + /// See + public abstract class MessagePeerVoteBase : IObject + { + public virtual Peer Peer { get; } + public virtual DateTime Date { get; } + } + /// See + [TLDef(0xB6CC2D5C)] + public class MessagePeerVote : MessagePeerVoteBase + { + public Peer peer; + public byte[] option; + public DateTime date; + + public override Peer Peer => peer; + public override DateTime Date => date; + } + /// See + [TLDef(0x74CDA504)] + public class MessagePeerVoteInputOption : MessagePeerVoteBase + { + public Peer peer; + public DateTime date; + + public override Peer Peer => peer; + public override DateTime Date => date; + } + /// See + [TLDef(0x4628F6E6)] + public class MessagePeerVoteMultiple : MessagePeerVoteBase + { + public Peer peer; + public byte[][] options; + public DateTime date; + + public override Peer Peer => peer; + public override DateTime Date => date; + } + + /// See + [TLDef(0x3DB8EC63)] + public class SponsoredWebPage : IObject + { + public Flags flags; + public string url; + public string site_name; + [IfFlag(0)] public PhotoBase photo; + + [Flags] public enum Flags : uint + { + has_photo = 0x1, + } + } + + /// See + [TLDef(0xD36760CF)] + public class StoryViews : IObject + { + public Flags flags; + public int views_count; + [IfFlag(0)] public long[] recent_viewers; + + [Flags] public enum Flags : uint + { + has_recent_viewers = 0x1, + } + } + + /// See + public abstract class StoryItemBase : IObject + { + public virtual int ID { get; } + } + /// See + [TLDef(0x51E6EE4F)] + public class StoryItemDeleted : StoryItemBase + { + public int id; + + public override int ID => id; + } + /// See + [TLDef(0xFFADC913)] + public class StoryItemSkipped : StoryItemBase + { + public Flags flags; + public int id; + public DateTime date; + public DateTime expire_date; + + [Flags] public enum Flags : uint + { + close_friends = 0x100, + } + + public override int ID => id; + } + /// See + [TLDef(0x562AA637)] + public class StoryItem : StoryItemBase + { + public Flags flags; + public int id; + public DateTime date; + public DateTime expire_date; + [IfFlag(0)] public string caption; + [IfFlag(1)] public MessageEntity[] entities; + public MessageMedia media; + [IfFlag(2)] public PrivacyRule[] privacy; + [IfFlag(3)] public StoryViews views; + + [Flags] public enum Flags : uint + { + has_caption = 0x1, + has_entities = 0x2, + has_privacy = 0x4, + has_views = 0x8, + pinned = 0x20, + public_ = 0x80, + close_friends = 0x100, + min = 0x200, + noforwards = 0x400, + edited = 0x800, + contacts = 0x1000, + selected_contacts = 0x2000, + } + + public override int ID => id; + } + + /// See + [TLDef(0x8611A200)] + public class UserStories : IObject + { + public Flags flags; + public long user_id; + [IfFlag(0)] public int max_read_id; + public StoryItemBase[] stories; + + [Flags] public enum Flags : uint + { + has_max_read_id = 0x1, + } + } + + /// See + public abstract class Stories_AllStoriesBase : IObject { } + /// See + [TLDef(0x47E0A07E)] + public class Stories_AllStoriesNotModified : Stories_AllStoriesBase + { + public string state; + } + /// See + [TLDef(0x839E0428)] + public class Stories_AllStories : Stories_AllStoriesBase + { + public Flags flags; + public int count; + public string state; + public UserStories[] user_stories; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_more = 0x1, + } + } + + /// See + [TLDef(0x4FE57DF1)] + public class Stories_Stories : IObject + { + public int count; + public StoryItemBase[] stories; + public Dictionary users; + } + + /// See + [TLDef(0x37A6FF5F)] + public class Stories_UserStories : IObject + { + public UserStories stories; + public Dictionary users; + } + + /// See + [TLDef(0xA71AACC2)] + public class StoryView : IObject + { + public long user_id; + public DateTime date; + } + + /// See + [TLDef(0xFB3F77AC)] + public class Stories_StoryViewsList : IObject + { + public int count; + public StoryView[] views; + public Dictionary users; + } + + /// See + [TLDef(0xDE9EED1D)] + public class Stories_StoryViews : IObject + { + public StoryViews[] views; + public Dictionary users; + } + + /// See + public abstract class InputReplyTo : IObject { } + /// See + [TLDef(0x9C5386E4)] + public class InputReplyToMessage : InputReplyTo + { + public Flags flags; + public int reply_to_msg_id; + [IfFlag(0)] public int top_msg_id; + + [Flags] public enum Flags : uint + { + has_top_msg_id = 0x1, + } + } + /// See + [TLDef(0x15B0F283)] + public class InputReplyToStory : InputReplyTo + { + public InputUserBase user_id; + public int story_id; + } + + /// See + [TLDef(0x3FC9053B)] + public class ExportedStoryLink : IObject + { + public string link; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 73ca1c9..a8df2b4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -759,10 +759,10 @@ namespace TL /// Returns list of chats with non-default notification settings See /// If true, chats with non-default sound will also be returned /// If specified, only chats of the specified category will be returned - public static Task Account_GetNotifyExceptions(this Client client, InputNotifyPeerBase peer = null, bool compare_sound = false) + public static Task Account_GetNotifyExceptions(this Client client, InputNotifyPeerBase peer = null, bool compare_sound = false, bool compare_stories = false) => client.Invoke(new Account_GetNotifyExceptions { - flags = (Account_GetNotifyExceptions.Flags)((peer != null ? 0x1 : 0) | (compare_sound ? 0x2 : 0)), + flags = (Account_GetNotifyExceptions.Flags)((peer != null ? 0x1 : 0) | (compare_sound ? 0x2 : 0) | (compare_stories ? 0x4 : 0)), peer = peer, }); @@ -1144,6 +1144,13 @@ namespace TL { }); + /// See + public static Task Account_InvalidateSignInCodes(this Client client, params string[] codes) + => client.Invoke(new Account_InvalidateSignInCodes + { + codes = codes, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1170,6 +1177,13 @@ namespace TL errors = errors, }); + /// See + public static Task Users_GetStoriesMaxIDs(this Client client, params InputUserBase[] id) + => client.Invoke(new Users_GetStoriesMaxIDs + { + id = id, + }); + /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -1383,6 +1397,21 @@ namespace TL token = token, }); + /// See + public static Task Contacts_EditCloseFriends(this Client client, params long[] id) + => client.Invoke(new Contacts_EditCloseFriends + { + id = id, + }); + + /// See + public static Task Contacts_ToggleStoriesHidden(this Client client, InputUserBase id, bool hidden) + => client.Invoke(new Contacts_ToggleStoriesHidden + { + id = id, + hidden = hidden, + }); + /// This method is only for basic Chat. See Terminology 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) @@ -1532,21 +1561,18 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination where the message will be sent - /// The message ID to which this message will reply to - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, message = message, random_id = random_id, reply_markup = reply_markup, @@ -1562,8 +1588,6 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// Destination - /// Message ID to which this message should reply to - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Attached media /// Caption /// Random ID to avoid resending the same message You can use @@ -1571,13 +1595,12 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, int? reply_to_msg_id = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, media = media, message = message, random_id = random_id, @@ -2098,20 +2121,17 @@ namespace TL /// Whether to clear the draft /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination - /// ID of the message this message should reply to - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, random_id = random_id, query_id = query_id, id = id, @@ -2376,13 +2396,6 @@ namespace TL limit = limit, }); - /// See - public static Task Messages_GetAllChats(this Client client, long[] except_ids = null) - => client.Invoke(new Messages_GetAllChats - { - except_ids = except_ids, - }); - /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here @@ -2461,13 +2474,12 @@ namespace TL /// Notify the other user in a private chat that a screenshot of the chat was taken See Possible codes: 400 (details) /// Other user - /// ID of message that was screenshotted, can be 0 /// Random ID to avoid message resending You can use - public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, int reply_to_msg_id, long random_id) + public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, InputReplyTo reply_to, long random_id) => client.Invoke(new Messages_SendScreenshotNotification { peer = peer, - reply_to_msg_id = reply_to_msg_id, + reply_to = reply_to, random_id = random_id, }); @@ -2541,18 +2553,15 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat - /// The message to reply to - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, int? reply_to_msg_id = null, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), peer = peer, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, @@ -3364,21 +3373,18 @@ namespace TL /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, int? reply_to_msg_id = null, string url = null, DataJSON theme_params = null, string start_param = null, int? top_msg_id = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), + flags = (Messages_RequestWebView.Flags)((reply_to != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), peer = peer, bot = bot, url = url, start_param = start_param, theme_params = theme_params, platform = platform, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, send_as = send_as, }); @@ -3387,18 +3393,15 @@ namespace TL /// Dialog where the web app was opened. /// Bot that owns the web app /// Web app interaction ID obtained from Messages_RequestWebView - /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to this message ID. - /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic. /// Open the web app as the specified peer - public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, int? reply_to_msg_id = null, int? top_msg_id = null, InputPeer send_as = null, bool silent = false) + public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, InputReplyTo reply_to = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView { - flags = (Messages_ProlongWebView.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x200 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0)), + flags = (Messages_ProlongWebView.Flags)((reply_to != null ? 0x1 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0)), peer = peer, bot = bot, query_id = query_id, - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + reply_to = reply_to, send_as = send_as, }); @@ -3671,14 +3674,16 @@ namespace TL /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 /// date, see updates. /// QTS, see updates. - public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null) + public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null, int? pts_limit = null, int? qts_limit = null) => client.Invoke(new Updates_GetDifference { - flags = (Updates_GetDifference.Flags)(pts_total_limit != null ? 0x1 : 0), + flags = (Updates_GetDifference.Flags)((pts_total_limit != null ? 0x1 : 0) | (pts_limit != null ? 0x2 : 0) | (qts_limit != null ? 0x4 : 0)), pts = pts, + pts_limit = pts_limit.GetValueOrDefault(), pts_total_limit = pts_total_limit.GetValueOrDefault(), date = date, qts = qts, + qts_limit = qts_limit.GetValueOrDefault(), }); /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) @@ -4647,6 +4652,14 @@ namespace TL enabled = enabled, }); + /// See + public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) + => client.Invoke(new Channels_ClickSponsoredMessage + { + channel = channel, + random_id = random_id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5598,6 +5611,150 @@ namespace TL chatlist = chatlist, peers = peers, }); + + /// See + public static Task Stories_SendStory(this Client client, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, bool pinned = false, bool noforwards = false) + => client.Invoke(new Stories_SendStory + { + flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0)), + media = media, + caption = caption, + entities = entities, + privacy_rules = privacy_rules, + random_id = random_id, + period = period.GetValueOrDefault(), + }); + + /// See + public static Task Stories_EditStory(this Client client, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null) + => client.Invoke(new Stories_EditStory + { + flags = (Stories_EditStory.Flags)((media != null ? 0x1 : 0) | (caption != null ? 0x2 : 0) | (entities != null ? 0x2 : 0) | (privacy_rules != null ? 0x4 : 0)), + id = id, + media = media, + caption = caption, + entities = entities, + privacy_rules = privacy_rules, + }); + + /// See + public static Task Stories_DeleteStories(this Client client, params int[] id) + => client.Invoke(new Stories_DeleteStories + { + id = id, + }); + + /// See + public static Task Stories_TogglePinned(this Client client, int[] id, bool pinned) + => client.Invoke(new Stories_TogglePinned + { + id = id, + pinned = pinned, + }); + + /// See + public static Task Stories_GetAllStories(this Client client, string state = null, bool next = false, bool hidden = false) + => client.Invoke(new Stories_GetAllStories + { + flags = (Stories_GetAllStories.Flags)((state != null ? 0x1 : 0) | (next ? 0x2 : 0) | (hidden ? 0x4 : 0)), + state = state, + }); + + /// See + public static Task Stories_GetUserStories(this Client client, InputUserBase user_id) + => client.Invoke(new Stories_GetUserStories + { + user_id = user_id, + }); + + /// See + public static Task Stories_GetPinnedStories(this Client client, InputUserBase user_id, int offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Stories_GetPinnedStories + { + user_id = user_id, + offset_id = offset_id, + limit = limit, + }); + + /// See + public static Task Stories_GetStoriesArchive(this Client client, int offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Stories_GetStoriesArchive + { + offset_id = offset_id, + limit = limit, + }); + + /// See + public static Task Stories_GetStoriesByID(this Client client, InputUserBase user_id, params int[] id) + => client.Invoke(new Stories_GetStoriesByID + { + user_id = user_id, + id = id, + }); + + /// See + public static Task Stories_ToggleAllStoriesHidden(this Client client, bool hidden) + => client.Invoke(new Stories_ToggleAllStoriesHidden + { + hidden = hidden, + }); + + /// See + public static Task Stories_GetAllReadUserStories(this Client client) + => client.Invoke(new Stories_GetAllReadUserStories + { + }); + + /// See + public static Task Stories_ReadStories(this Client client, InputUserBase user_id, int max_id = default) + => client.Invoke(new Stories_ReadStories + { + user_id = user_id, + max_id = max_id, + }); + + /// See + public static Task Stories_IncrementStoryViews(this Client client, InputUserBase user_id, params int[] id) + => client.Invoke(new Stories_IncrementStoryViews + { + user_id = user_id, + id = id, + }); + + /// See + public static Task Stories_GetStoryViewsList(this Client client, int id, DateTime offset_date = default, long offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Stories_GetStoryViewsList + { + id = id, + offset_date = offset_date, + offset_id = offset_id, + limit = limit, + }); + + /// See + public static Task Stories_GetStoriesViews(this Client client, params int[] id) + => client.Invoke(new Stories_GetStoriesViews + { + id = id, + }); + + /// See + public static Task Stories_ExportStoryLink(this Client client, InputUserBase user_id, int id) + => client.Invoke(new Stories_ExportStoryLink + { + user_id = user_id, + id = id, + }); + + /// See + public static Task Stories_Report(this Client client, InputUserBase user_id, int[] id, ReportReason reason, string message) + => client.Invoke(new Stories_Report + { + user_id = user_id, + id = id, + reason = reason, + message = message, + }); } } @@ -6167,6 +6324,7 @@ namespace TL.Methods { has_peer = 0x1, compare_sound = 0x2, + compare_stories = 0x4, } } @@ -6473,6 +6631,12 @@ namespace TL.Methods [TLDef(0x53BC0020)] public class Account_DeleteAutoSaveExceptions : IMethod { } + [TLDef(0xCA8AE8BA)] + public class Account_InvalidateSignInCodes : IMethod + { + public string[] codes; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -6492,6 +6656,12 @@ namespace TL.Methods public SecureValueErrorBase[] errors; } + [TLDef(0xCA1CB9AB)] + public class Users_GetStoriesMaxIDs : IMethod + { + public InputUserBase[] id; + } + [TLDef(0x7ADC669D)] public class Contacts_GetContactIDs : IMethod { @@ -6661,6 +6831,19 @@ namespace TL.Methods public string token; } + [TLDef(0xBA6705F0)] + public class Contacts_EditCloseFriends : IMethod + { + public long[] id; + } + + [TLDef(0x753FB865)] + public class Contacts_ToggleStoriesHidden : IMethod + { + public InputUserBase id; + public bool hidden; + } + [TLDef(0x63C66506)] public class Messages_GetMessages : IMethod { @@ -6780,13 +6963,12 @@ namespace TL.Methods } } - [TLDef(0x1CC20387)] + [TLDef(0x280D096F)] public class Messages_SendMessage : IMethod { public Flags flags; public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; public string message; public long random_id; [IfFlag(2)] public ReplyMarkup reply_markup; @@ -6796,14 +6978,13 @@ namespace TL.Methods [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, no_webpage = 0x2, has_reply_markup = 0x4, has_entities = 0x8, silent = 0x20, background = 0x40, clear_draft = 0x80, - has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -6811,13 +6992,12 @@ namespace TL.Methods } } - [TLDef(0x7547C966)] + [TLDef(0x72CCC23D)] public class Messages_SendMedia : IMethod { public Flags flags; public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; public InputMedia media; public string message; public long random_id; @@ -6828,13 +7008,12 @@ namespace TL.Methods [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, has_reply_markup = 0x4, has_entities = 0x8, silent = 0x20, background = 0x40, clear_draft = 0x80, - has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -7253,13 +7432,12 @@ namespace TL.Methods } } - [TLDef(0xD3FBDCCB)] + [TLDef(0xF7BC68BA)] public class Messages_SendInlineBotResult : IMethod { public Flags flags; public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; public long random_id; public long query_id; public string id; @@ -7268,11 +7446,10 @@ namespace TL.Methods [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, silent = 0x20, background = 0x40, clear_draft = 0x80, - has_top_msg_id = 0x200, has_schedule_date = 0x400, hide_via = 0x800, has_send_as = 0x2000, @@ -7519,12 +7696,6 @@ namespace TL.Methods public int limit; } - [TLDef(0x875F74BE)] - public class Messages_GetAllChats : IMethod - { - public long[] except_ids; - } - [TLDef(0x32CA8F91)] public class Messages_GetWebPage : IMethod { @@ -7599,11 +7770,11 @@ namespace TL.Methods public InputMedia media; } - [TLDef(0xC97DF020)] + [TLDef(0xA1405817)] public class Messages_SendScreenshotNotification : IMethod { public InputPeer peer; - public int reply_to_msg_id; + public InputReplyTo reply_to; public long random_id; } @@ -7659,24 +7830,22 @@ namespace TL.Methods public long hash; } - [TLDef(0xB6F11A1C)] + [TLDef(0x456E8987)] public class Messages_SendMultiMedia : IMethod { public Flags flags; public InputPeer peer; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; public InputSingleMedia[] multi_media; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, silent = 0x20, background = 0x40, clear_draft = 0x80, - has_top_msg_id = 0x200, has_schedule_date = 0x400, has_send_as = 0x2000, noforwards = 0x4000, @@ -8343,7 +8512,7 @@ namespace TL.Methods } } - [TLDef(0x178B480B)] + [TLDef(0x269DC2C1)] public class Messages_RequestWebView : IMethod { public Flags flags; @@ -8353,39 +8522,35 @@ namespace TL.Methods [IfFlag(3)] public string start_param; [IfFlag(2)] public DataJSON theme_params; public string platform; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, has_url = 0x2, has_theme_params = 0x4, has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, - has_top_msg_id = 0x200, has_send_as = 0x2000, } } - [TLDef(0x7FF34309)] + [TLDef(0xB0D81A83)] public class Messages_ProlongWebView : IMethod { public Flags flags; public InputPeer peer; public InputUserBase bot; public long query_id; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(9)] public int top_msg_id; + [IfFlag(0)] public InputReplyTo reply_to; [IfFlag(13)] public InputPeer send_as; [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, + has_reply_to = 0x1, silent = 0x20, - has_top_msg_id = 0x200, has_send_as = 0x2000, } } @@ -8588,18 +8753,22 @@ namespace TL.Methods [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } - [TLDef(0x25939651)] + [TLDef(0x19C2F763)] public class Updates_GetDifference : IMethod { public Flags flags; public int pts; + [IfFlag(1)] public int pts_limit; [IfFlag(0)] public int pts_total_limit; public DateTime date; public int qts; + [IfFlag(2)] public int qts_limit; [Flags] public enum Flags : uint { has_pts_total_limit = 0x1, + has_pts_limit = 0x2, + has_qts_limit = 0x4, } } @@ -9337,6 +9506,13 @@ namespace TL.Methods public bool enabled; } + [TLDef(0x18AFBC93)] + public class Channels_ClickSponsoredMessage : IMethod + { + public InputChannelBase channel; + public byte[] random_id; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -10122,4 +10298,152 @@ namespace TL.Methods public InputChatlist chatlist; public InputPeer[] peers; } + + [TLDef(0x424CD47A)] + public class Stories_SendStory : IMethod + { + public Flags flags; + public InputMedia media; + [IfFlag(0)] public string caption; + [IfFlag(1)] public MessageEntity[] entities; + public InputPrivacyRule[] privacy_rules; + public long random_id; + [IfFlag(3)] public int period; + + [Flags] public enum Flags : uint + { + has_caption = 0x1, + has_entities = 0x2, + pinned = 0x4, + has_period = 0x8, + noforwards = 0x10, + } + } + + [TLDef(0x2AAE7A41)] + public class Stories_EditStory : IMethod + { + public Flags flags; + public int id; + [IfFlag(0)] public InputMedia media; + [IfFlag(1)] public string caption; + [IfFlag(1)] public MessageEntity[] entities; + [IfFlag(2)] public InputPrivacyRule[] privacy_rules; + + [Flags] public enum Flags : uint + { + has_media = 0x1, + has_caption = 0x2, + has_privacy_rules = 0x4, + } + } + + [TLDef(0xB5D501D7)] + public class Stories_DeleteStories : IMethod + { + public int[] id; + } + + [TLDef(0x51602944)] + public class Stories_TogglePinned : IMethod + { + public int[] id; + public bool pinned; + } + + [TLDef(0xEEB0D625)] + public class Stories_GetAllStories : IMethod + { + public Flags flags; + [IfFlag(0)] public string state; + + [Flags] public enum Flags : uint + { + has_state = 0x1, + next = 0x2, + hidden = 0x4, + } + } + + [TLDef(0x96D528E0)] + public class Stories_GetUserStories : IMethod + { + public InputUserBase user_id; + } + + [TLDef(0x0B471137)] + public class Stories_GetPinnedStories : IMethod + { + public InputUserBase user_id; + public int offset_id; + public int limit; + } + + [TLDef(0x1F5BC5D2)] + public class Stories_GetStoriesArchive : IMethod + { + public int offset_id; + public int limit; + } + + [TLDef(0x6A15CF46)] + public class Stories_GetStoriesByID : IMethod + { + public InputUserBase user_id; + public int[] id; + } + + [TLDef(0x7C2557C4)] + public class Stories_ToggleAllStoriesHidden : IMethod + { + public bool hidden; + } + + [TLDef(0x729C562C)] + public class Stories_GetAllReadUserStories : IMethod { } + + [TLDef(0xEDC5105B)] + public class Stories_ReadStories : IMethod + { + public InputUserBase user_id; + public int max_id; + } + + [TLDef(0x22126127)] + public class Stories_IncrementStoryViews : IMethod + { + public InputUserBase user_id; + public int[] id; + } + + [TLDef(0x4B3B5E97)] + public class Stories_GetStoryViewsList : IMethod + { + public int id; + public DateTime offset_date; + public long offset_id; + public int limit; + } + + [TLDef(0x9A75D6A6)] + public class Stories_GetStoriesViews : IMethod + { + public int[] id; + } + + [TLDef(0x16E443CE)] + public class Stories_ExportStoryLink : IMethod + { + public InputUserBase user_id; + public int id; + } + + [TLDef(0xC95BE06A)] + public class Stories_Report : IMethod + { + public InputUserBase user_id; + public int[] id; + public ReportReason reason; + public string message; + } } diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 6ab716a..effd431 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -740,6 +740,26 @@ namespace TL /// User is uploading a round video See [TLDef(0xBB718624)] public class SendMessageUploadRoundAction : SendMessageAction { } + + /// Defines a video See + [TLDef(0x0EF02CE6)] + public class DocumentAttributeVideo : DocumentAttribute + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + /// Duration in seconds + public int duration; + /// Video width + public int w; + /// Video height + public int h; + + [Flags] public enum Flags : uint + { + /// Whether this is a round video + round_message = 0x1, + } + } } namespace Layer73 diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 441228b..0ffcd41 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 = 158; // fetched 21/04/2023 14:33:19 + public const int Version = 160; // fetched 21/07/2023 07:55:22 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -98,6 +98,7 @@ namespace TL [0x971FA843] = typeof(InputMediaGeoLive), [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), + [0x9A86B58F] = typeof(InputMediaStory), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -119,7 +120,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x8F97C628] = typeof(User), + [0xABB5F120] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -150,7 +151,7 @@ namespace TL [0x56E0D474] = typeof(MessageMediaGeo), [0x70322949] = typeof(MessageMediaContact), [0x9F84F49E] = typeof(MessageMediaUnsupported), - [0x9CB070D7] = typeof(MessageMediaDocument), + [0x4CF4D72D] = typeof(MessageMediaDocument), [0xA32DD600] = typeof(MessageMediaWebPage), [0x2EC0533F] = typeof(MessageMediaVenue), [0xFDB19008] = typeof(MessageMediaGame), @@ -158,6 +159,7 @@ namespace TL [0xB940C666] = typeof(MessageMediaGeoLive), [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), + [0xCBB20D88] = typeof(MessageMediaStory), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -219,12 +221,12 @@ namespace TL [0x4A95E84E] = typeof(InputNotifyChats), [0xB1DB7C7E] = typeof(InputNotifyBroadcasts), [0x5C467992] = typeof(InputNotifyForumTopic), - [0xDF1F002B] = typeof(InputPeerNotifySettings), - [0xA83B0426] = typeof(PeerNotifySettings), + [0xCACB6AE2] = typeof(InputPeerNotifySettings), + [0x99622C0C] = typeof(PeerNotifySettings), [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x93EADB53] = typeof(UserFull), + [0x4FE1CC86] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -332,7 +334,7 @@ namespace TL [0x8216FBA3] = typeof(UpdateTheme), [0x871FB939] = typeof(UpdateGeoLiveViewed), [0x564FE691] = typeof(UpdateLoginToken), - [0x106395C9] = typeof(UpdateMessagePollVote), + [0x24F40E77] = typeof(UpdateMessagePollVote), [0x26FFDE7D] = typeof(UpdateDialogFilter), [0xA5D72105] = typeof(UpdateDialogFilterOrder), [0x3504914F] = typeof(UpdateDialogFilters), @@ -372,6 +374,9 @@ namespace TL [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), [0xCCF08AD6] = typeof(UpdateGroupInvitePrivacyForbidden), + [0x205A4133] = typeof(UpdateStory), + [0xFEB5345A] = typeof(UpdateReadStories), + [0x1BF335B9] = typeof(UpdateStoryID), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -450,6 +455,7 @@ namespace TL [0x90110467] = typeof(InputPrivacyValueDisallowUsers), [0x840649CF] = typeof(InputPrivacyValueAllowChatParticipants), [0xE94F0F86] = typeof(InputPrivacyValueDisallowChatParticipants), + [0x2F453E49] = typeof(InputPrivacyValueAllowCloseFriends), [0xFFFE1BAC] = typeof(PrivacyValueAllowContacts), [0x65427B82] = typeof(PrivacyValueAllowAll), [0xB8905FB2] = typeof(PrivacyValueAllowUsers), @@ -458,12 +464,13 @@ namespace TL [0xE4621141] = typeof(PrivacyValueDisallowUsers), [0x6B134E8E] = typeof(PrivacyValueAllowChatParticipants), [0x41C87565] = typeof(PrivacyValueDisallowChatParticipants), + [0xF7E8D89B] = typeof(PrivacyValueAllowCloseFriends), [0x50A04E45] = typeof(Account_PrivacyRules), [0xB8D0AFDF] = typeof(AccountDaysTTL), [0x6C37C15C] = typeof(DocumentAttributeImageSize), [0x11B58939] = typeof(DocumentAttributeAnimated), [0x6319D612] = typeof(DocumentAttributeSticker), - [0x0EF02CE6] = typeof(DocumentAttributeVideo), + [0xD38FF1C2] = typeof(DocumentAttributeVideo), [0x9852F9C6] = typeof(DocumentAttributeAudio), [0x15590068] = typeof(DocumentAttributeFilename), [0x9801D2F7] = typeof(DocumentAttributeHasStickers), @@ -865,7 +872,7 @@ namespace TL [0x6CA9C2E9] = typeof(PollAnswer), [0x86E18161] = typeof(Poll), [0x3B6DDAD2] = typeof(PollAnswerVoters), - [0xDCB82EA3] = typeof(PollResults), + [0x7ADF2420] = typeof(PollResults), [0xF041E250] = typeof(ChatOnlines), [0x47A971E0] = typeof(StatsURL), [0x5FB224D5] = typeof(ChatAdminRights), @@ -877,7 +884,7 @@ namespace TL [0xCDC3858C] = typeof(Account_WallPapers), [0xAD253D78] = typeof(CodeSettings), [0x1DC1BCA4] = typeof(WallPaperSettings), - [0x8EFAB953] = typeof(AutoDownloadSettings), + [0xBAA57628] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), [0xD5B3B9F9] = typeof(EmojiKeyword), [0x236DF622] = typeof(EmojiKeywordDeleted), @@ -909,10 +916,8 @@ namespace TL [0x8FDE504F] = typeof(InputThemeSettings), [0xFA58B6D4] = typeof(ThemeSettings), [0x54B56617] = typeof(WebPageAttributeTheme), - [0x34D247B4] = typeof(MessageUserVote), - [0x3CA5B0EC] = typeof(MessageUserVoteInputOption), - [0x8A65E557] = typeof(MessageUserVoteMultiple), - [0x0823F649] = typeof(Messages_VotesList), + [0x939A4671] = typeof(WebPageAttributeStory), + [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), [0x7438F7E8] = typeof(DialogFilter), @@ -936,7 +941,7 @@ namespace TL [0xD7584C87] = typeof(StatsGroupTopAdmin), [0x535F779D] = typeof(StatsGroupTopInviter), [0xEF7FF916] = typeof(Stats_MegagroupStats), - [0xBEA2F424] = typeof(GlobalPrivacySettings), + [0x734C4CCB] = typeof(GlobalPrivacySettings), [0x4203C5EF] = typeof(Help_CountryCode), [0xC3878E23] = typeof(Help_Country), [0x93CC1F32] = null,//Help_CountriesListNotModified @@ -945,6 +950,7 @@ namespace TL [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), [0xA6D57763] = typeof(MessageReplyHeader), + [0x9C98BFC1] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), [0x8999F295] = typeof(Stats_MessageStats), @@ -980,7 +986,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xFC25B828] = typeof(SponsoredMessage), + [0xDAAFFF6B] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1093,9 +1099,29 @@ namespace TL [0x1DCD839D] = typeof(Chatlists_ChatlistInvite), [0x93BD878D] = typeof(Chatlists_ChatlistUpdates), [0xE8A775B0] = typeof(Bots_BotInfo), + [0xB6CC2D5C] = typeof(MessagePeerVote), + [0x74CDA504] = typeof(MessagePeerVoteInputOption), + [0x4628F6E6] = typeof(MessagePeerVoteMultiple), + [0x3DB8EC63] = typeof(SponsoredWebPage), + [0xD36760CF] = typeof(StoryViews), + [0x51E6EE4F] = typeof(StoryItemDeleted), + [0xFFADC913] = typeof(StoryItemSkipped), + [0x562AA637] = typeof(StoryItem), + [0x8611A200] = typeof(UserStories), + [0x47E0A07E] = typeof(Stories_AllStoriesNotModified), + [0x839E0428] = typeof(Stories_AllStories), + [0x4FE57DF1] = typeof(Stories_Stories), + [0x37A6FF5F] = typeof(Stories_UserStories), + [0xA71AACC2] = typeof(StoryView), + [0xFB3F77AC] = typeof(Stories_StoryViewsList), + [0xDE9EED1D] = typeof(Stories_StoryViews), + [0x9C5386E4] = typeof(InputReplyToMessage), + [0x15B0F283] = typeof(InputReplyToStory), + [0x3FC9053B] = typeof(ExportedStoryLink), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), + [0x0EF02CE6] = typeof(Layer66.DocumentAttributeVideo), [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), [0xE50511D8] = typeof(Layer46.DecryptedMessageMediaWebPage), [0x8A0DF56F] = typeof(Layer46.DecryptedMessageMediaVenue), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ad1e28b..619e99b 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: 158 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 160 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From e20d4d715c3839b3a9c26ce513494153af5db8ad Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 12 Aug 2023 15:03:09 +0200 Subject: [PATCH 109/336] Updated Examples projects --- .github/dev.yml | 2 +- .github/release.yml | 1 + Examples/ASPnet_webapp.zip | Bin 4867 -> 4873 bytes Examples/WinForms_app.zip | Bin 10502 -> 10505 bytes src/TL.SchemaFuncs.cs | 40 ++++++++++++++++++------------------- 5 files changed, 22 insertions(+), 21 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 575c2b5..7e13821 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ trigger: - master -name: 3.5.2-dev.$(Rev:r) +name: 3.5.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 352507d..b9e21be 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,6 +8,7 @@ pool: variables: buildConfiguration: 'Release' + releaseNotes: $[replace(variables['releaseNotes'], '"', '''''')] stages: - stage: publish diff --git a/Examples/ASPnet_webapp.zip b/Examples/ASPnet_webapp.zip index 3b1ee95a88fb7a779ff9be0f24cde8563fde6e16..f1183ce78ecf09623125f173992bddcbfe0defdd 100644 GIT binary patch delta 524 zcmZox>r~?l@MdNaVE}=Nr99yq`BpNr7?ksbPu|UFD+pppL~$F$F)=XgWno}2pS+M; zYVt9Dh0V@PflPvYCEJ!}ey$Oa`2XiOJII{L0s<17_p{t%6$F{(pVjBJ5@_yMAT|N& zRGxf_g?I8jE`fT-{|0B+dm68J-F0d0cJeC9eH`jDcj9x8FS)wEmeei0*mUBlwavMQ z`{exfm139W@*tY@ZO zVl(#*U62r#^w2WcPHN7|q$LX-KR@pYid@Rtcfv71NGD{|JL4ZVik*RrH(V->b&@=H zZo#@Mr=G8i;F@myTv}?*{tn*yv|F!vH@9(XGqHd?F?lPmBflTRgMCtGZ!*Tjy#dja z83iOK%klk!1e6TFuVI7U|6UoO0vK)A@aB?0%nil>Z$>7222k*FFrWnH$ZpGpGP< v0RaUdp2!7KXCS1>FShAE*y*u(nwLRN&k!fwgSa!%eaWXHCe7o-aSqi?lNWajHd@C7Q9s?PZcQe`wf*93ZbD0vD7#I$+Fff=;43L_9 zhF@W`GgBZFztXkFYujvc=kY5&o?ri;Ve>+kU#x<~QGTI~6Zmo#0uB5G#3mpudxSVA zpXZXTZ~AX=hP}t>g4bP_)@~=SBHP|@!&0|-$`|jOM+xk#X+LgxM??8@!=^V;+YIeZ zyUt{2X`lNYW1+%zr}9ztzT-FkST($P?U5!mNz!tL_o_sGm1-N_t(|Rmy9~Il)flp5 zA9V`u{&#++=hahE;votdtkbft`l=?yJ$Vse{c>IQ0!iI;^9wg5WIy+ExSojozGSE(yfkU<~kPWU^-fg(e3BO4v(8DP9et ziJ}Go%oqUxK>)r=loO8wG2#{zS>;&HD&n@yl=V2^A)yLr7IiqVg?it~No!yW@FN}L z-L&8lAdfrJZw*)Q=1^IHvflUWt==Rm&l8nv?4F(;+1i#AmCGu;smN71yD^P~%0{J; z#)Gh3TMN@_ncK6wiO^ex75FSNnR^%#%gb?O_NA<4)3C&^<^5mwxa?!sM_;<$9d1d; zf$icUUshS@Gr8q_I9OA8!u>P89d12s!ycO0K4-|Pvfvce?WoqeJ@`{gBHY<6LB?IL z2#XZv==AQ`3GLO(YWrD?6Y}jRy&~8yy9W(V({Zg!8y^^Of^$v zW;(F;x{$O&Eu^lmryP~9QTLf0UBsa$tSQ>D3si|YOUF72m3Hog-OeXhG}D(<20B5y zi(}@eZx>1SVdH+F-$-X)i&n%#q{e*399|ZAj_9?c9jA=4a0H@S1cG^|lkAyBgIOL> ztsqb=o(Ip~b&aw0YTU6wCNT7w*T;!TMTWDDeaQGJx$QJ~XKr9`|HjxPQV>zQp>3Tk ziy!c?#sYf~4C|obOG_=EsH)hc4qsl;#Xc2;tgkFcc6+8(&n#*;dmu=zo6iXfZQS>| zE%bZUrbW$gCnzF8wPk`oUQf6Y1A#M@Jf6_;VH0~G?H1k_6ClUMmotS*!RHV@XV3RK zmlX&QLNSJ_c9g56cbV^r?HNe!KJB#vW`A9~ZyKUbi=XlcH{Fs7bd7>%L<}%3Yp+Gj z9cL2`lx^-aFcKUvL&h{>SDx)>{ zpjP$`lUv_gWPS#DRa*JYs(fzDk-zvWAN4T!fah_<-qhLbz>;EvlEeek{_vN+O->Y2 zm@8#@@1{{0jFY%8Z>+H%KP0)aWM=xdDp9mvvY92?MaSC*A@u&T;IXxNz?sK#GG!AK zSyGP^;daO(B@`;kYuwhN=F`xOEdUwXeuQ~sVWn$Hog51bsVStLiLI_+$k&y?DRZ#d zQC;Dmh;igqJ(~7q>LcewXh$Hg$YhkSf+G}0yT@@?!t%0z+;BSQg36+}pnb#!L;Boj z={pl2?v8#E!mIR)IqZ8O8hV*%-FPBHR!4AU0wIM`Vw&6#WU}ZO{L|rhA$!S3>~dUIy9HF#`%&eKgi=$ zLKz5omPpaAoQWtOm~lF!fNR?5MTPROQ(wn+%6x&qHnHr`qYdVt+QqqAfK-TA zQ=Ey{>NJMcKRyXo`uUbMc;qmuvD1M*;CfA#SVzP)GHry1q1vbriY!#yYt|N@T@pq& z>gt+?gvsc41HVqeM!rJSMoB+s5(D;=aBaXEMld4_HFubvbqya!94(#i zIc+72E6(rZ3H*k*kbEj$ra2^I%phGH2dG%K8L}CzFrDS$T11a(C4x2k9enHG7wW3K zDBg)04Y56`a~=8X=zttjxA^)8FxA!K@n+FDL7Jr%l6f1u`K5e4iQ+a#zPhE;k6qyL zlyNDZhaP0aQEAbVYkd;pa#;#ac@`|M<{Tr@jq-`Is&q;VRFU!^-3C;T6hy!5Qv>1R zboH!U(p!0J_BWpMO~0HlX`GD87j#&Wrp1j<2x8Dx1fLWNiYEy0;KIC9?rvR5vvjGO zLiU(TXbE0GRr!~@vo_~MN6}fPGNY~QJtxrVn~aWJ@9tWde+$JYzf80Ii$yXc!!gil zCa)P|P&pv5ONZ)}`mRwg!|$MY5`hW%+~__rGlcr%tYOM$0{m(&|Ju4bw-Vp;R-v9b z(U>P}*NZgnG~& zDu-x0%bdqjB{_zUo*i=WSdvamyjVR? zD6l*0x`f=kf<(`fWcBQKRkjWF3yHuzjDZ10$b)h~-*pEzg=ph zB4VCR%DtQrt!s>m;Vbi2tRmnkJNYX8Qx13Q*uxZSBS3m3Bb#1O#Nx!p#vgkg?=(LW ztX#GfERm(+Fq~w6*Z8n7FUlZ28~&zU`dHo83pE2@-Nqpb#QDIbi#`zXO$=13khZ=a zBEYq@eUi88KS_Odf4lcWfQzx|JsSFVR|!3x%*%ie2T$kQ?x__mvP}?sU2x9^y~-{g z@$xilL-QAHcTQ?}N(*Wn!7NdJ*iFS)bjCB{@d|^E|NzzD6 zj9UF5c8M-}dE>I@ts2{ABijsj`xharoG_~6YhM9~2WT@ZUkZIJAbVG>GtCa!4riMn z?Ic_DyQJz=^%;~U1VHwM+KPLe;AJT7)<}U+NBTQG1De*Upq67inn{}?%l1%xhKn=e z{b(X?_$;-+fvPTpyQFy*9jz${n{s~r$Y2M%eVl`iSRy-#H9t!!q_Omh2fff4S=+rx z^jmNFqECJJbxmZj)#S$y0yu_DKG_T(;)+?x(YnH(8N|L)yp`%?yDcDB!<>1^-?6I+Jp6=Lg;)5-=^uu8DUDPk^!GEn$9)|EFW{<1j6zhaSW! z?sK3!gM8ILKvg&&h#CBkz@ftj!fine7ypwUz!85l3|>Zr8^p?SUgyEPh+JaIP|}J= zsF8qx;Ml~!2SM>KMFc?iIL{Hn_<0c%Q2xI|GAA?so~Q{BjVFjYfu#A)`%?JpVk-Z` zR$*dnpgjJ+R}#d;WS)?(XZ^lW**Ul8_fs07lra|jFXx}rT=*^17|xxA1^`$V{+;~` D%+!`f delta 2535 zcmZWrXHXM}5)OnS1Tgg8BtR&Eqe}PSPC83E2912J~iUAJk zMU+sbNdO51IBMue$MD3vnKy6V?#%9fJKz4;Ki_L$6yQ59_Ry5}5z}hV zhuDl+nswObbXe!u&K)XQ;)Hpq&UOBYt#L9zxW8e4@zqJ&6s-O6d1WQS_DlB55j!iP z3$Xynr0lLf%35o)XLxXc@IZKAgi%u2=oiAkRv@b{gJB9N3QCzE9Tp?rW89n`R}Dtt zH7VrD$neaZ7}!k)3i=AY`HP%CK}>zDolX7wk>Txg&5>^_KgJC>$Ry)ldpL?$BBRB* zw-EBM_i2{)DC?Fxun6c-UhQrGdMMDa=eQ3i#0KzNfWT;POt`jOk+I7|PiGf!eEyTrXm-ikG@jiHqh_sUDYl{~ z%|HlM*LBAs9LcXnsLOXVJ_8Qkp#o(!($-vjGc8aV3@#WXqS5hW7!HLxm2&<;d0gk5 z8HrarDCZuq!guzyhhb;UpS_KLOEBePrsHgs5Po92U?Z= zYS=idbVzx^cXoWvZY##jpweoNOKtMn?`zT+=k%{!By6%M#(MJW&j`NYn@#~oRX}y9 z<3J6=XiPJ}^RA?YYMVNq-)v*`IGD-t;qkdx60`hm4p1?YR1c|-3+n1Lk-#r%lM+t& z1_-*XcuwsJ5X7X2y`{d(p!Dw^5c>{f57m7_a=CdpK8( zl`6lmg{sKB^`1-l7-7^t5CEuT0RWUQWot}S7BdVK{`rG*897)}eAfVQ5SLvz8+=P!WpDt| z*`IwfFMR^q%4(<+(!iGP#(j=K{v8%vHu_$IM( zJ#}-1G^@R3NI04oL@6Lk=XegUax%t(n^5k8oVt>RXOkUeVH*3H<7lLiJDLO2VRQva zmlWKZ?8uj9_hz@_mR~>mlMc4e!7;fidYjrmh4fPW$_F-q>J~1adf7nx{9WYTcnVLk z_ho)FCK%7yxhFk&sX9iE_kXiJNo5P&>}u#$I7&1vSDulRT!eBLf`QdUEjv{vH_PrW zI@!MGxf7dC^|{DMputMdq3?(WqSLg& z;WJ{Gh$bvs$bMx=g2zDd4yscr>8K`=joT*hIsllY@)Y6K=8H(~vA^@443hm4!6F1) z-o#=lhNHwy?)ZA+DvacujbzKN2l1Y&mcmr@_Curc56y(08ULdLhH&_4^lU9-L}+h| zYZZNS`NCI?o}7Raj#TTB0!(YESJobqJHgY(c6oTC_opGfH~H}b`g_~5Ot_d0*h_~Z zDo9oC!=c1&0He;uduUKL;44?HuG6g z>GJB;o7lah8v-L-slbVy>+u<3+RRz-*coSrG?v|?Z^L_9DB6o!%#k;+UEz~C> zmXjWL1?C~2YwM*I)TtNC~j90OOKX7S~XaaKAb%S&H6uH2loYHz(S<`hZgS^{M!$jj-&`JD`UDf-=zn_MN2x; zGO_=IbbqK1PDx6D7R-COLQ3&4FN9slyo(~zSast(p?tVJDKQ#%oRTyIw;*LnlmC5s zO6wg!7fA^YcqO=%LCB&1k(cm^AeZnKab#_3jhEB diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index a8df2b4..6025b6a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1159,7 +1159,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400,500 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1834,7 +1834,7 @@ namespace TL file = file, }); - /// Sends a service message to a secret chat. See Possible codes: 400,403 (details) + /// Sends a service message to a secret chat. See Possible codes: 400,403,500 (details) /// Secret chat ID /// Unique client message ID required to prevent message resending You can use /// TL-serialization of type, encrypted with a key generated during chat initialization @@ -1846,7 +1846,7 @@ namespace TL data = data, }); - /// Confirms receipt of messages in a secret chat by client, cancels push notifications.
The method returns a list of random_ids of messages for which push notifications were cancelled. See Possible codes: 400 (details)
+ /// Confirms receipt of messages in a secret chat by client, cancels push notifications.
The method returns a list of random_ids of messages for which push notifications were cancelled. See Possible codes: 400,500 (details)
/// Maximum qts value available at the client public static Task Messages_ReceivedQueue(this Client client, int max_qts) => client.Invoke(new Messages_ReceivedQueue @@ -1919,7 +1919,7 @@ namespace TL title = title, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406,500 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2461,7 +2461,7 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403,500 (details) /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -2976,7 +2976,7 @@ namespace TL media_count = media_count, }); - /// Upload a media file associated with an imported chat, click here for more info ». See + /// Upload a media file associated with an imported chat, click here for more info ». See Possible codes: 400 (details) /// The Telegram chat where the media will be imported /// Identifier of a history import session, returned by Messages_InitHistoryImport /// File name @@ -3494,7 +3494,7 @@ namespace TL hash = hash, }); - /// Report a message reaction See + /// Report a message reaction See Possible codes: 400 (details) /// Peer where the message was sent /// Message ID /// Peer that sent the reaction @@ -3620,7 +3620,7 @@ namespace TL peer = peer, }); - /// Obtain information about a named bot web app See [bots: ✓] Possible codes: 400 (details) + /// Obtain information about a named bot web app See Possible codes: 400 (details) /// Bot app information obtained from a named bot web app deep link ». /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) @@ -3630,7 +3630,7 @@ namespace TL hash = hash, }); - /// Open a bot web app from a named bot web app deep link, sending over user information after user confirmation. See [bots: ✓] + /// Open a bot web app from a named bot web app deep link, sending over user information after user confirmation. See /// Set this flag if the bot is asking permission to send messages to the user as specified in the named bot web app deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. /// The app obtained by invoking Messages_GetBotApp as specified in the named bot web app deep link docs. @@ -3702,7 +3702,7 @@ namespace TL limit = limit, }); - /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400 (details) + /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400,500 (details) /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. /// Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user. /// Input photo @@ -4136,7 +4136,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,406 (details) + /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -4211,7 +4211,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406 (details) + /// Join a channel/supergroup See Possible codes: 400,406,500 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -4521,7 +4521,7 @@ namespace TL enabled = enabled, }); - /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400 (details) + /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) /// The forum /// Topic title (maximum UTF-8 length: 128) /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. @@ -4540,7 +4540,7 @@ namespace TL send_as = send_as, }); - /// Get topics of a forum See [bots: ✓] Possible codes: 400 (details) + /// Get topics of a forum See Possible codes: 400 (details) /// Supergroup /// Search query /// Offsets for pagination, for more info click here @@ -4559,7 +4559,7 @@ namespace TL limit = limit, }); - /// Get forum topics by their ID See [bots: ✓] + /// Get forum topics by their ID See [bots: ✓] Possible codes: 400 (details) /// Forum /// Topic IDs public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) @@ -4600,7 +4600,7 @@ namespace TL pinned = pinned, }); - /// Delete message history of a forum topic See [bots: ✓] + /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400 (details) /// Forum /// Topic ID public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) @@ -5156,7 +5156,7 @@ namespace TL /// If set, the user's video will be disabled by default upon joining. /// The group call /// Join the group call, presenting yourself as the specified user/channel - /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. + /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. /// WebRTC parameters public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall @@ -5208,7 +5208,7 @@ namespace TL join_muted = join_muted.GetValueOrDefault(), }); - /// Get info about a group call See Possible codes: 400 (details) + /// Get info about a group call See Possible codes: 400,403 (details) /// The group call /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit = int.MaxValue) @@ -5300,7 +5300,7 @@ namespace TL peer = peer, }); - /// Get an invite link for a group call or livestream See Possible codes: 403 (details) + /// Get an invite link for a group call or livestream See Possible codes: 403 (details) /// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). /// The group call public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false) @@ -5568,7 +5568,7 @@ namespace TL peers = peers, }); - /// Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »). See [bots: ✓] + /// Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »). See [bots: ✓] Possible codes: 400 (details) /// The folder public static Task Chatlists_GetChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetChatlistUpdates From 38efb0592354c9c360e3e811a28b042307302db0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 6 Sep 2023 18:29:50 +0200 Subject: [PATCH 110/336] API Layer 162: more stories & blocking stuff... --- README.md | 2 +- src/Client.Helpers.cs | 3 + src/TL.Schema.cs | 129 ++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 197 ++++++++++++++++++++++++++++++++----- src/TL.Table.cs | 23 +++-- src/WTelegramClient.csproj | 2 +- 6 files changed, 315 insertions(+), 41 deletions(-) diff --git a/README.md b/README.md index 38cb622..580eec0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-160-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-162-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://www.buymeacoffee.com/wizou) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c4e29c1..f8fb9d5 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -750,6 +750,9 @@ namespace WTelegram (ci.flags.HasFlag(ChatInvite.Flags.broadcast) ? Channel.Flags.broadcast : 0) | (ci.flags.HasFlag(ChatInvite.Flags.public_) ? Channel.Flags.has_username : 0) | (ci.flags.HasFlag(ChatInvite.Flags.megagroup) ? Channel.Flags.megagroup : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.verified) ? Channel.Flags.verified : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.scam) ? Channel.Flags.scam : 0) | + (ci.flags.HasFlag(ChatInvite.Flags.fake) ? Channel.Flags.fake : 0) | (ci.flags.HasFlag(ChatInvite.Flags.request_needed) ? Channel.Flags.join_request : 0) }; } return null; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index d848398..07f74ff 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2129,6 +2129,7 @@ namespace TL attach_menu = 0x2, /// Field has a value has_app = 0x4, + from_request = 0x8, } } /// Secure telegram passport values were received See @@ -3008,6 +3009,7 @@ namespace TL /// Field has a value has_stories = 0x2000000, stories_pinned_available = 0x4000000, + blocked_my_stories_from = 0x8000000, } } @@ -4207,13 +4209,19 @@ namespace TL public int read_max_id; } /// A peer was blocked See - [TLDef(0x246A4B22)] + [TLDef(0xEBE07752)] public class UpdatePeerBlocked : Update { + public Flags flags; /// The blocked peer public Peer peer_id; - /// Whether the peer was blocked or unblocked - public bool blocked; + + [Flags] public enum Flags : uint + { + /// Whether the peer was blocked or unblocked + blocked = 0x1, + blocked_my_stories_from = 0x2, + } } /// A user is typing in a supergroup, channel or message thread See [TLDef(0x8C88C923)] @@ -4637,6 +4645,20 @@ namespace TL public int id; public long random_id; } + /// See + [TLDef(0x2C084DC1)] + public class UpdateStoriesStealthMode : Update + { + public StoriesStealthMode stealth_mode; + } + /// See + [TLDef(0xE3A73D20)] + public class UpdateSentStoryReaction : Update + { + public long user_id; + public int story_id; + public Reaction reaction; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6456,6 +6478,9 @@ namespace TL has_about = 0x20, /// Whether the join request » must be first approved by an administrator request_needed = 0x40, + verified = 0x80, + scam = 0x100, + fake = 0x200, } } /// A chat invitation that also allows peeking into the group to read messages without joining it. See @@ -14986,16 +15011,18 @@ namespace TL } /// See - [TLDef(0xD36760CF)] + [TLDef(0xC64C0B97)] public class StoryViews : IObject { public Flags flags; public int views_count; + public int reactions_count; [IfFlag(0)] public long[] recent_viewers; [Flags] public enum Flags : uint { has_recent_viewers = 0x1, + has_viewers = 0x2, } } @@ -15029,7 +15056,7 @@ namespace TL public override int ID => id; } /// See - [TLDef(0x562AA637)] + [TLDef(0x44C457CE)] public class StoryItem : StoryItemBase { public Flags flags; @@ -15039,8 +15066,10 @@ namespace TL [IfFlag(0)] public string caption; [IfFlag(1)] public MessageEntity[] entities; public MessageMedia media; + [IfFlag(14)] public MediaArea[] media_areas; [IfFlag(2)] public PrivacyRule[] privacy; [IfFlag(3)] public StoryViews views; + [IfFlag(15)] public Reaction sent_reaction; [Flags] public enum Flags : uint { @@ -15056,6 +15085,8 @@ namespace TL edited = 0x800, contacts = 0x1000, selected_contacts = 0x2000, + has_media_areas = 0x4000, + has_sent_reaction = 0x8000, } public override int ID => id; @@ -15079,13 +15110,19 @@ namespace TL /// See public abstract class Stories_AllStoriesBase : IObject { } /// See - [TLDef(0x47E0A07E)] + [TLDef(0x1158FE3E)] public class Stories_AllStoriesNotModified : Stories_AllStoriesBase { + public Flags flags; public string state; + public StoriesStealthMode stealth_mode; + + [Flags] public enum Flags : uint + { + } } /// See - [TLDef(0x839E0428)] + [TLDef(0x519D899E)] public class Stories_AllStories : Stories_AllStoriesBase { public Flags flags; @@ -15093,6 +15130,7 @@ namespace TL public string state; public UserStories[] user_stories; public Dictionary users; + public StoriesStealthMode stealth_mode; [Flags] public enum Flags : uint { @@ -15118,20 +15156,37 @@ namespace TL } /// See - [TLDef(0xA71AACC2)] + [TLDef(0xB0BDEAC5)] public class StoryView : IObject { + public Flags flags; public long user_id; public DateTime date; + [IfFlag(2)] public Reaction reaction; + + [Flags] public enum Flags : uint + { + blocked = 0x1, + blocked_my_stories_from = 0x2, + has_reaction = 0x4, + } } /// See - [TLDef(0xFB3F77AC)] + [TLDef(0x46E9B9EC)] public class Stories_StoryViewsList : IObject { + public Flags flags; public int count; + public int reactions_count; public StoryView[] views; public Dictionary users; + [IfFlag(0)] public string next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } } /// See @@ -15171,4 +15226,60 @@ namespace TL { public string link; } + + /// See + [TLDef(0x712E27FD)] + public class StoriesStealthMode : IObject + { + public Flags flags; + [IfFlag(0)] public DateTime active_until_date; + [IfFlag(1)] public DateTime cooldown_until_date; + + [Flags] public enum Flags : uint + { + has_active_until_date = 0x1, + has_cooldown_until_date = 0x2, + } + } + + /// See + [TLDef(0x03D1EA4E)] + public class MediaAreaCoordinates : IObject + { + public double x; + public double y; + public double w; + public double h; + public double rotation; + } + + /// See + public abstract class MediaArea : IObject + { + public MediaAreaCoordinates coordinates; + } + /// See + [TLDef(0xBE82DB9C, inheritBefore = true)] + public class MediaAreaVenue : MediaArea + { + public GeoPoint geo; + public string title; + public string address; + public string provider; + public string venue_id; + public string venue_type; + } + /// See + [TLDef(0xB282217F, inheritBefore = true)] + public class InputMediaAreaVenue : MediaArea + { + public long query_id; + public string result_id; + } + /// See + [TLDef(0xDF8B3B22, inheritBefore = true)] + public class MediaAreaGeoPoint : MediaArea + { + public GeoPoint geo; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 6025b6a..90a1cbe 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -445,8 +445,8 @@ namespace TL }); /// Change privacy settings of current account See Possible codes: 400 (details) - /// Peers to which the privacy rules apply - /// New privacy rules + /// New privacy rule + /// Peers to which the privacy rule will apply. public static Task Account_SetPrivacy(this Client client, InputPrivacyKey key, params InputPrivacyRule[] rules) => client.Invoke(new Account_SetPrivacy { @@ -1233,26 +1233,29 @@ namespace TL /// Adds the user to the blacklist. See Possible codes: 400 (details) /// User ID - public static Task Contacts_Block(this Client client, InputPeer id) + public static Task Contacts_Block(this Client client, InputPeer id, bool my_stories_from = false) => client.Invoke(new Contacts_Block { + flags = (Contacts_Block.Flags)(my_stories_from ? 0x1 : 0), id = id, }); /// Deletes the user from the blacklist. See Possible codes: 400 (details) /// User ID - public static Task Contacts_Unblock(this Client client, InputPeer id) + public static Task Contacts_Unblock(this Client client, InputPeer id, bool my_stories_from = false) => client.Invoke(new Contacts_Unblock { + flags = (Contacts_Unblock.Flags)(my_stories_from ? 0x1 : 0), id = id, }); /// Returns the list of blocked users. See /// The number of list elements to be skipped /// The number of list elements to be returned - public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue) + public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue, bool my_stories_from = false) => client.Invoke(new Contacts_GetBlocked { + flags = (Contacts_GetBlocked.Flags)(my_stories_from ? 0x1 : 0), offset = offset, limit = limit, }); @@ -1412,6 +1415,15 @@ namespace TL hidden = hidden, }); + /// See + public static Task Contacts_SetBlocked(this Client client, InputPeer[] id, int limit = int.MaxValue, bool my_stories_from = false) + => client.Invoke(new Contacts_SetBlocked + { + flags = (Contacts_SetBlocked.Flags)(my_stories_from ? 0x1 : 0), + id = id, + limit = limit, + }); + /// This method is only for basic Chat. See Terminology 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) @@ -1424,7 +1436,7 @@ namespace TL /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here (top_message ID used for pagination) /// Offset peer for pagination /// Number of list elements to be returned /// Hash for pagination, for more info click here @@ -3776,7 +3788,7 @@ namespace TL /// Saves a part of file for further sending to one of the methods. See [bots: ✓] Possible codes: 400 (details) /// Random file identifier created by the client /// Numerical order of a part - /// Binary data, contend of a part + /// Binary data, content of a part public static Task Upload_SaveFilePart(this Client client, long file_id, int file_part, byte[] bytes) => client.Invoke(new Upload_SaveFilePart { @@ -4797,6 +4809,29 @@ namespace TL active = active, }); + /// See + public static Task Bots_CanSendMessage(this Client client, InputUserBase bot) + => client.Invoke(new Bots_CanSendMessage + { + bot = bot, + }); + + /// See + public static Task Bots_AllowSendMessage(this Client client, InputUserBase bot) + => client.Invoke(new Bots_AllowSendMessage + { + bot = bot, + }); + + /// See + public static Task Bots_InvokeWebViewCustomMethod(this Client client, InputUserBase bot, string custom_method, DataJSON params_) + => client.Invoke(new Bots_InvokeWebViewCustomMethod + { + bot = bot, + custom_method = custom_method, + params_ = params_, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -5612,12 +5647,19 @@ namespace TL peers = peers, }); + /// See + public static Task Stories_CanSendStory(this Client client) + => client.Invoke(new Stories_CanSendStory + { + }); + /// See - public static Task Stories_SendStory(this Client client, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, bool pinned = false, bool noforwards = false) + public static Task Stories_SendStory(this Client client, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) => client.Invoke(new Stories_SendStory { - flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0)), + flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0)), media = media, + media_areas = media_areas, caption = caption, entities = entities, privacy_rules = privacy_rules, @@ -5626,12 +5668,13 @@ namespace TL }); /// See - public static Task Stories_EditStory(this Client client, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null) + public static Task Stories_EditStory(this Client client, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory { - flags = (Stories_EditStory.Flags)((media != null ? 0x1 : 0) | (caption != null ? 0x2 : 0) | (entities != null ? 0x2 : 0) | (privacy_rules != null ? 0x4 : 0)), + flags = (Stories_EditStory.Flags)((media != null ? 0x1 : 0) | (caption != null ? 0x2 : 0) | (entities != null ? 0x2 : 0) | (privacy_rules != null ? 0x4 : 0) | (media_areas != null ? 0x8 : 0)), id = id, media = media, + media_areas = media_areas, caption = caption, entities = entities, privacy_rules = privacy_rules, @@ -5722,12 +5765,13 @@ namespace TL }); /// See - public static Task Stories_GetStoryViewsList(this Client client, int id, DateTime offset_date = default, long offset_id = default, int limit = int.MaxValue) + public static Task Stories_GetStoryViewsList(this Client client, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) => client.Invoke(new Stories_GetStoryViewsList { + flags = (Stories_GetStoryViewsList.Flags)((q != null ? 0x2 : 0) | (just_contacts ? 0x1 : 0) | (reactions_first ? 0x4 : 0)), + q = q, id = id, - offset_date = offset_date, - offset_id = offset_id, + offset = offset, limit = limit, }); @@ -5755,6 +5799,23 @@ namespace TL reason = reason, message = message, }); + + /// See + public static Task Stories_ActivateStealthMode(this Client client, bool past = false, bool future = false) + => client.Invoke(new Stories_ActivateStealthMode + { + flags = (Stories_ActivateStealthMode.Flags)((past ? 0x1 : 0) | (future ? 0x2 : 0)), + }); + + /// See + public static Task Stories_SendReaction(this Client client, InputUserBase user_id, int story_id, Reaction reaction, bool add_to_recent = false) + => client.Invoke(new Stories_SendReaction + { + flags = (Stories_SendReaction.Flags)(add_to_recent ? 0x1 : 0), + user_id = user_id, + story_id = story_id, + reaction = reaction, + }); } } @@ -6695,23 +6756,41 @@ namespace TL.Methods public string[] phones; } - [TLDef(0x68CC1411)] + [TLDef(0x2E2E8734)] public class Contacts_Block : IMethod { + public Flags flags; public InputPeer id; + + [Flags] public enum Flags : uint + { + my_stories_from = 0x1, + } } - [TLDef(0xBEA65D50)] + [TLDef(0xB550D328)] public class Contacts_Unblock : IMethod { + public Flags flags; public InputPeer id; + + [Flags] public enum Flags : uint + { + my_stories_from = 0x1, + } } - [TLDef(0xF57C350F)] + [TLDef(0x9A868F80)] public class Contacts_GetBlocked : IMethod { + public Flags flags; public int offset; public int limit; + + [Flags] public enum Flags : uint + { + my_stories_from = 0x1, + } } [TLDef(0x11F812D8)] @@ -6844,6 +6923,19 @@ namespace TL.Methods public bool hidden; } + [TLDef(0x94C65C76)] + public class Contacts_SetBlocked : IMethod + { + public Flags flags; + public InputPeer[] id; + public int limit; + + [Flags] public enum Flags : uint + { + my_stories_from = 0x1, + } + } + [TLDef(0x63C66506)] public class Messages_GetMessages : IMethod { @@ -9621,6 +9713,26 @@ namespace TL.Methods public bool active; } + [TLDef(0x1359F4E6)] + public class Bots_CanSendMessage : IMethod + { + public InputUserBase bot; + } + + [TLDef(0xF132E3EF)] + public class Bots_AllowSendMessage : IMethod + { + public InputUserBase bot; + } + + [TLDef(0x087FC5E7)] + public class Bots_InvokeWebViewCustomMethod : IMethod + { + public InputUserBase bot; + public string custom_method; + public DataJSON params_; + } + [TLDef(0x37148DBB)] public class Payments_GetPaymentForm : IMethod { @@ -10299,11 +10411,15 @@ namespace TL.Methods public InputPeer[] peers; } - [TLDef(0x424CD47A)] + [TLDef(0xB100D45D)] + public class Stories_CanSendStory : IMethod { } + + [TLDef(0xD455FCEC)] public class Stories_SendStory : IMethod { public Flags flags; public InputMedia media; + [IfFlag(5)] public MediaArea[] media_areas; [IfFlag(0)] public string caption; [IfFlag(1)] public MessageEntity[] entities; public InputPrivacyRule[] privacy_rules; @@ -10317,15 +10433,17 @@ namespace TL.Methods pinned = 0x4, has_period = 0x8, noforwards = 0x10, + has_media_areas = 0x20, } } - [TLDef(0x2AAE7A41)] + [TLDef(0xA9B91AE4)] public class Stories_EditStory : IMethod { public Flags flags; public int id; [IfFlag(0)] public InputMedia media; + [IfFlag(3)] public MediaArea[] media_areas; [IfFlag(1)] public string caption; [IfFlag(1)] public MessageEntity[] entities; [IfFlag(2)] public InputPrivacyRule[] privacy_rules; @@ -10335,6 +10453,7 @@ namespace TL.Methods has_media = 0x1, has_caption = 0x2, has_privacy_rules = 0x4, + has_media_areas = 0x8, } } @@ -10416,13 +10535,21 @@ namespace TL.Methods public int[] id; } - [TLDef(0x4B3B5E97)] + [TLDef(0xF95F61A4)] public class Stories_GetStoryViewsList : IMethod { + public Flags flags; + [IfFlag(1)] public string q; public int id; - public DateTime offset_date; - public long offset_id; + public string offset; public int limit; + + [Flags] public enum Flags : uint + { + just_contacts = 0x1, + has_q = 0x2, + reactions_first = 0x4, + } } [TLDef(0x9A75D6A6)] @@ -10446,4 +10573,30 @@ namespace TL.Methods public ReportReason reason; public string message; } + + [TLDef(0x57BBD166)] + public class Stories_ActivateStealthMode : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + past = 0x1, + future = 0x2, + } + } + + [TLDef(0x49AAA9B3)] + public class Stories_SendReaction : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int story_id; + public Reaction reaction; + + [Flags] public enum Flags : uint + { + add_to_recent = 0x1, + } + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 0ffcd41..eb65064 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 = 160; // fetched 21/07/2023 07:55:22 + public const int Version = 162; // fetched 06/09/2023 16:21:22 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -342,7 +342,7 @@ namespace TL [0xD29A27F4] = typeof(UpdateChannelMessageForwards), [0xD6B19546] = typeof(UpdateReadChannelDiscussionInbox), [0x695C9E7C] = typeof(UpdateReadChannelDiscussionOutbox), - [0x246A4B22] = typeof(UpdatePeerBlocked), + [0xEBE07752] = typeof(UpdatePeerBlocked), [0x8C88C923] = typeof(UpdateChannelUserTyping), [0xED85EAB5] = typeof(UpdatePinnedMessages), [0x5BB98608] = typeof(UpdatePinnedChannelMessages), @@ -377,6 +377,8 @@ namespace TL [0x205A4133] = typeof(UpdateStory), [0xFEB5345A] = typeof(UpdateReadStories), [0x1BF335B9] = typeof(UpdateStoryID), + [0x2C084DC1] = typeof(UpdateStoriesStealthMode), + [0xE3A73D20] = typeof(UpdateSentStoryReaction), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1103,21 +1105,26 @@ namespace TL [0x74CDA504] = typeof(MessagePeerVoteInputOption), [0x4628F6E6] = typeof(MessagePeerVoteMultiple), [0x3DB8EC63] = typeof(SponsoredWebPage), - [0xD36760CF] = typeof(StoryViews), + [0xC64C0B97] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), - [0x562AA637] = typeof(StoryItem), + [0x44C457CE] = typeof(StoryItem), [0x8611A200] = typeof(UserStories), - [0x47E0A07E] = typeof(Stories_AllStoriesNotModified), - [0x839E0428] = typeof(Stories_AllStories), + [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), + [0x519D899E] = typeof(Stories_AllStories), [0x4FE57DF1] = typeof(Stories_Stories), [0x37A6FF5F] = typeof(Stories_UserStories), - [0xA71AACC2] = typeof(StoryView), - [0xFB3F77AC] = typeof(Stories_StoryViewsList), + [0xB0BDEAC5] = typeof(StoryView), + [0x46E9B9EC] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), [0x9C5386E4] = typeof(InputReplyToMessage), [0x15B0F283] = typeof(InputReplyToStory), [0x3FC9053B] = typeof(ExportedStoryLink), + [0x712E27FD] = typeof(StoriesStealthMode), + [0x03D1EA4E] = typeof(MediaAreaCoordinates), + [0xBE82DB9C] = typeof(MediaAreaVenue), + [0xB282217F] = typeof(InputMediaAreaVenue), + [0xDF8B3B22] = typeof(MediaAreaGeoPoint), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 619e99b..4705f74 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: 160 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 162 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 8f90e880748e843d37b5aa0c14846788e00426f8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:21:48 +0200 Subject: [PATCH 111/336] API Layer 163: some minor bot & update stuff --- .github/dev.yml | 2 +- .github/release.yml | 2 +- EXAMPLES.md | 6 ++++-- README.md | 2 +- src/SecretChats.cs | 1 + src/TL.Schema.cs | 42 +++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 20 +++++++++++------- src/TL.Table.cs | 7 ++++--- src/WTelegramClient.csproj | 2 +- 9 files changed, 61 insertions(+), 23 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7e13821..de5e874 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ trigger: - master -name: 3.5.4-dev.$(Rev:r) +name: 3.5.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index b9e21be..a001ced 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,7 +8,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables['releaseNotes'], '"', '''''')] + releaseNotes2: $[replace($(releaseNotes), '"', '''''')] stages: - stage: publish diff --git a/EXAMPLES.md b/EXAMPLES.md index c0aa92c..2687469 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -199,7 +199,8 @@ You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). -You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. +You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. +See also [explanation below](#message-user) to extract user/chat info from messages. ## Downloading photos, medias, files @@ -270,6 +271,7 @@ InputPeer peer = chats.chats[1234567890]; // the chat we want DateTime when = DateTime.UtcNow.AddMinutes(3); await client.SendMessageAsync(peer, "This will be posted in 3 minutes", schedule_date: when); ``` +*Note: Make sure your computer clock is synchronized with Internet time* ## Fun with stickers, GIFs, dice, and animated emojies @@ -471,7 +473,7 @@ dialogs.CollectUsersChats(_users, _chats); private async Task OnUpdate(UpdatesBase updates) { - updates.CollectUsersChats(_users, _chats); + updates.CollectUsersChats(_users, _chats); ... } diff --git a/README.md b/README.md index 580eec0..5383898 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-162-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-163-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://www.buymeacoffee.com/wizou) diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 5df6b44..cc64f91 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -21,6 +21,7 @@ namespace WTelegram int RemoteLayer { get; } } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles")] public sealed class SecretChats : IDisposable { public event Action OnChanged; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 07f74ff..fa98dac 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2286,13 +2286,13 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Topic title. + /// New topic title. [IfFlag(0)] public string title; - /// ID of the custom emoji used as topic icon. + /// ID of the new custom emoji used as topic icon, or if it was removed. [IfFlag(1)] public long icon_emoji_id; - /// Whether the topic was closed. + /// Whether the topic was opened or closed. [IfFlag(2)] public bool closed; - /// Whether the topic was hidden (only valid for the "General" topic, id=1). + /// Whether the topic was hidden or unhidden (only valid for the "General" topic, id=1). [IfFlag(3)] public bool hidden; [Flags] public enum Flags : uint @@ -3406,6 +3406,21 @@ namespace TL /// Usernames. public Username[] usernames; } + /// See + [TLDef(0x8951ABEF)] + public class UpdateNewAuthorization : Update + { + public Flags flags; + public long hash; + [IfFlag(0)] public DateTime date; + [IfFlag(0)] public string device; + [IfFlag(0)] public string location; + + [Flags] public enum Flags : uint + { + unconfirmed = 0x1, + } + } /// New encrypted message. See [TLDef(0x12BCBD9A)] public class UpdateNewEncryptedMessage : Update @@ -3571,15 +3586,23 @@ namespace TL public int pts_count; } /// Contents of messages in the common message box were read See - [TLDef(0x68C13933)] + [TLDef(0xF8227181)] public class UpdateReadMessagesContents : Update { + public Flags flags; /// IDs of read messages public int[] messages; /// Event count after generation public int pts; /// Number of events that were generated public int pts_count; + [IfFlag(0)] public DateTime date; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_date = 0x1, + } } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] @@ -6258,6 +6281,7 @@ namespace TL encrypted_requests_disabled = 0x8, /// Whether this session will accept phone calls call_requests_disabled = 0x10, + unconfirmed = 0x20, } } @@ -13869,7 +13893,7 @@ namespace TL } /// Represents a bot web app that can be launched from the attachment menu » See - [TLDef(0xC8AA2CD2)] + [TLDef(0xD90D8DFE)] public class AttachMenuBot : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13879,7 +13903,7 @@ namespace TL /// Attachment menu item name public string short_name; /// List of dialog types where this attachment menu entry should be shown - public AttachMenuPeerType[] peer_types; + [IfFlag(3)] public AttachMenuPeerType[] peer_types; /// List of platform-specific static icons and animations to use for the attachment menu button public AttachMenuBotIcon[] icons; @@ -13891,6 +13915,9 @@ namespace TL has_settings = 0x2, /// Whether the bot would like to send messages to the user. request_write_access = 0x4, + show_in_attach_menu = 0x8, + show_in_side_menu = 0x10, + side_menu_disclaimer_needed = 0x20, } } @@ -14784,6 +14811,7 @@ namespace TL inactive = 0x1, /// The bot is asking permission to send messages to the user: if the user agrees, set the write_allowed flag when invoking Messages_RequestAppWebView. request_write_access = 0x2, + has_settings = 0x4, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 90a1cbe..7556273 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1010,10 +1010,10 @@ namespace TL /// Session ID from the , fetchable using Account_GetAuthorizations /// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed /// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed - public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default) + public static Task Account_ChangeAuthorizationSettings(this Client client, long hash, bool? encrypted_requests_disabled = default, bool? call_requests_disabled = default, bool confirmed = false) => client.Invoke(new Account_ChangeAuthorizationSettings { - flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0)), + flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0) | (confirmed ? 0x8 : 0)), hash = hash, encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), call_requests_disabled = call_requests_disabled.GetValueOrDefault(), @@ -3095,7 +3095,7 @@ namespace TL /// Invite link /// Search for a user in the pending join requests » list: only available when the requested flag is set, cannot be used together with a specific link. /// Offsets for pagination, for more info click here - /// User ID for pagination + /// User ID for pagination: if set, offset_date must also be set. /// Maximum number of results to return, see pagination public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false) => client.Invoke(new Messages_GetChatInviteImporters @@ -3423,12 +3423,13 @@ namespace TL /// Web app URL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string url, string platform, DataJSON theme_params = null, bool from_switch_webview = false) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false) => client.Invoke(new Messages_RequestSimpleWebView { - flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (from_switch_webview ? 0x2 : 0)), + flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0)), bot = bot, url = url, + start_param = start_param, theme_params = theme_params, platform = platform, }); @@ -6600,6 +6601,7 @@ namespace TL.Methods { has_encrypted_requests_disabled = 0x1, has_call_requests_disabled = 0x2, + confirmed = 0x8, } } @@ -8647,12 +8649,13 @@ namespace TL.Methods } } - [TLDef(0x299BEC8E)] + [TLDef(0x1A46500A)] public class Messages_RequestSimpleWebView : IMethod { public Flags flags; public InputUserBase bot; - public string url; + [IfFlag(3)] public string url; + [IfFlag(4)] public string start_param; [IfFlag(0)] public DataJSON theme_params; public string platform; @@ -8660,6 +8663,9 @@ namespace TL.Methods { has_theme_params = 0x1, from_switch_webview = 0x2, + from_side_menu = 0x4, + has_url = 0x8, + has_start_param = 0x10, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index eb65064..da062dc 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 = 162; // fetched 06/09/2023 16:21:22 + public const int Version = 163; // fetched 18/09/2023 17:16:36 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -271,6 +271,7 @@ namespace TL [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), [0xA7848924] = typeof(UpdateUserName), + [0x8951ABEF] = typeof(UpdateNewAuthorization), [0x12BCBD9A] = typeof(UpdateNewEncryptedMessage), [0x1710F156] = typeof(UpdateEncryptedChatTyping), [0xB4A2E88D] = typeof(UpdateEncryption), @@ -285,7 +286,7 @@ namespace TL [0x9C974FDF] = typeof(UpdateReadHistoryInbox), [0x2F2F21BF] = typeof(UpdateReadHistoryOutbox), [0x7F891213] = typeof(UpdateWebPage), - [0x68C13933] = typeof(UpdateReadMessagesContents), + [0xF8227181] = typeof(UpdateReadMessagesContents), [0x108D941F] = typeof(UpdateChannelTooLong), [0x635B4C09] = typeof(UpdateChannel), [0x62BA04D9] = typeof(UpdateNewChannelMessage), @@ -1011,7 +1012,7 @@ namespace TL [0x2DBF3432] = typeof(Phone_GroupCallStreamRtmpUrl), [0x4576F3F0] = typeof(AttachMenuBotIconColor), [0xB2A7386B] = typeof(AttachMenuBotIcon), - [0xC8AA2CD2] = typeof(AttachMenuBot), + [0xD90D8DFE] = typeof(AttachMenuBot), [0xF1D88A5C] = null,//AttachMenuBotsNotModified [0x3C4301C0] = typeof(AttachMenuBots), [0x93BF667F] = typeof(AttachMenuBotsBot), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 4705f74..7fb65db 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: 162 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 163 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From e7be5ac36fd9ae373ec75460598aa1203ec4a8e5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Sep 2023 19:34:08 +0200 Subject: [PATCH 112/336] release.yml --- .github/release.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/release.yml b/.github/release.yml index a001ced..471e24e 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,7 +8,6 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes2: $[replace($(releaseNotes), '"', '''''')] stages: - stage: publish @@ -26,13 +25,15 @@ stages: includePreviewVersions: true - task: DotNetCoreCLI@2 + env: + ReleaseNotes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(releaseNotes)"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$ReleaseNotes"' - task: NuGetCommand@2 inputs: From 392793b390c15ebf26133b530a86655873b10b77 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:16:21 +0200 Subject: [PATCH 113/336] API Layer 164: Stories in channel, boosts, more stories stuff... --- .github/dev.yml | 2 +- .github/release.yml | 4 +- README.md | 2 +- src/TL.Schema.cs | 211 ++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 273 ++++++++++++++++++++++++------------- src/TL.Table.cs | 38 +++--- src/WTelegramClient.csproj | 2 +- 7 files changed, 359 insertions(+), 173 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index de5e874..15667dc 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -2,7 +2,7 @@ trigger: - master -name: 3.5.5-dev.$(Rev:r) +name: 3.5.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 471e24e..9a1a012 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -25,15 +25,13 @@ stages: includePreviewVersions: true - task: DotNetCoreCLI@2 - env: - ReleaseNotes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$ReleaseNotes"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '"', '''''')]"' - task: NuGetCommand@2 inputs: diff --git a/README.md b/README.md index 5383898..8b3c7e2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-163-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-164-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index fa98dac..2007e87 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -456,10 +456,10 @@ namespace TL public string emoticon; } /// See - [TLDef(0x9A86B58F)] + [TLDef(0x89FDD778)] public class InputMediaStory : InputMedia { - public InputUserBase user_id; + public InputPeer peer; public int id; } @@ -971,7 +971,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x83259464)] + [TLDef(0x94F592DB)] public partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1002,6 +1002,7 @@ namespace TL [IfFlag(17)] public int participants_count; /// Additional usernames [IfFlag(32)] public Username[] usernames; + [IfFlag(36)] public int stories_max_id; [Flags] public enum Flags : uint { @@ -1063,6 +1064,11 @@ namespace TL { /// Field has a value has_usernames = 0x1, + stories_hidden = 0x2, + stories_hidden_min = 0x4, + stories_unavailable = 0x8, + /// Field has a value + has_stories_max_id = 0x10, } /// ID of the channel @@ -1238,7 +1244,7 @@ namespace TL public override ChatReactions AvailableReactions => available_reactions; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xF2355507)] + [TLDef(0x723027BD)] public partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1315,6 +1321,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » [IfFlag(30)] public ChatReactions available_reactions; + [IfFlag(36)] public PeerStories stories; [Flags] public enum Flags : uint { @@ -1392,6 +1399,9 @@ namespace TL participants_hidden = 0x4, /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x8, + /// Field has a value + has_stories = 0x10, + stories_pinned_available = 0x20, } /// ID of the channel @@ -1920,11 +1930,11 @@ namespace TL public string emoticon; } /// See - [TLDef(0xCBB20D88)] + [TLDef(0x68CB6283)] public class MessageMediaStory : MessageMedia { public Flags flags; - public long user_id; + public Peer peer; public int id; [IfFlag(0)] public StoryItemBase story; @@ -2917,7 +2927,7 @@ namespace TL } /// Extended user info See - [TLDef(0x4FE1CC86)] + [TLDef(0xB9B12C6C)] public class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2958,7 +2968,7 @@ namespace TL [IfFlag(19)] public PremiumGiftOption[] premium_gifts; /// Wallpaper to use in the private chat with the user. [IfFlag(24)] public WallPaperBase wallpaper; - [IfFlag(25)] public UserStories stories; + [IfFlag(25)] public PeerStories stories; [Flags] public enum Flags : uint { @@ -4648,17 +4658,17 @@ namespace TL public long user_id; } /// See - [TLDef(0x205A4133)] + [TLDef(0x75B3B798)] public class UpdateStory : Update { - public long user_id; + public Peer peer; public StoryItemBase story; } /// See - [TLDef(0xFEB5345A)] + [TLDef(0xF74E932B)] public class UpdateReadStories : Update { - public long user_id; + public Peer peer; public int max_id; } /// See @@ -4675,10 +4685,10 @@ namespace TL public StoriesStealthMode stealth_mode; } /// See - [TLDef(0xE3A73D20)] + [TLDef(0x7D627683)] public class UpdateSentStoryReaction : Update { - public long user_id; + public Peer peer; public int story_id; public Reaction reaction; } @@ -9100,7 +9110,7 @@ namespace TL } /// Invoice See - [TLDef(0x3E85A91B)] + [TLDef(0x5DB95A15)] public class Invoice : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9113,8 +9123,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; - /// Terms of service URL for the recurring payment - [IfFlag(9)] public string recurring_terms_url; + [IfFlag(10)] public string terms_url; [Flags] public enum Flags : uint { @@ -9138,6 +9147,8 @@ namespace TL has_max_tip_amount = 0x100, /// Whether this is a recurring payment recurring = 0x200, + /// Field has a value + has_terms_url = 0x400, } } @@ -11693,6 +11704,9 @@ namespace TL other = 0x1000, /// If set, allows the admin to create, delete or modify forum topics ». manage_topics = 0x2000, + post_stories = 0x4000, + edit_stories = 0x8000, + delete_stories = 0x10000, } } @@ -12318,11 +12332,11 @@ namespace TL } } /// See - [TLDef(0x939A4671)] + [TLDef(0x2E94C3E7)] public class WebPageAttributeStory : WebPageAttribute { public Flags flags; - public long user_id; + public Peer peer; public int id; [IfFlag(0)] public StoryItemBase story; @@ -15039,18 +15053,23 @@ namespace TL } /// See - [TLDef(0xC64C0B97)] + [TLDef(0x8D595CD6)] public class StoryViews : IObject { public Flags flags; public int views_count; - public int reactions_count; + [IfFlag(2)] public int forwards_count; + [IfFlag(3)] public ReactionCount[] reactions; + [IfFlag(4)] public int reactions_count; [IfFlag(0)] public long[] recent_viewers; [Flags] public enum Flags : uint { has_recent_viewers = 0x1, has_viewers = 0x2, + has_forwards_count = 0x4, + has_reactions = 0x8, + has_reactions_count = 0x10, } } @@ -15115,26 +15134,12 @@ namespace TL selected_contacts = 0x2000, has_media_areas = 0x4000, has_sent_reaction = 0x8000, + out_ = 0x10000, } public override int ID => id; } - /// See - [TLDef(0x8611A200)] - public class UserStories : IObject - { - public Flags flags; - public long user_id; - [IfFlag(0)] public int max_read_id; - public StoryItemBase[] stories; - - [Flags] public enum Flags : uint - { - has_max_read_id = 0x1, - } - } - /// See public abstract class Stories_AllStoriesBase : IObject { } /// See @@ -15150,13 +15155,14 @@ namespace TL } } /// See - [TLDef(0x519D899E)] - public class Stories_AllStories : Stories_AllStoriesBase + [TLDef(0x6EFC5E81)] + public class Stories_AllStories : Stories_AllStoriesBase, IPeerResolver { public Flags flags; public int count; public string state; - public UserStories[] user_stories; + public PeerStories[] peer_stories; + public Dictionary chats; public Dictionary users; public StoriesStealthMode stealth_mode; @@ -15164,23 +15170,20 @@ namespace TL { has_more = 0x1, } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0x4FE57DF1)] - public class Stories_Stories : IObject + [TLDef(0x5DD8C3C8)] + public class Stories_Stories : IObject, IPeerResolver { public int count; public StoryItemBase[] stories; + public Dictionary chats; public Dictionary users; - } - - /// See - [TLDef(0x37A6FF5F)] - public class Stories_UserStories : IObject - { - public UserStories stories; - public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See @@ -15282,14 +15285,12 @@ namespace TL } /// See - public abstract class MediaArea : IObject - { - public MediaAreaCoordinates coordinates; - } + public abstract class MediaArea : IObject { } /// See - [TLDef(0xBE82DB9C, inheritBefore = true)] + [TLDef(0xBE82DB9C)] public class MediaAreaVenue : MediaArea { + public MediaAreaCoordinates coordinates; public GeoPoint geo; public string title; public string address; @@ -15298,16 +15299,114 @@ namespace TL public string venue_type; } /// See - [TLDef(0xB282217F, inheritBefore = true)] + [TLDef(0xB282217F)] public class InputMediaAreaVenue : MediaArea { + public MediaAreaCoordinates coordinates; public long query_id; public string result_id; } /// See - [TLDef(0xDF8B3B22, inheritBefore = true)] + [TLDef(0xDF8B3B22)] public class MediaAreaGeoPoint : MediaArea { + public MediaAreaCoordinates coordinates; public GeoPoint geo; } + /// See + [TLDef(0x14455871)] + public class MediaAreaSuggestedReaction : MediaArea + { + public Flags flags; + public MediaAreaCoordinates coordinates; + public Reaction reaction; + + [Flags] public enum Flags : uint + { + dark = 0x1, + flipped = 0x2, + } + } + + /// See + [TLDef(0x9A35E999)] + public class PeerStories : IObject + { + public Flags flags; + public Peer peer; + [IfFlag(0)] public int max_read_id; + public StoryItemBase[] stories; + + [Flags] public enum Flags : uint + { + has_max_read_id = 0x1, + } + } + + /// See + [TLDef(0xCAE68768)] + public class Stories_PeerStories : IObject, IPeerResolver + { + public PeerStories stories; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x66EA1FEF)] + public class Stories_BoostsStatus : IObject + { + public Flags flags; + public int level; + public int current_level_boosts; + public int boosts; + [IfFlag(0)] public int next_level_boosts; + [IfFlag(1)] public StatsPercentValue premium_audience; + + [Flags] public enum Flags : uint + { + has_next_level_boosts = 0x1, + has_premium_audience = 0x2, + my_boost = 0x4, + } + } + + /// See + public abstract class Stories_CanApplyBoostResult : IObject { } + /// See + [TLDef(0xC3173587)] + public class Stories_CanApplyBoostOk : Stories_CanApplyBoostResult { } + /// See + [TLDef(0x712C4655)] + public class Stories_CanApplyBoostReplace : Stories_CanApplyBoostResult + { + public Peer current_boost; + public Dictionary chats; + } + + /// See + [TLDef(0x0E9E6380)] + public class Booster : IObject + { + public long user_id; + public DateTime expires; + } + + /// See + [TLDef(0xF3DD3D1D)] + public class Stories_BoostersList : IObject + { + public Flags flags; + public int count; + public Booster[] boosters; + [IfFlag(0)] public string next_offset; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7556273..9a34753 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1177,13 +1177,6 @@ namespace TL errors = errors, }); - /// See - public static Task Users_GetStoriesMaxIDs(this Client client, params InputUserBase[] id) - => client.Invoke(new Users_GetStoriesMaxIDs - { - id = id, - }); - /// Get contact by telegram IDs See /// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -1407,14 +1400,6 @@ namespace TL id = id, }); - /// See - public static Task Contacts_ToggleStoriesHidden(this Client client, InputUserBase id, bool hidden) - => client.Invoke(new Contacts_ToggleStoriesHidden - { - id = id, - hidden = hidden, - }); - /// See public static Task Contacts_SetBlocked(this Client client, InputPeer[] id, int limit = int.MaxValue, bool my_stories_from = false) => client.Invoke(new Contacts_SetBlocked @@ -5649,16 +5634,18 @@ namespace TL }); /// See - public static Task Stories_CanSendStory(this Client client) + public static Task Stories_CanSendStory(this Client client, InputPeer peer) => client.Invoke(new Stories_CanSendStory { + peer = peer, }); /// See - public static Task Stories_SendStory(this Client client, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) + public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) => client.Invoke(new Stories_SendStory { flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0)), + peer = peer, media = media, media_areas = media_areas, caption = caption, @@ -5669,10 +5656,11 @@ namespace TL }); /// See - public static Task Stories_EditStory(this Client client, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) + public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory { flags = (Stories_EditStory.Flags)((media != null ? 0x1 : 0) | (caption != null ? 0x2 : 0) | (entities != null ? 0x2 : 0) | (privacy_rules != null ? 0x4 : 0) | (media_areas != null ? 0x8 : 0)), + peer = peer, id = id, media = media, media_areas = media_areas, @@ -5682,16 +5670,18 @@ namespace TL }); /// See - public static Task Stories_DeleteStories(this Client client, params int[] id) + public static Task Stories_DeleteStories(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_DeleteStories { + peer = peer, id = id, }); /// See - public static Task Stories_TogglePinned(this Client client, int[] id, bool pinned) + public static Task Stories_TogglePinned(this Client client, InputPeer peer, int[] id, bool pinned) => client.Invoke(new Stories_TogglePinned { + peer = peer, id = id, pinned = pinned, }); @@ -5704,35 +5694,29 @@ namespace TL state = state, }); - /// See - public static Task Stories_GetUserStories(this Client client, InputUserBase user_id) - => client.Invoke(new Stories_GetUserStories - { - user_id = user_id, - }); - /// See - public static Task Stories_GetPinnedStories(this Client client, InputUserBase user_id, int offset_id = default, int limit = int.MaxValue) + public static Task Stories_GetPinnedStories(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetPinnedStories { - user_id = user_id, + peer = peer, offset_id = offset_id, limit = limit, }); /// See - public static Task Stories_GetStoriesArchive(this Client client, int offset_id = default, int limit = int.MaxValue) + public static Task Stories_GetStoriesArchive(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetStoriesArchive { + peer = peer, offset_id = offset_id, limit = limit, }); /// See - public static Task Stories_GetStoriesByID(this Client client, InputUserBase user_id, params int[] id) + public static Task Stories_GetStoriesByID(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesByID { - user_id = user_id, + peer = peer, id = id, }); @@ -5743,33 +5727,28 @@ namespace TL hidden = hidden, }); - /// See - public static Task Stories_GetAllReadUserStories(this Client client) - => client.Invoke(new Stories_GetAllReadUserStories - { - }); - /// See - public static Task Stories_ReadStories(this Client client, InputUserBase user_id, int max_id = default) + public static Task Stories_ReadStories(this Client client, InputPeer peer, int max_id = default) => client.Invoke(new Stories_ReadStories { - user_id = user_id, + peer = peer, max_id = max_id, }); /// See - public static Task Stories_IncrementStoryViews(this Client client, InputUserBase user_id, params int[] id) + public static Task Stories_IncrementStoryViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_IncrementStoryViews { - user_id = user_id, + peer = peer, id = id, }); /// See - public static Task Stories_GetStoryViewsList(this Client client, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) + public static Task Stories_GetStoryViewsList(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) => client.Invoke(new Stories_GetStoryViewsList { flags = (Stories_GetStoryViewsList.Flags)((q != null ? 0x2 : 0) | (just_contacts ? 0x1 : 0) | (reactions_first ? 0x4 : 0)), + peer = peer, q = q, id = id, offset = offset, @@ -5777,25 +5756,26 @@ namespace TL }); /// See - public static Task Stories_GetStoriesViews(this Client client, params int[] id) + public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesViews { + peer = peer, id = id, }); /// See - public static Task Stories_ExportStoryLink(this Client client, InputUserBase user_id, int id) + public static Task Stories_ExportStoryLink(this Client client, InputPeer peer, int id) => client.Invoke(new Stories_ExportStoryLink { - user_id = user_id, + peer = peer, id = id, }); /// See - public static Task Stories_Report(this Client client, InputUserBase user_id, int[] id, ReportReason reason, string message) + public static Task Stories_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) => client.Invoke(new Stories_Report { - user_id = user_id, + peer = peer, id = id, reason = reason, message = message, @@ -5809,14 +5789,78 @@ namespace TL }); /// See - public static Task Stories_SendReaction(this Client client, InputUserBase user_id, int story_id, Reaction reaction, bool add_to_recent = false) + public static Task Stories_SendReaction(this Client client, InputPeer peer, int story_id, Reaction reaction, bool add_to_recent = false) => client.Invoke(new Stories_SendReaction { flags = (Stories_SendReaction.Flags)(add_to_recent ? 0x1 : 0), - user_id = user_id, + peer = peer, story_id = story_id, reaction = reaction, }); + + /// See + public static Task Stories_GetPeerStories(this Client client, InputPeer peer) + => client.Invoke(new Stories_GetPeerStories + { + peer = peer, + }); + + /// See + public static Task Stories_GetAllReadPeerStories(this Client client) + => client.Invoke(new Stories_GetAllReadPeerStories + { + }); + + /// See + public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) + => client.Invoke(new Stories_GetPeerMaxIDs + { + id = id, + }); + + /// See + public static Task Stories_GetChatsToSend(this Client client) + => client.Invoke(new Stories_GetChatsToSend + { + }); + + /// See + public static Task Stories_TogglePeerStoriesHidden(this Client client, InputPeer peer, bool hidden) + => client.Invoke(new Stories_TogglePeerStoriesHidden + { + peer = peer, + hidden = hidden, + }); + + /// See + public static Task Stories_GetBoostsStatus(this Client client, InputPeer peer) + => client.Invoke(new Stories_GetBoostsStatus + { + peer = peer, + }); + + /// See + public static Task Stories_GetBoostersList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue) + => client.Invoke(new Stories_GetBoostersList + { + peer = peer, + offset = offset, + limit = limit, + }); + + /// See + public static Task Stories_CanApplyBoost(this Client client, InputPeer peer) + => client.Invoke(new Stories_CanApplyBoost + { + peer = peer, + }); + + /// See + public static Task Stories_ApplyBoost(this Client client, InputPeer peer) + => client.Invoke(new Stories_ApplyBoost + { + peer = peer, + }); } } @@ -6719,12 +6763,6 @@ namespace TL.Methods public SecureValueErrorBase[] errors; } - [TLDef(0xCA1CB9AB)] - public class Users_GetStoriesMaxIDs : IMethod - { - public InputUserBase[] id; - } - [TLDef(0x7ADC669D)] public class Contacts_GetContactIDs : IMethod { @@ -6918,13 +6956,6 @@ namespace TL.Methods public long[] id; } - [TLDef(0x753FB865)] - public class Contacts_ToggleStoriesHidden : IMethod - { - public InputUserBase id; - public bool hidden; - } - [TLDef(0x94C65C76)] public class Contacts_SetBlocked : IMethod { @@ -10417,13 +10448,17 @@ namespace TL.Methods public InputPeer[] peers; } - [TLDef(0xB100D45D)] - public class Stories_CanSendStory : IMethod { } + [TLDef(0xC7DFDFDD)] + public class Stories_CanSendStory : IMethod + { + public InputPeer peer; + } - [TLDef(0xD455FCEC)] + [TLDef(0xBCB73644)] public class Stories_SendStory : IMethod { public Flags flags; + public InputPeer peer; public InputMedia media; [IfFlag(5)] public MediaArea[] media_areas; [IfFlag(0)] public string caption; @@ -10443,10 +10478,11 @@ namespace TL.Methods } } - [TLDef(0xA9B91AE4)] + [TLDef(0xB583BA46)] public class Stories_EditStory : IMethod { public Flags flags; + public InputPeer peer; public int id; [IfFlag(0)] public InputMedia media; [IfFlag(3)] public MediaArea[] media_areas; @@ -10463,15 +10499,17 @@ namespace TL.Methods } } - [TLDef(0xB5D501D7)] + [TLDef(0xAE59DB5F)] public class Stories_DeleteStories : IMethod { + public InputPeer peer; public int[] id; } - [TLDef(0x51602944)] + [TLDef(0x9A75A1EF)] public class Stories_TogglePinned : IMethod { + public InputPeer peer; public int[] id; public bool pinned; } @@ -10490,31 +10528,26 @@ namespace TL.Methods } } - [TLDef(0x96D528E0)] - public class Stories_GetUserStories : IMethod - { - public InputUserBase user_id; - } - - [TLDef(0x0B471137)] + [TLDef(0x5821A5DC)] public class Stories_GetPinnedStories : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int offset_id; public int limit; } - [TLDef(0x1F5BC5D2)] + [TLDef(0xB4352016)] public class Stories_GetStoriesArchive : IMethod { + public InputPeer peer; public int offset_id; public int limit; } - [TLDef(0x6A15CF46)] + [TLDef(0x5774CA74)] public class Stories_GetStoriesByID : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int[] id; } @@ -10524,27 +10557,25 @@ namespace TL.Methods public bool hidden; } - [TLDef(0x729C562C)] - public class Stories_GetAllReadUserStories : IMethod { } - - [TLDef(0xEDC5105B)] + [TLDef(0xA556DAC8)] public class Stories_ReadStories : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int max_id; } - [TLDef(0x22126127)] + [TLDef(0xB2028AFB)] public class Stories_IncrementStoryViews : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int[] id; } - [TLDef(0xF95F61A4)] + [TLDef(0x7ED23C57)] public class Stories_GetStoryViewsList : IMethod { public Flags flags; + public InputPeer peer; [IfFlag(1)] public string q; public int id; public string offset; @@ -10558,23 +10589,24 @@ namespace TL.Methods } } - [TLDef(0x9A75D6A6)] + [TLDef(0x28E16CC8)] public class Stories_GetStoriesViews : IMethod { + public InputPeer peer; public int[] id; } - [TLDef(0x16E443CE)] + [TLDef(0x7B8DEF20)] public class Stories_ExportStoryLink : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int id; } - [TLDef(0xC95BE06A)] + [TLDef(0x1923FA8C)] public class Stories_Report : IMethod { - public InputUserBase user_id; + public InputPeer peer; public int[] id; public ReportReason reason; public string message; @@ -10592,11 +10624,11 @@ namespace TL.Methods } } - [TLDef(0x49AAA9B3)] + [TLDef(0x7FD736B2)] public class Stories_SendReaction : IMethod { public Flags flags; - public InputUserBase user_id; + public InputPeer peer; public int story_id; public Reaction reaction; @@ -10605,4 +10637,55 @@ namespace TL.Methods add_to_recent = 0x1, } } + + [TLDef(0x2C4ADA50)] + public class Stories_GetPeerStories : IMethod + { + public InputPeer peer; + } + + [TLDef(0x9B5AE7F9)] + public class Stories_GetAllReadPeerStories : IMethod { } + + [TLDef(0x535983C3)] + public class Stories_GetPeerMaxIDs : IMethod + { + public InputPeer[] id; + } + + [TLDef(0xA56A8B60)] + public class Stories_GetChatsToSend : IMethod { } + + [TLDef(0xBD0415C4)] + public class Stories_TogglePeerStoriesHidden : IMethod + { + public InputPeer peer; + public bool hidden; + } + + [TLDef(0x4C449472)] + public class Stories_GetBoostsStatus : IMethod + { + public InputPeer peer; + } + + [TLDef(0x337EF980)] + public class Stories_GetBoostersList : IMethod + { + public InputPeer peer; + public string offset; + public int limit; + } + + [TLDef(0xDB05C1BD)] + public class Stories_CanApplyBoost : IMethod + { + public InputPeer peer; + } + + [TLDef(0xF29D7C2B)] + public class Stories_ApplyBoost : IMethod + { + public InputPeer peer; + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index da062dc..3acd017 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 = 163; // fetched 18/09/2023 17:16:36 + public const int Version = 164; // fetched 22/09/2023 19:03:28 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -98,7 +98,7 @@ namespace TL [0x971FA843] = typeof(InputMediaGeoLive), [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), - [0x9A86B58F] = typeof(InputMediaStory), + [0x89FDD778] = typeof(InputMediaStory), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -132,10 +132,10 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x83259464] = typeof(Channel), + [0x94F592DB] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), - [0xF2355507] = typeof(ChannelFull), + [0x723027BD] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -159,7 +159,7 @@ namespace TL [0xB940C666] = typeof(MessageMediaGeoLive), [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), - [0xCBB20D88] = typeof(MessageMediaStory), + [0x68CB6283] = typeof(MessageMediaStory), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -226,7 +226,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x4FE1CC86] = typeof(UserFull), + [0xB9B12C6C] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -375,11 +375,11 @@ namespace TL [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), [0xCCF08AD6] = typeof(UpdateGroupInvitePrivacyForbidden), - [0x205A4133] = typeof(UpdateStory), - [0xFEB5345A] = typeof(UpdateReadStories), + [0x75B3B798] = typeof(UpdateStory), + [0xF74E932B] = typeof(UpdateReadStories), [0x1BF335B9] = typeof(UpdateStoryID), [0x2C084DC1] = typeof(UpdateStoriesStealthMode), - [0xE3A73D20] = typeof(UpdateSentStoryReaction), + [0x7D627683] = typeof(UpdateSentStoryReaction), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -697,7 +697,7 @@ namespace TL [0xA44F3EF6] = typeof(PageBlockMap), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), - [0x3E85A91B] = typeof(Invoice), + [0x5DB95A15] = typeof(Invoice), [0xEA02C27E] = typeof(PaymentCharge), [0x1E8CAAEB] = typeof(PostAddress), [0x909C3F94] = typeof(PaymentRequestedInfo), @@ -919,7 +919,7 @@ namespace TL [0x8FDE504F] = typeof(InputThemeSettings), [0xFA58B6D4] = typeof(ThemeSettings), [0x54B56617] = typeof(WebPageAttributeTheme), - [0x939A4671] = typeof(WebPageAttributeStory), + [0x2E94C3E7] = typeof(WebPageAttributeStory), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1106,15 +1106,13 @@ namespace TL [0x74CDA504] = typeof(MessagePeerVoteInputOption), [0x4628F6E6] = typeof(MessagePeerVoteMultiple), [0x3DB8EC63] = typeof(SponsoredWebPage), - [0xC64C0B97] = typeof(StoryViews), + [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), [0x44C457CE] = typeof(StoryItem), - [0x8611A200] = typeof(UserStories), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), - [0x519D899E] = typeof(Stories_AllStories), - [0x4FE57DF1] = typeof(Stories_Stories), - [0x37A6FF5F] = typeof(Stories_UserStories), + [0x6EFC5E81] = typeof(Stories_AllStories), + [0x5DD8C3C8] = typeof(Stories_Stories), [0xB0BDEAC5] = typeof(StoryView), [0x46E9B9EC] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), @@ -1126,6 +1124,14 @@ namespace TL [0xBE82DB9C] = typeof(MediaAreaVenue), [0xB282217F] = typeof(InputMediaAreaVenue), [0xDF8B3B22] = typeof(MediaAreaGeoPoint), + [0x14455871] = typeof(MediaAreaSuggestedReaction), + [0x9A35E999] = typeof(PeerStories), + [0xCAE68768] = typeof(Stories_PeerStories), + [0x66EA1FEF] = typeof(Stories_BoostsStatus), + [0xC3173587] = typeof(Stories_CanApplyBoostOk), + [0x712C4655] = typeof(Stories_CanApplyBoostReplace), + [0x0E9E6380] = typeof(Booster), + [0xF3DD3D1D] = typeof(Stories_BoostersList), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 7fb65db..21b9a32 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: 163 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 164 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From c60e4f9be0f26001fd02dbb51518e2ed84ff97d7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:27:14 +0200 Subject: [PATCH 114/336] yaml --- .github/dev.yml | 24 +++++++++++++----------- .github/release.yml | 4 +++- 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 15667dc..603e361 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,6 +1,6 @@ pr: none -trigger: -- master +trigger: none +#- master name: 3.5.6-dev.$(Rev:r) @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] +# releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: - task: UseDotNet@2 @@ -20,18 +20,20 @@ steps: includePreviewVersions: true - task: DotNetCoreCLI@2 + variables: + Release_Notes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(releaseNotes)"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(Release_Notes)"' -- task: NuGetCommand@2 - inputs: - command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' - publishPackageMetadata: true - nuGetFeedType: 'external' - publishFeedCredentials: 'nuget.org' +# - task: NuGetCommand@2 +# inputs: +# command: 'push' +# packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' +# publishPackageMetadata: true +# nuGetFeedType: 'external' +# publishFeedCredentials: 'nuget.org' diff --git a/.github/release.yml b/.github/release.yml index 9a1a012..4ad1c8b 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -25,13 +25,15 @@ stages: includePreviewVersions: true - task: DotNetCoreCLI@2 + variables: + Release_Notes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '"', '''''')]"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(Release_Notes)"' - task: NuGetCommand@2 inputs: From e4ed02c9a772de142896daf14e8b54d9756c9248 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:31:59 +0200 Subject: [PATCH 115/336] yaml --- .github/dev.yml | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 603e361..73f8ee7 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -20,15 +20,13 @@ steps: includePreviewVersions: true - task: DotNetCoreCLI@2 - variables: - Release_Notes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(Release_Notes)"' + buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), ''"'', '''''')]"' # - task: NuGetCommand@2 # inputs: From 028afa446503aa504fe30519678372634a75b2b9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:36:47 +0200 Subject: [PATCH 116/336] yaml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 73f8ee7..a4f0b5a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -26,7 +26,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), ''"'', '''''')]"' + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$[replace($(releaseNotes), '"', '''''')] # - task: NuGetCommand@2 # inputs: From d16fa21258749bf742590f9222e16cc8ce25ed2e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:40:46 +0200 Subject: [PATCH 117/336] yaml --- .github/dev.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index a4f0b5a..120b11c 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -10,6 +10,7 @@ pool: variables: buildConfiguration: 'Release' # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] + RN1: $[replace($(releaseNotes), '"', '''''')] steps: - task: UseDotNet@2 @@ -20,13 +21,15 @@ steps: includePreviewVersions: true - task: DotNetCoreCLI@2 + env: + RN2: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$[replace($(releaseNotes), '"', '''''')] + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '\"', '''''')]";AB="$(RN1)";CD="$(RN2)" # - task: NuGetCommand@2 # inputs: From 07c9118ccd3f27730bf4279a1a6fd2a259519798 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:44:53 +0200 Subject: [PATCH 118/336] yaml --- .github/dev.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 120b11c..d43a275 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -10,7 +10,6 @@ pool: variables: buildConfiguration: 'Release' # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] - RN1: $[replace($(releaseNotes), '"', '''''')] steps: - task: UseDotNet@2 @@ -29,7 +28,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '\"', '''''')]";AB="$(RN1)";CD="$(RN2)" + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '\"', '''''')]";CD="$(RN2)" # - task: NuGetCommand@2 # inputs: From fe26ee1b24213a48d3a26e4485251e669a09dc33 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:51:02 +0200 Subject: [PATCH 119/336] yaml --- .github/dev.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index d43a275..4eacb30 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,6 +9,7 @@ pool: variables: buildConfiguration: 'Release' + RN1: $[replace($env:releaseNotes, '"', '''''')] # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: @@ -28,7 +29,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$[replace($(releaseNotes), '\"', '''''')]";CD="$(RN2)" + buildProperties: "NoWarn=0419;1573;1591;ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$[replace($(releaseNotes), '\"', '''''')];CD=$env:RN2" # - task: NuGetCommand@2 # inputs: From 5dc82919729b91d3bf387307dd4c470bedbc2d04 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:55:36 +0200 Subject: [PATCH 120/336] yaml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4eacb30..8428762 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - RN1: $[replace($env:releaseNotes, '"', '''''')] + RN1: $[replace(variables.releaseNotes, '"', '''''')] # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: From 609244a8480732ad569b9404eb3e071f45fcb123 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Sep 2023 23:58:03 +0200 Subject: [PATCH 121/336] yaml --- .github/dev.yml | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 8428762..d6462af 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - RN1: $[replace(variables.releaseNotes, '"', '''''')] + releaseNotes: $[replace(variables.releaseNotes, '"', '''''')] # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: @@ -21,15 +21,13 @@ steps: includePreviewVersions: true - task: DotNetCoreCLI@2 - env: - RN2: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: "NoWarn=0419;1573;1591;ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$[replace($(releaseNotes), '\"', '''''')];CD=$env:RN2" + buildProperties: "NoWarn=0419;1573;1591;ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(releaseNotes)" # - task: NuGetCommand@2 # inputs: From e954fdc628f022095dc78df1c837b0d8ae004243 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Sep 2023 00:00:35 +0200 Subject: [PATCH 122/336] yaml --- .github/dev.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index d6462af..5a5a3c5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -9,7 +9,7 @@ pool: variables: buildConfiguration: 'Release' - releaseNotes: $[replace(variables.releaseNotes, '"', '''''')] + rn: $[replace(variables.releaseNotes, '"', '''''')] # releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: @@ -27,7 +27,7 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: "NoWarn=0419;1573;1591;ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes=$(releaseNotes)" + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(rn)" # - task: NuGetCommand@2 # inputs: From 6d43da3d75410aed3c65cdc14bb9ed0380d0aed1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Sep 2023 00:07:07 +0200 Subject: [PATCH 123/336] yaml --- .github/dev.yml | 22 ++++++++++------------ .github/release.yml | 5 ++--- 2 files changed, 12 insertions(+), 15 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 5a5a3c5..ed68f82 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,6 +1,5 @@ pr: none -trigger: none -#- master +trigger: master name: 3.5.6-dev.$(Rev:r) @@ -9,8 +8,7 @@ pool: variables: buildConfiguration: 'Release' - rn: $[replace(variables.releaseNotes, '"', '''''')] -# releaseNotes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] + Release_Notes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] steps: - task: UseDotNet@2 @@ -27,12 +25,12 @@ steps: includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(rn)" + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(Release_Notes)" -# - task: NuGetCommand@2 -# inputs: -# command: 'push' -# packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' -# publishPackageMetadata: true -# nuGetFeedType: 'external' -# publishFeedCredentials: 'nuget.org' +- task: NuGetCommand@2 + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' + publishPackageMetadata: true + nuGetFeedType: 'external' + publishFeedCredentials: 'nuget.org' diff --git a/.github/release.yml b/.github/release.yml index 4ad1c8b..7b1774a 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -8,6 +8,7 @@ pool: variables: buildConfiguration: 'Release' + Release_Notes: $[replace(variables['releaseNotes'], '"', '''''')] stages: - stage: publish @@ -25,15 +26,13 @@ stages: includePreviewVersions: true - task: DotNetCoreCLI@2 - variables: - Release_Notes: $[replace($(releaseNotes), '"', '''''')] inputs: command: 'pack' packagesToPack: '**/*.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' - buildProperties: 'NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);ReleaseNotes="$(Release_Notes)"' + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(Release_Notes)" - task: NuGetCommand@2 inputs: From 4b7205cb68699c86cbc045bd1cbc9295a724c2ef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Sep 2023 00:07:53 +0200 Subject: [PATCH 124/336] yaml --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index ed68f82..98609f9 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,5 +1,5 @@ pr: none -trigger: master +trigger: [ master ] name: 3.5.6-dev.$(Rev:r) From 88e2f5d71ea35b21f42c3c964c21f39501db22aa Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:17:49 +0200 Subject: [PATCH 125/336] detect wrong usage of GetMessages --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 4 ++++ src/TL.Extensions.cs | 2 +- 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 98609f9..3a41fac 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.5.6-dev.$(Rev:r) +name: 3.5.7-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index f8fb9d5..55ea982 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -667,6 +667,10 @@ namespace WTelegram } } + /// If you want to get all messages from a chat, use method Messages_GetHistory + public Task GetMessages(InputPeer peer) + => throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory"); + /// Generic helper: Get individual messages by IDs [bots: ✓] See
and
Possible codes: 400
/// User/Chat/Channel /// IDs of messages to get diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 60860cc..dc20256 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -42,7 +42,7 @@ namespace TL public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); public static Task Channels_GetChannels(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); public static Task Users_GetUsers(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllDialogs"); - public static Task Messages_GetMessages(this Client _) => throw new WTException("If you want to get the messages from a chat, use Messages_GetHistory"); + public static Task Messages_GetMessages(this Client _) => throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory"); } public static class Markdown From 2b7868ee1658ff1502a30714812519ea32390575 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 4 Oct 2023 19:24:53 +0200 Subject: [PATCH 126/336] API Layer 165: minor changes to WebPage, channel boost url --- README.md | 2 +- src/TL.Schema.cs | 92 +++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 100 ++++++++++++++++++++++--------------- src/TL.Table.cs | 5 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 141 insertions(+), 60 deletions(-) diff --git a/README.md b/README.md index 8b3c7e2..a847e48 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-164-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-165-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 2007e87..1a545be 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -178,7 +178,7 @@ namespace TL public override string Name { get => name; set => name = value; } } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract class InputMedia : IObject { } /// Photo See @@ -1745,7 +1745,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -1933,6 +1933,7 @@ namespace TL [TLDef(0x68CB6283)] public class MessageMediaStory : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int id; @@ -1940,6 +1941,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_story = 0x1, via_mention = 0x2, } @@ -3342,7 +3344,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -3416,14 +3418,19 @@ namespace TL /// Usernames. public Username[] usernames; } - /// See + /// Authorized to the current user's account through an unknown device. See [TLDef(0x8951ABEF)] public class UpdateNewAuthorization : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Hash for pagination, for more info click here public long hash; + /// Authorization date [IfFlag(0)] public DateTime date; + /// Name of device, for example Android [IfFlag(0)] public string device; + /// Location, for example USA, NY (IP=1.2.3.4) [IfFlag(0)] public string location; [Flags] public enum Flags : uint @@ -3599,6 +3606,7 @@ namespace TL [TLDef(0xF8227181)] public class UpdateReadMessagesContents : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// IDs of read messages public int[] messages; @@ -4245,6 +4253,7 @@ namespace TL [TLDef(0xEBE07752)] public class UpdatePeerBlocked : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The blocked peer public Peer peer_id; @@ -5857,7 +5866,7 @@ namespace TL About = 0xA486B761, } - /// Privacy rule See Derived classes: , , , , , , , + /// Privacy rule See Derived classes: , , , , , , , , public abstract class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] @@ -5903,7 +5912,7 @@ namespace TL [TLDef(0x2F453E49)] public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } - /// Privacy rule See Derived classes: , , , , , , , + /// Privacy rule See Derived classes: , , , , , , , , public abstract class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -12310,7 +12319,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: + /// Webpage attributes See Derived classes: , public abstract class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -12335,6 +12344,7 @@ namespace TL [TLDef(0x2E94C3E7)] public class WebPageAttributeStory : WebPageAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int id; @@ -12342,6 +12352,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_story = 0x1, } } @@ -12925,7 +12936,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Reply information See Derived classes: + /// Reply information See Derived classes: , public abstract class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See [TLDef(0xA6D57763)] @@ -13715,9 +13726,9 @@ namespace TL public Flags flags; /// If set, indicates that the current user also sent this reaction.
The integer value indicates when was the reaction added: the bigger the value, the newer the reaction.
[IfFlag(0)] public int chosen_order; - /// Reaction (a UTF8 emoji) + /// The reaction. public Reaction reaction; - /// NUmber of users that reacted with this emoji + /// Number of users that reacted with this emoji. public int count; [Flags] public enum Flags : uint @@ -14998,7 +15009,7 @@ namespace TL public string description; } - ///
See + /// See Derived classes: , , public abstract class MessagePeerVoteBase : IObject { public virtual Peer Peer { get; } @@ -15041,6 +15052,7 @@ namespace TL [TLDef(0x3DB8EC63)] public class SponsoredWebPage : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string url; public string site_name; @@ -15048,6 +15060,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_photo = 0x1, } } @@ -15056,6 +15069,7 @@ namespace TL [TLDef(0x8D595CD6)] public class StoryViews : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int views_count; [IfFlag(2)] public int forwards_count; @@ -15065,15 +15079,19 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_recent_viewers = 0x1, has_viewers = 0x2, + /// Field has a value has_forwards_count = 0x4, + /// Field has a value has_reactions = 0x8, + /// Field has a value has_reactions_count = 0x10, } } - /// See + /// See Derived classes: , , public abstract class StoryItemBase : IObject { public virtual int ID { get; } @@ -15090,6 +15108,7 @@ namespace TL [TLDef(0xFFADC913)] public class StoryItemSkipped : StoryItemBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int id; public DateTime date; @@ -15106,11 +15125,13 @@ namespace TL [TLDef(0x44C457CE)] public class StoryItem : StoryItemBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int id; public DateTime date; public DateTime expire_date; [IfFlag(0)] public string caption; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; public MessageMedia media; [IfFlag(14)] public MediaArea[] media_areas; @@ -15120,9 +15141,13 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_caption = 0x1, + /// Field has a value has_entities = 0x2, + /// Field has a value has_privacy = 0x4, + /// Field has a value has_views = 0x8, pinned = 0x20, public_ = 0x80, @@ -15132,7 +15157,9 @@ namespace TL edited = 0x800, contacts = 0x1000, selected_contacts = 0x2000, + /// Field has a value has_media_areas = 0x4000, + /// Field has a value has_sent_reaction = 0x8000, out_ = 0x10000, } @@ -15140,12 +15167,13 @@ namespace TL public override int ID => id; } - /// See + /// See Derived classes: , public abstract class Stories_AllStoriesBase : IObject { } /// See [TLDef(0x1158FE3E)] public class Stories_AllStoriesNotModified : Stories_AllStoriesBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string state; public StoriesStealthMode stealth_mode; @@ -15158,6 +15186,7 @@ namespace TL [TLDef(0x6EFC5E81)] public class Stories_AllStories : Stories_AllStoriesBase, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public string state; @@ -15190,6 +15219,7 @@ namespace TL [TLDef(0xB0BDEAC5)] public class StoryView : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long user_id; public DateTime date; @@ -15199,6 +15229,7 @@ namespace TL { blocked = 0x1, blocked_my_stories_from = 0x2, + /// Field has a value has_reaction = 0x4, } } @@ -15207,6 +15238,7 @@ namespace TL [TLDef(0x46E9B9EC)] public class Stories_StoryViewsList : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public int reactions_count; @@ -15216,6 +15248,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } @@ -15228,18 +15261,20 @@ namespace TL public Dictionary users; } - /// See + /// See Derived classes: , public abstract class InputReplyTo : IObject { } /// See [TLDef(0x9C5386E4)] public class InputReplyToMessage : InputReplyTo { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int reply_to_msg_id; [IfFlag(0)] public int top_msg_id; [Flags] public enum Flags : uint { + /// Field has a value has_top_msg_id = 0x1, } } @@ -15262,13 +15297,16 @@ namespace TL [TLDef(0x712E27FD)] public class StoriesStealthMode : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public DateTime active_until_date; [IfFlag(1)] public DateTime cooldown_until_date; [Flags] public enum Flags : uint { + /// Field has a value has_active_until_date = 0x1, + /// Field has a value has_cooldown_until_date = 0x2, } } @@ -15284,7 +15322,7 @@ namespace TL public double rotation; } - /// See + /// See Derived classes: , , , public abstract class MediaArea : IObject { } /// See [TLDef(0xBE82DB9C)] @@ -15317,6 +15355,7 @@ namespace TL [TLDef(0x14455871)] public class MediaAreaSuggestedReaction : MediaArea { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public MediaAreaCoordinates coordinates; public Reaction reaction; @@ -15332,6 +15371,7 @@ namespace TL [TLDef(0x9A35E999)] public class PeerStories : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; [IfFlag(0)] public int max_read_id; @@ -15339,6 +15379,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_max_read_id = 0x1, } } @@ -15355,25 +15396,29 @@ namespace TL } /// See - [TLDef(0x66EA1FEF)] + [TLDef(0xE5C1AA5C)] public class Stories_BoostsStatus : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int level; public int current_level_boosts; public int boosts; [IfFlag(0)] public int next_level_boosts; [IfFlag(1)] public StatsPercentValue premium_audience; + public string boost_url; [Flags] public enum Flags : uint { + /// Field has a value has_next_level_boosts = 0x1, + /// Field has a value has_premium_audience = 0x2, my_boost = 0x4, } } - /// See + /// See Derived classes: , public abstract class Stories_CanApplyBoostResult : IObject { } /// See [TLDef(0xC3173587)] @@ -15398,6 +15443,7 @@ namespace TL [TLDef(0xF3DD3D1D)] public class Stories_BoostersList : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public Booster[] boosters; @@ -15406,7 +15452,19 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } + + /// See + [TLDef(0xFD5E12BD)] + public class Messages_WebPage : IObject, IPeerResolver + { + public WebPageBase webpage; + 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 9a34753..8074643 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -263,7 +263,7 @@ namespace TL except_ids = except_ids, }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400,500 (details) /// Login token public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.Invoke(new Auth_ImportLoginToken @@ -1006,7 +1006,7 @@ namespace TL authorization_ttl_days = authorization_ttl_days, }); - /// Change authorization settings See Possible codes: 400 (details) + /// Change settings related to the current session. See Possible codes: 400 (details) /// Session ID from the , fetchable using Account_GetAuthorizations /// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed /// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed @@ -1050,7 +1050,7 @@ namespace TL mime_type = mime_type, }); - /// Set an emoji status See + /// Set an emoji status See Possible codes: 400 (details) /// Emoji status to set public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status) => client.Invoke(new Account_UpdateEmojiStatus @@ -1159,7 +1159,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400,500 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1401,6 +1401,7 @@ namespace TL }); /// See + /// Maximum number of results to return, see pagination public static Task Contacts_SetBlocked(this Client client, InputPeer[] id, int limit = int.MaxValue, bool my_stories_from = false) => client.Invoke(new Contacts_SetBlocked { @@ -1801,7 +1802,7 @@ namespace TL max_date = max_date, }); - /// Sends a text message to a secret chat. See Possible codes: 400,403 (details) + /// Sends a text message to a secret chat. See Possible codes: 400,403,500 (details) /// Send encrypted message without a notification /// Secret chat ID /// Unique client message ID, necessary to avoid message resending You can use @@ -1999,7 +2000,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2146,7 +2147,7 @@ namespace TL id = id, }); - /// Edit message See [bots: ✓] Possible codes: 400,403,406 (details) + /// Edit message See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Disable webpage preview /// Where was the message sent /// ID of the message to edit @@ -2396,7 +2397,7 @@ namespace TL /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch /// Hash for pagination, for more info click here - public static Task Messages_GetWebPage(this Client client, string url, int hash = default) + public static Task Messages_GetWebPage(this Client client, string url, int hash = default) => client.Invoke(new Messages_GetWebPage { url = url, @@ -3080,7 +3081,7 @@ namespace TL /// Invite link /// Search for a user in the pending join requests » list: only available when the requested flag is set, cannot be used together with a specific link. /// Offsets for pagination, for more info click here - /// User ID for pagination: if set, offset_date must also be set. + /// User ID for pagination: if set, offset_date must also be set. /// Maximum number of results to return, see pagination public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false) => client.Invoke(new Messages_GetChatInviteImporters @@ -4620,7 +4621,7 @@ namespace TL order = order, }); - /// Enable or disable the native antispam system. See [bots: ✓] + /// Enable or disable the native antispam system. See [bots: ✓] Possible codes: 400 (details) /// Supergroup ID. The specified supergroup must have at least telegram_antispam_group_size_min members to enable antispam functionality, as specified by the client configuration parameters. /// Enable or disable the native antispam system. public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) @@ -4650,7 +4651,7 @@ namespace TL enabled = enabled, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.Invoke(new Channels_ClickSponsoredMessage { @@ -4795,21 +4796,21 @@ namespace TL active = active, }); - /// See + /// See Possible codes: 400 (details) public static Task Bots_CanSendMessage(this Client client, InputUserBase bot) => client.Invoke(new Bots_CanSendMessage { bot = bot, }); - /// See + /// See Possible codes: 400 (details) public static Task Bots_AllowSendMessage(this Client client, InputUserBase bot) => client.Invoke(new Bots_AllowSendMessage { bot = bot, }); - /// See + /// See Possible codes: 400 (details) public static Task Bots_InvokeWebViewCustomMethod(this Client client, InputUserBase bot, string custom_method, DataJSON params_) => client.Invoke(new Bots_InvokeWebViewCustomMethod { @@ -5072,7 +5073,7 @@ namespace TL protocol = protocol, }); - /// Accept incoming call See Possible codes: 400,500 (details) + /// Accept incoming call See Possible codes: 400,406,500 (details) /// The call to accept /// Parameter for E2E encryption key exchange » /// Phone call settings @@ -5172,7 +5173,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), }); - /// Join a group call See Possible codes: 400,403 (details) + /// Join a group call See Possible codes: 400,403,500 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call @@ -5633,14 +5634,19 @@ namespace TL peers = peers, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_CanSendStory(this Client client, InputPeer peer) => client.Invoke(new Stories_CanSendStory { peer = peer, }); - /// See + /// Uploads a Telegram Story. See Possible codes: 400 (details) + /// If set, disables forwards and story download functionality. + /// The media file. + /// Story caption. + /// Message entities for styled text + /// Unique client message ID required to prevent message resending. You can use public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) => client.Invoke(new Stories_SendStory { @@ -5655,7 +5661,8 @@ namespace TL period = period.GetValueOrDefault(), }); - /// See + /// See Possible codes: 400 (details) + /// Message entities for styled text public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory { @@ -5669,7 +5676,9 @@ namespace TL privacy_rules = privacy_rules, }); - /// See + /// Deletes some posted stories. See Possible codes: 400 (details) + /// Channel/user from where to delete stories. + /// IDs of stories to delete. public static Task Stories_DeleteStories(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_DeleteStories { @@ -5677,7 +5686,7 @@ namespace TL id = id, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_TogglePinned(this Client client, InputPeer peer, int[] id, bool pinned) => client.Invoke(new Stories_TogglePinned { @@ -5694,7 +5703,9 @@ namespace TL state = state, }); - /// See + /// See Possible codes: 400 (details) + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Stories_GetPinnedStories(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetPinnedStories { @@ -5703,7 +5714,9 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Stories_GetStoriesArchive(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetStoriesArchive { @@ -5712,7 +5725,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_GetStoriesByID(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesByID { @@ -5727,7 +5740,8 @@ namespace TL hidden = hidden, }); - /// See + /// See Possible codes: 400 (details) + /// The peer whose stories should be marked as read. public static Task Stories_ReadStories(this Client client, InputPeer peer, int max_id = default) => client.Invoke(new Stories_ReadStories { @@ -5735,7 +5749,9 @@ namespace TL max_id = max_id, }); - /// See + /// Increment the view counter of one or more stories. See Possible codes: 400 (details) + /// Peer where the stories were posted. + /// IDs of the stories. public static Task Stories_IncrementStoryViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_IncrementStoryViews { @@ -5743,7 +5759,8 @@ namespace TL id = id, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Stories_GetStoryViewsList(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) => client.Invoke(new Stories_GetStoryViewsList { @@ -5755,7 +5772,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesViews { @@ -5763,7 +5780,7 @@ namespace TL id = id, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_ExportStoryLink(this Client client, InputPeer peer, int id) => client.Invoke(new Stories_ExportStoryLink { @@ -5771,7 +5788,11 @@ namespace TL id = id, }); - /// See + /// Report a story. See Possible codes: 400 (details) + /// The peer that uploaded the story. + /// IDs of the stories to report. + /// Why are these storeis being reported. + /// Comment for report moderation public static Task Stories_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) => client.Invoke(new Stories_Report { @@ -5788,7 +5809,7 @@ namespace TL flags = (Stories_ActivateStealthMode.Flags)((past ? 0x1 : 0) | (future ? 0x2 : 0)), }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_SendReaction(this Client client, InputPeer peer, int story_id, Reaction reaction, bool add_to_recent = false) => client.Invoke(new Stories_SendReaction { @@ -5798,7 +5819,7 @@ namespace TL reaction = reaction, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_GetPeerStories(this Client client, InputPeer peer) => client.Invoke(new Stories_GetPeerStories { @@ -5824,7 +5845,7 @@ namespace TL { }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_TogglePeerStoriesHidden(this Client client, InputPeer peer, bool hidden) => client.Invoke(new Stories_TogglePeerStoriesHidden { @@ -5832,14 +5853,15 @@ namespace TL hidden = hidden, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Stories_GetBoostsStatus { peer = peer, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Stories_GetBoostersList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue) => client.Invoke(new Stories_GetBoostersList { @@ -5848,14 +5870,14 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_CanApplyBoost(this Client client, InputPeer peer) => client.Invoke(new Stories_CanApplyBoost { peer = peer, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_ApplyBoost(this Client client, InputPeer peer) => client.Invoke(new Stories_ApplyBoost { @@ -7821,8 +7843,8 @@ namespace TL.Methods public int limit; } - [TLDef(0x32CA8F91)] - public class Messages_GetWebPage : IMethod + [TLDef(0x8D9692A3)] + public class Messages_GetWebPage : IMethod { public string url; public int hash; diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3acd017..2534795 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 = 164; // fetched 22/09/2023 19:03:28 + public const int Version = 165; // fetched 04/10/2023 17:10:52 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1127,11 +1127,12 @@ namespace TL [0x14455871] = typeof(MediaAreaSuggestedReaction), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), - [0x66EA1FEF] = typeof(Stories_BoostsStatus), + [0xE5C1AA5C] = typeof(Stories_BoostsStatus), [0xC3173587] = typeof(Stories_CanApplyBoostOk), [0x712C4655] = typeof(Stories_CanApplyBoostReplace), [0x0E9E6380] = typeof(Booster), [0xF3DD3D1D] = typeof(Stories_BoostersList), + [0xFD5E12BD] = typeof(Messages_WebPage), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 21b9a32..d734d90 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: 164 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 165 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From fb8d1c2d0701d78c3c01866e1eda6bce4f68fa48 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 9 Oct 2023 15:19:03 +0200 Subject: [PATCH 127/336] Some more implicit Input conversions --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 1 + src/TL.Helpers.cs | 9 +++++++++ src/TL.Schema.cs | 42 ++++++++++++++++++++++++++++++----------- src/TL.SchemaFuncs.cs | 44 ++++++++++++++++++++++++++++++------------- 5 files changed, 73 insertions(+), 25 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 3a41fac..e20f7e3 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.5.7-dev.$(Rev:r) +name: 3.5.8-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 55ea982..8047a3b 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -668,6 +668,7 @@ namespace WTelegram } /// If you want to get all messages from a chat, use method Messages_GetHistory + [System.Diagnostics.CodeAnalysis.SuppressMessage("Performance", "CA1822")] public Task GetMessages(InputPeer peer) => throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory"); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 4ff1deb..25101be 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -381,6 +381,13 @@ namespace TL public static implicit operator InputGeoPoint(GeoPoint geo) => new() { lat = geo.lat, lon = geo.lon, accuracy_radius = geo.accuracy_radius, flags = (InputGeoPoint.Flags)geo.flags }; } + partial class InputNotifyPeerBase + { + public static implicit operator InputNotifyPeerBase(InputPeer peer) => new InputNotifyPeer { peer = peer }; + public static implicit operator InputNotifyPeerBase(ChatBase chat) => new InputNotifyPeer { peer = chat }; + public static implicit operator InputNotifyPeerBase(UserBase user) => new InputNotifyPeer { peer = user }; + } + partial class WallPaperBase { public static implicit operator InputWallPaperBase(WallPaperBase wp) => wp.ToInputWallPaper(); protected abstract InputWallPaperBase ToInputWallPaper(); } partial class WallPaper { protected override InputWallPaperBase ToInputWallPaper() => new InputWallPaper { id = id, access_hash = access_hash }; } @@ -620,6 +627,8 @@ namespace TL partial class InputDialogPeerBase { public static implicit operator InputDialogPeerBase(InputPeer peer) => new InputDialogPeer { peer = peer }; + public static implicit operator InputDialogPeerBase(ChatBase chat) => new InputDialogPeer { peer = chat }; + public static implicit operator InputDialogPeerBase(UserBase user) => new InputDialogPeer { peer = user }; } partial class SecureFile diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 1a545be..3b3a121 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2677,7 +2677,7 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , , - public abstract class InputNotifyPeerBase : IObject { } + public abstract partial class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] public class InputNotifyPeer : InputNotifyPeerBase @@ -4687,10 +4687,11 @@ namespace TL public int id; public long random_id; } - /// See + /// Indicates that stories stealth mode was activated. See [TLDef(0x2C084DC1)] public class UpdateStoriesStealthMode : Update { + /// Information about the current stealth mode session. public StoriesStealthMode stealth_mode; } /// See @@ -11713,8 +11714,11 @@ namespace TL other = 0x1000, /// If set, allows the admin to create, delete or modify forum topics ». manage_topics = 0x2000, + /// If set, allows the admin to post stories as the channel. post_stories = 0x4000, + /// If set, allows the admin to edit stories posted by the other admins of the channel. edit_stories = 0x8000, + /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, } } @@ -12190,7 +12194,7 @@ namespace TL [TLDef(0x629F1980)] public class Auth_LoginToken : Auth_LoginTokenBase { - /// Expiry date of QR code + /// Expiration date of QR code public DateTime expires; /// Token to render in QR code public byte[] token; @@ -14572,7 +14576,7 @@ namespace TL { /// The temporary profile link. public string url; - /// Its expiry date + /// Its expiration date public DateTime expires; } @@ -15293,13 +15297,15 @@ namespace TL public string link; } - /// See + /// Information about the current stealth mode session. See [TLDef(0x712E27FD)] public class StoriesStealthMode : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The date up to which stealth mode will be active. [IfFlag(0)] public DateTime active_until_date; + /// The date starting from which the user will be allowed to re-enable stealth mode again. [IfFlag(1)] public DateTime cooldown_until_date; [Flags] public enum Flags : uint @@ -15395,16 +15401,21 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// The current boost status » of a channel. See [TLDef(0xE5C1AA5C)] public class Stories_BoostsStatus : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The current boost level of the channel. public int level; + /// The number of boosts acquired so far in the current level. public int current_level_boosts; + /// Total number of boosts acquired so far. public int boosts; + /// Total number of boosts needed to reach the next level; if absent, the next level isn't available. [IfFlag(0)] public int next_level_boosts; + /// Only returned to channel admins: contains the approximated number of Premium users subscribed to the channel, related to the total number of subscribers. [IfFlag(1)] public StatsPercentValue premium_audience; public string boost_url; @@ -15414,40 +15425,49 @@ namespace TL has_next_level_boosts = 0x1, /// Field has a value has_premium_audience = 0x2, + /// Whether we're currently boosting this channel. my_boost = 0x4, } } - /// See Derived classes: , + /// Whether the specified channel can be boosted, see here for more info ». See Derived classes: , public abstract class Stories_CanApplyBoostResult : IObject { } - /// See + /// We're not boosting any channel, and we can freely boost the specified channel. See [TLDef(0xC3173587)] public class Stories_CanApplyBoostOk : Stories_CanApplyBoostResult { } - /// See + /// We're boosting another channel, but we can freely boost the specified channel. See [TLDef(0x712C4655)] public class Stories_CanApplyBoostReplace : Stories_CanApplyBoostResult { + /// The channel we're currently boosting. public Peer current_boost; + /// Channel information. public Dictionary chats; } - /// See + /// Info about a boost made by a specific user. See [TLDef(0x0E9E6380)] public class Booster : IObject { + /// ID of the user that made the boost. public long user_id; + /// Default expiration date of the boost. public DateTime expires; } - /// See + /// Info about the users currently boosting the channel. See [TLDef(0xF3DD3D1D)] public class Stories_BoostersList : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of boosters. public int count; + /// Info about the automatic expiration date of every user's boost. public Booster[] boosters; + /// Next offset for pagination. [IfFlag(0)] public string next_offset; + /// Info about the users mentioned in the boosters field. public Dictionary users; [Flags] public enum Flags : uint diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 8074643..0b6743d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2000,7 +2000,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2459,7 +2459,7 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403,500 (details) + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -3207,7 +3207,7 @@ namespace TL /// React to message. See Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown - /// Add this reaction to the recent reactions list ». + /// Whether to add this reaction to the recent reactions list ». /// Peer /// Message ID to react to /// A list of reactions @@ -3701,7 +3701,7 @@ namespace TL limit = limit, }); - /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400,500 (details) + /// Installs a previously uploaded photo as a profile photo. See [bots: ✓] Possible codes: 400 (details) /// If set, the chosen profile photo will be shown to users that can't display your main profile photo due to your privacy settings. /// Can contain info of a bot we own, to change the profile photo of that bot, instead of the current user. /// Input photo @@ -4135,7 +4135,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) + /// Create a supergroup/channel. See Possible codes: 400,406 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -5634,7 +5634,8 @@ namespace TL peers = peers, }); - /// See Possible codes: 400 (details) + /// Check whether we can post stories as the specified peer. See Possible codes: 400 (details) + /// The peer from which we wish to post stories. public static Task Stories_CanSendStory(this Client client, InputPeer peer) => client.Invoke(new Stories_CanSendStory { @@ -5643,6 +5644,7 @@ namespace TL /// Uploads a Telegram Story. See Possible codes: 400 (details) /// If set, disables forwards and story download functionality. + /// The peer to send the story as. /// The media file. /// Story caption. /// Message entities for styled text @@ -5662,7 +5664,12 @@ namespace TL }); /// See Possible codes: 400 (details) - /// Message entities for styled text + /// Peer where the story was posted. + /// ID of story to edit. + /// If specified, replaces the story media. + /// If specified, replaces the story caption. + /// Message entities for styled text in the caption + /// If specified, alters the privacy settings of the story. public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory { @@ -5802,14 +5809,20 @@ namespace TL message = message, }); - /// See + /// Activates stories stealth mode, see here » for more info. See + /// Whether to erase views from any stories opened in the past stories_stealth_past_period seconds », as specified by the client configuration. + /// Whether to hide future story views for the next stories_stealth_future_period seconds », as specified by the client configuration. public static Task Stories_ActivateStealthMode(this Client client, bool past = false, bool future = false) => client.Invoke(new Stories_ActivateStealthMode { flags = (Stories_ActivateStealthMode.Flags)((past ? 0x1 : 0) | (future ? 0x2 : 0)), }); - /// See Possible codes: 400 (details) + /// React to a story. See Possible codes: 400 (details) + /// Whether to add this reaction to the recent reactions list ». + /// The peer that sent the story + /// ID of the story to react to + /// Reaction public static Task Stories_SendReaction(this Client client, InputPeer peer, int story_id, Reaction reaction, bool add_to_recent = false) => client.Invoke(new Stories_SendReaction { @@ -5853,14 +5866,17 @@ namespace TL hidden = hidden, }); - /// See Possible codes: 400 (details) + /// Get the current boost status of a channel, see here » for more info on boosts. See Possible codes: 400 (details) + /// The channel public static Task Stories_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Stories_GetBoostsStatus { peer = peer, }); - /// See Possible codes: 400 (details) + /// Obtain info about the users currently boosting a channel, see here » for more info about boosts. See Possible codes: 400 (details) + /// The channel. + /// Next offset for pagination, obtained from the next_offset field of . /// Maximum number of results to return, see pagination public static Task Stories_GetBoostersList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue) => client.Invoke(new Stories_GetBoostersList @@ -5870,14 +5886,16 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Check whether a channel can be boosted, see here for more info ». See Possible codes: 400 (details) + /// The channel to boost. public static Task Stories_CanApplyBoost(this Client client, InputPeer peer) => client.Invoke(new Stories_CanApplyBoost { peer = peer, }); - /// See Possible codes: 400 (details) + /// Boost » a channel, leveling it up and granting it permission to post stories ». See Possible codes: 400 (details) + /// The channel to boost. public static Task Stories_ApplyBoost(this Client client, InputPeer peer) => client.Invoke(new Stories_ApplyBoost { From c059ebf208d230ff975d459f745163963656d21a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 19 Oct 2023 23:57:45 +0200 Subject: [PATCH 128/336] UploadFileAsync now supports Stream with unknown Length (!CanSeek) --- src/Client.Helpers.cs | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 8047a3b..9c7eafa 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -38,19 +38,27 @@ namespace WTelegram using var md5 = MD5.Create(); using (stream) { - long transmitted = 0, length = stream.Length; - var isBig = length >= 10 * 1024 * 1024; - int file_total_parts = (int)((length - 1) / FilePartSize) + 1; + bool hasLength = stream.CanSeek; + long transmitted = 0, length = hasLength ? stream.Length : -1; + bool isBig = hasLength ? length >= 10 * 1024 * 1024 : true; + int file_total_parts = hasLength ? (int)((length - 1) / FilePartSize) + 1 : -1; long file_id = Helpers.RandomLong(); int file_part = 0, read; var tasks = new Dictionary(); bool abort = false; - for (long bytesLeft = length; !abort && bytesLeft != 0; file_part++) + for (long bytesLeft = hasLength ? length : long.MaxValue; !abort && bytesLeft != 0; file_part++) { var bytes = new byte[Math.Min(FilePartSize, bytesLeft)]; read = await stream.FullReadAsync(bytes, bytes.Length, default); await _parallelTransfers.WaitAsync(); bytesLeft -= read; + if (!hasLength && read < bytes.Length) + { + file_total_parts = file_part; + if (read == 0) break; else file_total_parts++; + bytes = bytes[..read]; + bytesLeft = 0; + } var task = SavePart(file_part, bytes); lock (tasks) tasks[file_part] = task; if (!isBig) From 9e92d3d81475aaa363fbfb1a458337ec795360a0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:00:14 +0200 Subject: [PATCH 129/336] api doc --- src/TL.Schema.cs | 59 ++++++++++++++++++++++++++++++++----------- src/TL.SchemaFuncs.cs | 15 +++++++---- src/TL.Secret.cs | 2 +- 3 files changed, 55 insertions(+), 21 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3b3a121..6efec45 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -311,7 +311,7 @@ namespace TL public string title; /// Physical address of the venue public string address; - /// Venue provider: currently only "foursquare" needs to be supported + /// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be supported public string provider; /// Venue ID in the provider's database public string venue_id; @@ -1671,7 +1671,7 @@ namespace TL pinned = 0x1000000, /// Field has a value has_ttl_period = 0x2000000, - /// Whether this message is protected and thus cannot be forwarded + /// Whether this message is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera). noforwards = 0x4000000, } @@ -1837,7 +1837,7 @@ namespace TL public string title; /// Address public string address; - /// Venue provider: currently only "foursquare" needs to be supported + /// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be supported public string provider; /// Venue ID in the provider's database public string venue_id; @@ -5817,7 +5817,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Privacy key See + /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum InputPrivacyKey : uint { ///Whether people will be able to see your exact last online timestamp @@ -5842,7 +5842,7 @@ namespace TL About = 0x3823CC40, } - /// Privacy key See + /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum PrivacyKey : uint { ///Whether we can see the last online timestamp of this user @@ -5867,7 +5867,7 @@ namespace TL About = 0xA486B761, } - /// Privacy rule See Derived classes: , , , , , , , , + /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , public abstract class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] @@ -5913,7 +5913,7 @@ namespace TL [TLDef(0x2F453E49)] public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } - /// Privacy rule See Derived classes: , , , , , , , , + /// Privacy rules together with privacy indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , public abstract class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -6963,7 +6963,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -7533,7 +7533,7 @@ namespace TL public string title; /// Address public string address; - /// Venue provider: currently only "foursquare" needs to be supported + /// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be supported public string provider; /// Venue ID in the provider's database public string venue_id; @@ -7822,7 +7822,7 @@ namespace TL public string title; /// Address public string address; - /// Venue provider: currently only "foursquare" needs to be supported + /// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be supported public string provider; /// Venue ID in the provider's database public string venue_id; @@ -15125,22 +15125,29 @@ namespace TL public override int ID => id; } - /// See + /// Represents a story. See [TLDef(0x44C457CE)] public class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the story. public int id; + /// When was the story posted. public DateTime date; + /// When does the story expire. public DateTime expire_date; + /// Story caption. [IfFlag(0)] public string caption; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Story media. public MessageMedia media; + /// List of media areas, see here » for more info on media areas. [IfFlag(14)] public MediaArea[] media_areas; [IfFlag(2)] public PrivacyRule[] privacy; [IfFlag(3)] public StoryViews views; + /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; [Flags] public enum Flags : uint @@ -15157,7 +15164,9 @@ namespace TL public_ = 0x80, close_friends = 0x100, min = 0x200, + /// Whether this story is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera). noforwards = 0x400, + /// Indicates whether the story was edited. edited = 0x800, contacts = 0x1000, selected_contacts = 0x2000, @@ -15165,9 +15174,11 @@ namespace TL has_media_areas = 0x4000, /// Field has a value has_sent_reaction = 0x8000, + /// indicates whether we sent this story. out_ = 0x10000, } + /// ID of the story. public override int ID => id; } @@ -15317,29 +15328,41 @@ namespace TL } } - /// See + /// Coordinates and size of a clicable rectangular area on top of a story. See [TLDef(0x03D1EA4E)] public class MediaAreaCoordinates : IObject { + /// The abscissa of the rectangle's center, as a percentage of the media width (0-100). public double x; + /// The ordinate of the rectangle's center, as a percentage of the media height (0-100). public double y; + /// The width of the rectangle, as a percentage of the media width (0-100). public double w; + /// The height of the rectangle, as a percentage of the media height (0-100). public double h; + /// Clockwise rotation angle of the rectangle, in degrees (0-360). public double rotation; } /// See Derived classes: , , , public abstract class MediaArea : IObject { } - /// See + /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] public class MediaAreaVenue : MediaArea { + /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + /// Coordinates of the venue public GeoPoint geo; + /// Venue name public string title; + /// Address public string address; + /// Venue provider: currently only "foursquare" needs to be supported. public string provider; + /// Venue ID in the provider's database public string venue_id; + /// Venue type in the provider's database public string venue_type; } /// See @@ -15350,25 +15373,31 @@ namespace TL public long query_id; public string result_id; } - /// See + /// Represents a geolocation tag attached to a story. See [TLDef(0xDF8B3B22)] public class MediaAreaGeoPoint : MediaArea { + /// The size and position of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + /// Coordinates of the geolocation tag. public GeoPoint geo; } - /// See + /// Represents a reaction bubble. See [TLDef(0x14455871)] public class MediaAreaSuggestedReaction : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The coordinates of the media area corresponding to the reaction button. public MediaAreaCoordinates coordinates; + /// The reaction that should be sent when this area is clicked. public Reaction reaction; [Flags] public enum Flags : uint { + /// Whether the reaction bubble has a dark background. dark = 0x1, + /// Whether the reaction bubble is mirrored (see here » for more info). flipped = 0x2, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 0b6743d..ca756c0 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1328,7 +1328,7 @@ namespace TL /// Telegram ID of the other user /// First name /// Last name - /// User's phone number + /// User's phone number, may be omitted to simply add the user to the contact list, without a phone number. public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, bool add_phone_privacy_exception = false) => client.Invoke(new Contacts_AddContact { @@ -2000,7 +2000,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -5643,12 +5643,16 @@ namespace TL }); /// Uploads a Telegram Story. See Possible codes: 400 (details) - /// If set, disables forwards and story download functionality. + /// Whether to add the story to the profile automatically upon expiration. If not set, the story will only be added to the archive, see here » for more info. + /// If set, disables forwards, screenshots, and downloads. /// The peer to send the story as. - /// The media file. + /// The story media. + /// Media areas associated to the story, see here » for more info. /// Story caption. /// Message entities for styled text + /// Privacy rules for the story, indicating who can or can't view the story. /// Unique client message ID required to prevent message resending. You can use + /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) => client.Invoke(new Stories_SendStory { @@ -5667,9 +5671,10 @@ namespace TL /// Peer where the story was posted. /// ID of story to edit. /// If specified, replaces the story media. + /// Media areas associated to the story, see here » for more info. /// If specified, replaces the story caption. /// Message entities for styled text in the caption - /// If specified, alters the privacy settings of the story. + /// If specified, alters the privacy settings » of the story, changing who can or can't view the story. public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index effd431..3e31293 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -721,7 +721,7 @@ namespace TL public string title; /// Address public string address; - /// Venue provider: currently only "foursquare" needs to be supported + /// Venue provider: currently only "foursquare" and "gplaces" (Google Places) need to be supported public string provider; /// Venue ID in the provider's database public string venue_id; From 4a1b2f5f914f683ab49d3e3a6a1d1cc75b53f66e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:05:39 +0200 Subject: [PATCH 130/336] Fix #197: wrong MD5 encoding in UploadFileAsync --- src/Client.Helpers.cs | 5 ++--- src/Helpers.cs | 2 +- src/TL.Schema.cs | 6 +++--- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 9c7eafa..29c2eef 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Reflection; using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; @@ -40,7 +39,7 @@ namespace WTelegram { bool hasLength = stream.CanSeek; long transmitted = 0, length = hasLength ? stream.Length : -1; - bool isBig = hasLength ? length >= 10 * 1024 * 1024 : true; + bool isBig = !hasLength || length >= 10 * 1024 * 1024; int file_total_parts = hasLength ? (int)((length - 1) / FilePartSize) + 1 : -1; long file_id = Helpers.RandomLong(); int file_part = 0, read; @@ -92,7 +91,7 @@ namespace WTelegram await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception if (!isBig) md5.TransformFinalBlock(Array.Empty(), 0, 0); return isBig ? new InputFileBig { id = file_id, parts = file_total_parts, name = filename } - : new InputFile { id = file_id, parts = file_total_parts, name = filename, md5_checksum = md5.Hash }; + : new InputFile { id = file_id, parts = file_total_parts, name = filename, md5_checksum = Convert.ToHexString(md5.Hash).ToLower() }; } } diff --git a/src/Helpers.cs b/src/Helpers.cs index 3231d95..50b445e 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -241,7 +241,7 @@ namespace WTelegram public long? ContentLength; protected readonly Stream _innerStream; public override bool CanRead => _innerStream.CanRead; - public override bool CanSeek => _innerStream.CanSeek; + public override bool CanSeek => ContentLength.HasValue || _innerStream.CanSeek; public override bool CanWrite => _innerStream.CanWrite; public override long Length => ContentLength ?? _innerStream.Length; public override long Position { get => _innerStream.Position; set => _innerStream.Position = value; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6efec45..eff054b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -150,7 +150,7 @@ namespace TL /// Full name of the file public string name; /// In case the file's md5-hash was passed, contents of the file will be checked prior to use - public byte[] md5_checksum; + public string md5_checksum; /// Random file identifier created by the client public override long ID { get => id; set => id = value; } @@ -5481,7 +5481,7 @@ namespace TL /// Number of saved parts public int parts; /// In case md5-HASH of the (already encrypted) file was transmitted, file content will be checked prior to use - public byte[] md5_checksum; + public string md5_checksum; /// 32-bit fingerprint of the key used to encrypt a file public int key_fingerprint; @@ -10806,7 +10806,7 @@ namespace TL /// Secure file part count public int parts; /// MD5 hash of encrypted uploaded file, to be checked server-side - public byte[] md5_checksum; + public string md5_checksum; /// File hash public byte[] file_hash; /// Secret From 136df62b8f448639c0a6338fe5ec5dd70e5fbd9d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Oct 2023 17:33:25 +0200 Subject: [PATCH 131/336] =?UTF-8?q?UploadFileAsync:=20just=20get=20rid=20o?= =?UTF-8?q?f=20MD5=20altogether.=20It=20works=20just=20fine=20=F0=9F=A4=B7?= =?UTF-8?q?=F0=9F=8F=BB=E2=80=8D=E2=99=82=EF=B8=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.Helpers.cs | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 29c2eef..005bab0 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -2,7 +2,6 @@ using System.Collections.Generic; using System.IO; using System.Linq; -using System.Security.Cryptography; using System.Threading; using System.Threading.Tasks; using TL; @@ -34,7 +33,6 @@ namespace WTelegram /// an or than can be used in various requests public async Task UploadFileAsync(Stream stream, string filename, ProgressCallback progress = null) { - using var md5 = MD5.Create(); using (stream) { bool hasLength = stream.CanSeek; @@ -60,8 +58,6 @@ namespace WTelegram } var task = SavePart(file_part, bytes); lock (tasks) tasks[file_part] = task; - if (!isBig) - md5.TransformBlock(bytes, 0, read, null, 0); if (read < FilePartSize && bytesLeft != 0) throw new WTException($"Failed to fully read stream ({read},{bytesLeft})"); async Task SavePart(int file_part, byte[] bytes) @@ -89,9 +85,8 @@ namespace WTelegram Task[] remainingTasks; lock (tasks) remainingTasks = tasks.Values.ToArray(); await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception - if (!isBig) md5.TransformFinalBlock(Array.Empty(), 0, 0); return isBig ? new InputFileBig { id = file_id, parts = file_total_parts, name = filename } - : new InputFile { id = file_id, parts = file_total_parts, name = filename, md5_checksum = Convert.ToHexString(md5.Hash).ToLower() }; + : new InputFile { id = file_id, parts = file_total_parts, name = filename }; } } From eb375824e4ba9a3483c29dac3d0b5f45731bc4f5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:16:48 +0200 Subject: [PATCH 132/336] api doc --- EXAMPLES.md | 4 ++-- src/TL.Schema.cs | 22 ++++++++++++++-------- src/TL.SchemaFuncs.cs | 41 ++++++++++++++++++++++++++++------------- 3 files changed, 44 insertions(+), 23 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 2687469..55d5768 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -454,8 +454,8 @@ finally Many API calls return a structure with a `users` and a `chats` field at the root of the structure. This is also the case for updates passed to `client.OnUpdate`. -These two dictionaries give details about the various users/chats that will be typically referenced in subobjects deeper in the structure, -typically in the form of a `Peer` object or a `user_id` field. +These two dictionaries give details *(including access hash)* about the various users/chats that will be typically referenced in subobjects deeper in the structure, +typically in the form of a `Peer` object or a `user_id`/`chat_id` field. In such case, the root structure inherits the `IPeerResolver` interface, and you can use the `UserOrChat(peer)` method to resolve a `Peer` into either a `User` or `ChatBase` (`Chat`,`Channel`...) description structure *(depending on the kind of peer it was describing)* diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index eff054b..3a0fedf 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -827,6 +827,7 @@ namespace TL /// Whether we can edit the profile picture, name, about text and description of this bot because we own it. bot_can_edit = 0x2, close_friend = 0x4, + /// Whether we have hidden » all active stories of this user. stories_hidden = 0x8, stories_unavailable = 0x10, /// Field has a value @@ -2792,7 +2793,7 @@ namespace TL } } - /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat bar See + /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat action bar », see here » for more info. See [TLDef(0xA518110D)] public class PeerSettings : IObject { @@ -3639,7 +3640,7 @@ namespace TL has_pts = 0x1, } } - /// A new channel is available See + /// A new channel or supergroup is available, or info about an existing channel has changed and must be refeteched. See [TLDef(0x635B4C09)] public class UpdateChannel : Update { @@ -4249,19 +4250,20 @@ namespace TL /// Message ID of latest read outgoing message for this thread public int read_max_id; } - /// A peer was blocked See + /// We blocked a peer, see here » for more info on blocklists. See [TLDef(0xEBE07752)] public class UpdatePeerBlocked : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The blocked peer + /// The (un)blocked peer public Peer peer_id; [Flags] public enum Flags : uint { /// Whether the peer was blocked or unblocked blocked = 0x1, + /// Whether the peer was added/removed to/from the story blocklist; if not set, this update affects the main blocklist, see here » for more info. blocked_my_stories_from = 0x2, } } @@ -5913,7 +5915,7 @@ namespace TL [TLDef(0x2F453E49)] public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } - /// Privacy rules together with privacy indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , + /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , public abstract class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -15276,15 +15278,17 @@ namespace TL public Dictionary users; } - /// See Derived classes: , + /// Contains info about a message or story to reply to. See Derived classes: , public abstract class InputReplyTo : IObject { } - /// See + /// Reply to a message. See [TLDef(0x9C5386E4)] public class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The message ID to reply to. public int reply_to_msg_id; + /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic.
[IfFlag(0)] public int top_msg_id; [Flags] public enum Flags : uint @@ -15293,11 +15297,13 @@ namespace TL has_top_msg_id = 0x1, } } - ///
See + /// Reply to a story. See [TLDef(0x15B0F283)] public class InputReplyToStory : InputReplyTo { + /// ID of the user that posted the story. public InputUserBase user_id; + /// ID of the story to reply to. public int story_id; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ca756c0..37046e4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1224,8 +1224,9 @@ namespace TL phones = phones, }); - /// Adds the user to the blacklist. See Possible codes: 400 (details) - /// User ID + /// Adds a peer to a blocklist, see here » for more info. See Possible codes: 400 (details) + /// Whether the peer should be added to the story blocklist; if not set, the peer will be added to the main blocklist, see here » for more info. + /// Peer public static Task Contacts_Block(this Client client, InputPeer id, bool my_stories_from = false) => client.Invoke(new Contacts_Block { @@ -1233,8 +1234,9 @@ namespace TL id = id, }); - /// Deletes the user from the blacklist. See Possible codes: 400 (details) - /// User ID + /// Deletes a peer from a blocklist, see here » for more info. See Possible codes: 400 (details) + /// Whether the peer should be removed from the story blocklist; if not set, the peer will be removed from the main blocklist, see here » for more info. + /// Peer public static Task Contacts_Unblock(this Client client, InputPeer id, bool my_stories_from = false) => client.Invoke(new Contacts_Unblock { @@ -1243,6 +1245,7 @@ namespace TL }); /// Returns the list of blocked users. See + /// Whether to fetch the story blocklist; if not set, will fetch the main blocklist. See here » for differences between the two. /// The number of list elements to be skipped /// The number of list elements to be returned public static Task Contacts_GetBlocked(this Client client, int offset = default, int limit = int.MaxValue, bool my_stories_from = false) @@ -1339,7 +1342,7 @@ namespace TL phone = phone, }); - /// If the of a new user allow us to add them as contact, add that user as contact See Possible codes: 400 (details) + /// If the add contact action bar is active, add that user as contact See Possible codes: 400 (details) /// The user to add as contact public static Task Contacts_AcceptContact(this Client client, InputUserBase id) => client.Invoke(new Contacts_AcceptContact @@ -1347,7 +1350,7 @@ namespace TL id = id, }); - /// Get contacts near you See Possible codes: 400,406 (details) + /// Get users and geochats near you, see here » for more info. See Possible codes: 400,406 (details) /// While the geolocation of the current user is public, clients should update it in the background every half-an-hour or so, while setting this flag.
Do this only if the new location is more than 1 KM away from the previous one, or if the previous location is unknown. /// Geolocation /// If set, the geolocation of the current user will be public for the specified number of seconds; pass 0x7fffffff to disable expiry, 0 to make the current geolocation private; if the flag isn't set, no changes will be applied. @@ -1393,14 +1396,17 @@ namespace TL token = token, }); - /// See + /// Edit the close friends list, see here » for more info. See + /// Full list of user IDs of close friends, see here for more info. public static Task Contacts_EditCloseFriends(this Client client, params long[] id) => client.Invoke(new Contacts_EditCloseFriends { id = id, }); - /// See + /// Replace the contents of an entire blocklist, see here for more info ». See + /// Whether to edit the story blocklist; if not set, will edit the main blocklist. See here » for differences between the two. + /// Full content of the blocklist. /// Maximum number of results to return, see pagination public static Task Contacts_SetBlocked(this Client client, InputPeer[] id, int limit = int.MaxValue, bool my_stories_from = false) => client.Invoke(new Contacts_SetBlocked @@ -1559,6 +1565,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination where the message will be sent + /// If set, indicates that the message should be sent in reply to the specified message or story. /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons @@ -1586,6 +1593,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// Destination + /// If set, indicates that the message should be sent in reply to the specified message or story. /// Attached media /// Caption /// Random ID to avoid resending the same message You can use @@ -2119,6 +2127,7 @@ namespace TL /// Whether to clear the draft /// Whether to hide the via @botname in the resulting message (only for bot usernames encountered in the ) /// Destination + /// If set, indicates that the message should be sent in reply to the specified message or story. /// Random ID to avoid resending the same query You can use /// Query ID from Messages_GetInlineBotResults /// Result ID from Messages_GetInlineBotResults @@ -2472,6 +2481,7 @@ namespace TL /// Notify the other user in a private chat that a screenshot of the chat was taken See Possible codes: 400 (details) /// Other user + /// Indicates the message that was screenshotted (the specified message ID can also be 0 to avoid indicating any specific message). /// Random ID to avoid message resending You can use public static Task Messages_SendScreenshotNotification(this Client client, InputPeer peer, InputReplyTo reply_to, long random_id) => client.Invoke(new Messages_SendScreenshotNotification @@ -2551,6 +2561,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// The destination chat + /// If set, indicates that the message should be sent in reply to the specified message or story. /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer @@ -2761,7 +2772,7 @@ namespace TL url = url, }); - /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the peer's settings. See + /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ». See /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) => client.Invoke(new Messages_HidePeerSettingsBar @@ -3371,6 +3382,7 @@ namespace TL /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores + /// If set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to the specified message or story. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) => client.Invoke(new Messages_RequestWebView @@ -3391,6 +3403,7 @@ namespace TL /// Dialog where the web app was opened. /// Bot that owns the web app /// Web app interaction ID obtained from Messages_RequestWebView + /// If set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to the specified message or story. /// Open the web app as the specified peer public static Task Messages_ProlongWebView(this Client client, InputPeer peer, InputUserBase bot, long query_id, InputReplyTo reply_to = null, InputPeer send_as = null, bool silent = false) => client.Invoke(new Messages_ProlongWebView @@ -4142,8 +4155,8 @@ namespace TL /// Whether to create a forum /// Channel title /// Channel description - /// Geogroup location - /// Geogroup address + /// Geogroup location, see here » for more info on geogroups. + /// Geogroup address, see here » for more info on geogroups. /// Time-to-live of all messages that will be sent in the supergroup: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. public static Task Channels_CreateChannel(this Client client, string title, string about, InputGeoPoint geo_point = null, string address = null, int? ttl_period = null, bool broadcast = false, bool megagroup = false, bool for_import = false, bool forum = false) => client.Invoke(new Channels_CreateChannel @@ -4387,7 +4400,7 @@ namespace TL password = password, }); - /// Edit location of geogroup See Possible codes: 400 (details) + /// Edit location of geogroup, see here » for more info on geogroups. See Possible codes: 400 (details) /// Geogroup /// New geolocation /// Address string @@ -5863,7 +5876,9 @@ namespace TL { }); - /// See Possible codes: 400 (details) + /// Hide the active stories of a user, preventing them from being displayed on the action bar on the homescreen, see here » for more info. See Possible codes: 400 (details) + /// Peer whose stories should be (un)hidden. + /// Whether to hide or unhide stories. public static Task Stories_TogglePeerStoriesHidden(this Client client, InputPeer peer, bool hidden) => client.Invoke(new Stories_TogglePeerStoriesHidden { From df2b2a79070fbd72d9fe9bc57e3b234ffe0ba6ad Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 28 Oct 2023 23:47:04 +0200 Subject: [PATCH 133/336] API Layer 166: colors/emoji, new quotes, new link previews, distant replies, invert_media, premium boosts/giveaway/gifts... see https://t.me/tginfoen/1760 --- README.md | 2 +- src/Client.Helpers.cs | 2 +- src/TL.Helpers.cs | 1 + src/TL.Schema.cs | 531 ++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 258 ++++++++++++++---- src/TL.Table.cs | 48 ++-- src/WTelegramClient.csproj | 2 +- 7 files changed, 676 insertions(+), 168 deletions(-) diff --git a/README.md b/README.md index a847e48..63e9b2e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-165-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-166-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://www.buymeacoffee.com/wizou) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 005bab0..00f03fa 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -159,7 +159,7 @@ namespace WTelegram { flags = (Message.Flags)sent.flags | (reply_to_msg_id == 0 ? 0 : Message.Flags.has_reply_to) | (peer is InputPeerSelf ? 0 : Message.Flags.has_from_id), id = sent.id, date = sent.date, message = text, entities = sent.entities, media = sent.media, ttl_period = sent.ttl_period, - reply_to = reply_to_msg_id == 0 ? null : new MessageReplyHeader { reply_to_msg_id = reply_to_msg_id }, + reply_to = reply_to_msg_id == 0 ? null : new MessageReplyHeader { reply_to_msg_id = reply_to_msg_id, flags = MessageReplyHeader.Flags.has_reply_to_msg_id }, from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, peer_id = InputToPeer(peer) }; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 25101be..694ac24 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -296,6 +296,7 @@ namespace TL correct_answers = results.results?.Where(pav => pav.flags.HasFlag(PollAnswerVoters.Flags.correct)).Select(pav => pav.option).ToArray(), flags = (results.results != null ? InputMediaPoll.Flags.has_correct_answers : 0) | (results.solution != null ? InputMediaPoll.Flags.has_solution : 0) }; } partial class MessageMediaDice { public override InputMedia ToInputMedia() => new InputMediaDice { emoticon = emoticon }; } + partial class MessageMediaWebPage { public override InputMedia ToInputMedia() => new InputMediaWebPage { flags = (InputMediaWebPage.Flags)((int)flags & 3), url = webpage.Url }; } partial class PhotoBase { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3a0fedf..624c276 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -462,6 +462,20 @@ namespace TL public InputPeer peer; public int id; } + /// See + [TLDef(0xC21B8849)] + public class InputMediaWebPage : InputMedia + { + public Flags flags; + public string url; + + [Flags] public enum Flags : uint + { + force_large_media = 0x1, + force_small_media = 0x2, + optional = 0x4, + } + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -723,7 +737,7 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0xABB5F120)] + [TLDef(0xEB602F25)] public partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -759,6 +773,8 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; [IfFlag(37)] public int stories_max_id; + [IfFlag(39)] public int color; + [IfFlag(38)] public long background_emoji_id; [Flags] public enum Flags : uint { @@ -832,6 +848,10 @@ namespace TL stories_unavailable = 0x10, /// Field has a value has_stories_max_id = 0x20, + /// Field has a value + has_background_emoji_id = 0x40, + /// Field has a value + has_color = 0x80, } } @@ -972,7 +992,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x94F592DB)] + [TLDef(0x1981EA7E)] public partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1004,6 +1024,8 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; [IfFlag(36)] public int stories_max_id; + [IfFlag(38)] public int color; + [IfFlag(37)] public long background_emoji_id; [Flags] public enum Flags : uint { @@ -1070,6 +1092,10 @@ namespace TL stories_unavailable = 0x8, /// Field has a value has_stories_max_id = 0x10, + /// Field has a value + has_background_emoji_id = 0x20, + /// Field has a value + has_color = 0x40, } /// ID of the channel @@ -1674,6 +1700,7 @@ namespace TL has_ttl_period = 0x2000000, /// Whether this message is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera). noforwards = 0x4000000, + invert_media = 0x8000000, } /// ID of the message @@ -1822,11 +1849,20 @@ namespace TL } } /// Preview of webpage See - [TLDef(0xA32DD600)] - public class MessageMediaWebPage : MessageMedia + [TLDef(0xDDF10C3B)] + public partial class MessageMediaWebPage : MessageMedia { + public Flags flags; /// Webpage preview public WebPageBase webpage; + + [Flags] public enum Flags : uint + { + force_large_media = 0x1, + force_small_media = 0x2, + manual = 0x8, + safe = 0x10, + } } /// Venue See [TLDef(0x2EC0533F)] @@ -1947,6 +1983,23 @@ namespace TL via_mention = 0x2, } } + /// See + [TLDef(0x58260664)] + public class MessageMediaGiveaway : MessageMedia + { + public Flags flags; + public long[] channels; + [IfFlag(1)] public string[] countries_iso2; + public int quantity; + public int months; + public DateTime until_date; + + [Flags] public enum Flags : uint + { + only_new_subscribers = 0x1, + has_countries_iso2 = 0x2, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2346,6 +2399,25 @@ namespace TL /// The user applied a wallpaper » previously sent by the other user in a message. See [TLDef(0xC0787D6D)] public class MessageActionSetSameChatWallPaper : MessageActionSetChatWallPaper { } + /// See + [TLDef(0xD2CFDB0E)] + public class MessageActionGiftCode : MessageAction + { + public Flags flags; + [IfFlag(1)] public Peer boost_peer; + public int months; + public string slug; + + [Flags] public enum Flags : uint + { + via_giveaway = 0x1, + has_boost_peer = 0x2, + unclaimed = 0x4, + } + } + /// See + [TLDef(0x332BA9ED)] + public class MessageActionGiveawayLaunch : MessageAction { } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -3536,6 +3608,7 @@ namespace TL popup = 0x1, /// Field has a value has_inbox_date = 0x2, + invert_media = 0x4, } } /// Privacy rules were changed See @@ -6147,28 +6220,47 @@ namespace TL { /// Preview ID public virtual long ID { get; } + public virtual string Url { get; } } /// No preview is available for the webpage See - [TLDef(0xEB1477E8)] + [TLDef(0x211A1788)] public class WebPageEmpty : WebPageBase { + public Flags flags; /// Preview ID public long id; + [IfFlag(0)] public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_url = 0x1, + } /// Preview ID public override long ID => id; + public override string Url => url; } /// A preview of the webpage is currently being generated See - [TLDef(0xC586DA1C)] + [TLDef(0xB0D13E47)] public class WebPagePending : WebPageBase { + public Flags flags; /// ID of preview public long id; + [IfFlag(0)] public string url; /// When was the processing started public DateTime date; + [Flags] public enum Flags : uint + { + /// Field has a value + has_url = 0x1, + } + /// ID of preview public override long ID => id; + public override string Url => url; } /// Webpage preview See [TLDef(0xE89C45B2)] @@ -6239,10 +6331,13 @@ namespace TL has_cached_page = 0x400, /// Field has a value has_attributes = 0x1000, + has_large_media = 0x2000, } /// Preview ID public override long ID => id; + /// URL of previewed webpage + public override string Url => url; } /// The preview of the webpage hasn't changed See [TLDef(0x7311CA11)] @@ -6492,7 +6587,7 @@ namespace TL public ChatBase chat; } /// Chat invite info See - [TLDef(0x300C44C1)] + [TLDef(0xCDE0EC40)] public class ChatInvite : ChatInviteBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -6507,6 +6602,7 @@ namespace TL public int participants_count; /// A few of the participants that are in the group [IfFlag(4)] public UserBase[] participants; + public int color; [Flags] public enum Flags : uint { @@ -6633,6 +6729,7 @@ namespace TL emojis = 0x80, /// Field has a value has_thumb_document_id = 0x100, + text_color = 0x200, } } @@ -7040,9 +7137,6 @@ namespace TL /// Message entity representing strikethrough text. See [TLDef(0xBF0693D4)] public class MessageEntityStrike : MessageEntity { } - /// Message entity representing a block quote. See - [TLDef(0x020DF5D0)] - public class MessageEntityBlockquote : MessageEntity { } /// Indicates a credit card number See [TLDef(0x761E6AF4)] public class MessageEntityBankCard : MessageEntity { } @@ -7056,6 +7150,9 @@ namespace TL /// Document ID of the custom emoji, use Messages_GetCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. public long document_id; } + /// Message entity representing a block quote. See + [TLDef(0x020DF5D0)] + public class MessageEntityBlockquote : MessageEntity { } /// Represents a channel See Derived classes: , /// a value means inputChannelEmpty @@ -7469,6 +7566,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + invert_media = 0x8, } } /// Simple text message See @@ -7492,6 +7590,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + invert_media = 0x8, } } /// Geolocation See @@ -7619,6 +7718,26 @@ namespace TL has_reply_markup = 0x4, } } + /// See + [TLDef(0xBDDCC510)] + public class InputBotInlineMessageMediaWebPage : InputBotInlineMessage + { + public Flags flags; + public string message; + [IfFlag(1)] public MessageEntity[] entities; + public string url; + [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags : uint + { + has_entities = 0x2, + has_reply_markup = 0x4, + invert_media = 0x8, + force_large_media = 0x10, + force_small_media = 0x20, + optional = 0x40, + } + } /// Inline bot result See Derived classes: , , , public abstract class InputBotInlineResultBase : IObject @@ -7758,6 +7877,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + invert_media = 0x8, } } /// Send a simple text message See @@ -7781,6 +7901,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + invert_media = 0x8, } } /// Send a geolocation See @@ -7893,6 +8014,27 @@ namespace TL test = 0x8, } } + /// See + [TLDef(0x809AD9A6)] + public class BotInlineMessageMediaWebPage : BotInlineMessage + { + public Flags flags; + public string message; + [IfFlag(1)] public MessageEntity[] entities; + public string url; + [IfFlag(2)] public ReplyMarkup reply_markup; + + [Flags] public enum Flags : uint + { + has_entities = 0x2, + has_reply_markup = 0x4, + invert_media = 0x8, + force_large_media = 0x10, + force_small_media = 0x20, + manual = 0x80, + safe = 0x100, + } + } /// Results of an inline query See Derived classes: , public abstract class BotInlineResultBase : IObject @@ -8404,28 +8546,31 @@ namespace TL } } /// Represents a message draft. See - [TLDef(0xFD8E711F)] + [TLDef(0x3FCCF7EF)] public class DraftMessage : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The message this message will reply to - [IfFlag(0)] public int reply_to_msg_id; + [IfFlag(4)] public InputReplyTo reply_to; /// The draft public string message; /// Message entities for styled text. [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(5)] public InputMedia media; /// Date of last update of the draft. public DateTime date; [Flags] public enum Flags : uint { - /// Field has a value - has_reply_to_msg_id = 0x1, /// Whether no webpage preview will be generated no_webpage = 0x2, /// Field has a value has_entities = 0x8, + /// Field has a value + has_reply_to = 0x10, + /// Field has a value + has_media = 0x20, + invert_media = 0x40, } } @@ -10470,6 +10615,20 @@ namespace TL /// Whether antispam functionality was enabled or disabled. public bool new_value; } + /// See + [TLDef(0x3C2B247B)] + public class ChannelAdminLogEventActionChangeColor : ChannelAdminLogEventAction + { + public int prev_value; + public int new_value; + } + /// See + [TLDef(0x445FC434)] + public class ChannelAdminLogEventActionChangeBackgroundEmoji : ChannelAdminLogEventAction + { + public long prev_value; + public long new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -12945,17 +13104,21 @@ namespace TL /// Reply information See Derived classes: , public abstract class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See - [TLDef(0xA6D57763)] + [TLDef(0x6EEBCABD)] public class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of message to which this message is replying - public int reply_to_msg_id; + [IfFlag(4)] public int reply_to_msg_id; /// For replies sent in channel discussion threads of which the current user is not a member, the discussion group ID [IfFlag(0)] public Peer reply_to_peer_id; + [IfFlag(5)] public MessageFwdHeader reply_from; + [IfFlag(8)] public MessageMedia reply_media; /// ID of the message that started this message thread [IfFlag(1)] public int reply_to_top_id; + [IfFlag(6)] public string quote_text; + [IfFlag(7)] public MessageEntity[] quote_entities; [Flags] public enum Flags : uint { @@ -12967,6 +13130,17 @@ namespace TL reply_to_scheduled = 0x4, /// Whether this message was sent in a forum topic (except for the General topic). forum_topic = 0x8, + /// Field has a value + has_reply_to_msg_id = 0x10, + /// Field has a value + has_reply_from = 0x20, + /// Field has a value + has_quote_text = 0x40, + /// Field has a value + has_quote_entities = 0x80, + /// Field has a value + has_reply_media = 0x100, + quote = 0x200, } } /// See @@ -14107,6 +14281,13 @@ namespace TL /// The invoice slug public string slug; } + /// See + [TLDef(0x98986C0D)] + public class InputInvoicePremiumGiftCode : InputInvoice + { + public InputStorePaymentPurpose purpose; + public PremiumGiftCodeOption option; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -14180,6 +14361,41 @@ namespace TL /// 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 amount; } + /// See + [TLDef(0xA3805F3F)] + public class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose + { + public Flags flags; + public InputUserBase[] users; + [IfFlag(0)] public InputPeer boost_peer; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + has_boost_peer = 0x1, + } + } + /// See + [TLDef(0x7C9375E6)] + public class InputStorePaymentPremiumGiveaway : InputStorePaymentPurpose + { + public Flags flags; + public InputPeer boost_peer; + [IfFlag(1)] public InputPeer[] additional_peers; + [IfFlag(2)] public string[] countries_iso2; + public long random_id; + public DateTime until_date; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + only_new_subscribers = 0x1, + has_additional_peers = 0x2, + has_countries_iso2 = 0x4, + } + } /// Telegram Premium gift option See [TLDef(0x74C34319)] @@ -15281,7 +15497,7 @@ namespace TL /// Contains info about a message or story to reply to. See Derived classes: , public abstract class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0x9C5386E4)] + [TLDef(0x073EC805)] public class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15290,11 +15506,20 @@ namespace TL public int reply_to_msg_id; /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic.
[IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer reply_to_peer_id; + [IfFlag(2)] public string quote_text; + [IfFlag(3)] public MessageEntity[] quote_entities; [Flags] public enum Flags : uint { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_reply_to_peer_id = 0x2, + /// Field has a value + has_quote_text = 0x4, + /// Field has a value + has_quote_entities = 0x8, } } ///
Reply to a story. See @@ -15436,82 +15661,6 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// The current boost status » of a channel. See - [TLDef(0xE5C1AA5C)] - public class Stories_BoostsStatus : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// The current boost level of the channel. - public int level; - /// The number of boosts acquired so far in the current level. - public int current_level_boosts; - /// Total number of boosts acquired so far. - public int boosts; - /// Total number of boosts needed to reach the next level; if absent, the next level isn't available. - [IfFlag(0)] public int next_level_boosts; - /// Only returned to channel admins: contains the approximated number of Premium users subscribed to the channel, related to the total number of subscribers. - [IfFlag(1)] public StatsPercentValue premium_audience; - public string boost_url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_next_level_boosts = 0x1, - /// Field has a value - has_premium_audience = 0x2, - /// Whether we're currently boosting this channel. - my_boost = 0x4, - } - } - - /// Whether the specified channel can be boosted, see here for more info ». See Derived classes: , - public abstract class Stories_CanApplyBoostResult : IObject { } - /// We're not boosting any channel, and we can freely boost the specified channel. See - [TLDef(0xC3173587)] - public class Stories_CanApplyBoostOk : Stories_CanApplyBoostResult { } - /// We're boosting another channel, but we can freely boost the specified channel. See - [TLDef(0x712C4655)] - public class Stories_CanApplyBoostReplace : Stories_CanApplyBoostResult - { - /// The channel we're currently boosting. - public Peer current_boost; - /// Channel information. - public Dictionary chats; - } - - /// Info about a boost made by a specific user. See - [TLDef(0x0E9E6380)] - public class Booster : IObject - { - /// ID of the user that made the boost. - public long user_id; - /// Default expiration date of the boost. - public DateTime expires; - } - - /// Info about the users currently boosting the channel. See - [TLDef(0xF3DD3D1D)] - public class Stories_BoostersList : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Total number of boosters. - public int count; - /// Info about the automatic expiration date of every user's boost. - public Booster[] boosters; - /// Next offset for pagination. - [IfFlag(0)] public string next_offset; - /// Info about the users mentioned in the boosters field. - public Dictionary users; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_next_offset = 0x1, - } - } - /// See [TLDef(0xFD5E12BD)] public class Messages_WebPage : IObject, IPeerResolver @@ -15522,4 +15671,198 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0x257E962B)] + public class PremiumGiftCodeOption : IObject + { + public Flags flags; + public int users; + public int months; + [IfFlag(0)] public string store_product; + [IfFlag(1)] public int store_quantity; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + has_store_quantity = 0x2, + } + } + + /// See + [TLDef(0xB722F158)] + public class Payments_CheckedGiftCode : IObject, IPeerResolver + { + public Flags flags; + public Peer from_id; + [IfFlag(3)] public int giveaway_msg_id; + [IfFlag(0)] public long to_id; + public DateTime date; + public int months; + [IfFlag(1)] public DateTime used_date; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_to_id = 0x1, + has_used_date = 0x2, + via_giveaway = 0x4, + has_giveaway_msg_id = 0x8, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + public abstract class Payments_GiveawayInfoBase : IObject + { + public virtual DateTime StartDate { get; } + } + /// See + [TLDef(0x4367DAA0)] + public class Payments_GiveawayInfo : Payments_GiveawayInfoBase + { + public Flags flags; + public DateTime start_date; + [IfFlag(1)] public DateTime joined_too_early_date; + [IfFlag(2)] public long admin_disallowed_chat_id; + [IfFlag(4)] public string disallowed_country; + + [Flags] public enum Flags : uint + { + participating = 0x1, + has_joined_too_early_date = 0x2, + has_admin_disallowed_chat_id = 0x4, + preparing_results = 0x8, + has_disallowed_country = 0x10, + } + + public override DateTime StartDate => start_date; + } + /// See + [TLDef(0x00CD5570)] + public class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase + { + public Flags flags; + public DateTime start_date; + [IfFlag(0)] public string gift_code_slug; + public DateTime finish_date; + public int winners_count; + public int activated_count; + + [Flags] public enum Flags : uint + { + winner = 0x1, + refunded = 0x2, + } + + public override DateTime StartDate => start_date; + } + + /// See + [TLDef(0xB2539D54)] + public class PrepaidGiveaway : IObject + { + public long id; + public int months; + public int quantity; + public DateTime date; + } + + /// See + [TLDef(0x2A1C8C71)] + public class Boost : IObject + { + public Flags flags; + public string id; + [IfFlag(0)] public long user_id; + [IfFlag(2)] public int giveaway_msg_id; + public DateTime date; + public DateTime expires; + [IfFlag(4)] public string used_gift_slug; + [IfFlag(5)] public int multiplier; + + [Flags] public enum Flags : uint + { + has_user_id = 0x1, + gift = 0x2, + giveaway = 0x4, + unclaimed = 0x8, + has_used_gift_slug = 0x10, + has_multiplier = 0x20, + } + } + + /// See + [TLDef(0x86F8613C)] + public class Premium_BoostsList : IObject + { + public Flags flags; + public int count; + public Boost[] boosts; + [IfFlag(0)] public string next_offset; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0xC448415C)] + public class MyBoost : IObject + { + public Flags flags; + public int slot; + [IfFlag(0)] public Peer peer; + public DateTime date; + public DateTime expires; + [IfFlag(1)] public DateTime cooldown_until_date; + + [Flags] public enum Flags : uint + { + has_peer = 0x1, + has_cooldown_until_date = 0x2, + } + } + + /// See + [TLDef(0x9AE228E2)] + public class Premium_MyBoosts : IObject, IPeerResolver + { + public MyBoost[] my_boosts; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x4959427A)] + public class Premium_BoostsStatus : IObject + { + public Flags flags; + public int level; + public int current_level_boosts; + public int boosts; + [IfFlag(4)] public int gift_boosts; + [IfFlag(0)] public int next_level_boosts; + [IfFlag(1)] public StatsPercentValue premium_audience; + public string boost_url; + [IfFlag(3)] public PrepaidGiveaway[] prepaid_giveaways; + [IfFlag(2)] public int[] my_boost_slots; + + [Flags] public enum Flags : uint + { + has_next_level_boosts = 0x1, + has_premium_audience = 0x2, + my_boost = 0x4, + has_prepaid_giveaways = 0x8, + has_gift_boosts = 0x10, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 37046e4..e15a205 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1151,6 +1151,23 @@ namespace TL codes = codes, }); + /// See + public static Task Account_UpdateColor(this Client client, int color, long? background_emoji_id = null) + => client.Invoke(new Account_UpdateColor + { + flags = (Account_UpdateColor.Flags)(background_emoji_id != null ? 0x1 : 0), + color = color, + background_emoji_id = background_emoji_id.GetValueOrDefault(), + }); + + /// See + /// a null value means emojiListNotModified + public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default) + => client.Invoke(new Account_GetDefaultBackgroundEmojis + { + hash = hash, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1572,10 +1589,10 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1601,10 +1618,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -2165,10 +2182,10 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, bool no_webpage = false) + public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditMessage { - flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (no_webpage ? 0x2 : 0)), + flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, id = id, message = message, @@ -2185,10 +2202,10 @@ namespace TL /// Media /// Reply markup for inline keyboards /// Message entities for styled text - public static Task Messages_EditInlineBotMessage(this Client client, InputBotInlineMessageIDBase id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, bool no_webpage = false) + public static Task Messages_EditInlineBotMessage(this Client client, InputBotInlineMessageIDBase id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditInlineBotMessage { - flags = (Messages_EditInlineBotMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (no_webpage ? 0x2 : 0)), + flags = (Messages_EditInlineBotMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), id = id, message = message, media = media, @@ -2238,20 +2255,18 @@ namespace TL /// Save a message draft associated to a chat. See Possible codes: 400 (details) /// Disable generation of the webpage preview - /// Message ID the message should reply to - /// Forum topic where the message will be sent /// Destination of the message that should be sent /// The draft /// Message entities for styled text - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, int? reply_to_msg_id = null, int? top_msg_id = null, MessageEntity[] entities = null, bool no_webpage = false) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((reply_to_msg_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (no_webpage ? 0x2 : 0)), - reply_to_msg_id = reply_to_msg_id.GetValueOrDefault(), - top_msg_id = top_msg_id.GetValueOrDefault(), + flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), + reply_to = reply_to, peer = peer, message = message, entities = entities, + media = media, }); /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
@@ -2565,10 +2580,10 @@ namespace TL /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, multi_media = multi_media, @@ -4672,6 +4687,16 @@ namespace TL random_id = random_id, }); + /// See + public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, int color, long? background_emoji_id = null) + => client.Invoke(new Channels_UpdateColor + { + flags = (Channels_UpdateColor.Flags)(background_emoji_id != null ? 0x1 : 0), + channel = channel, + color = color, + background_emoji_id = background_emoji_id.GetValueOrDefault(), + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -4943,6 +4968,45 @@ namespace TL purpose = purpose, }); + /// See + public static Task Payments_GetPremiumGiftCodeOptions(this Client client, InputPeer boost_peer = null) + => client.Invoke(new Payments_GetPremiumGiftCodeOptions + { + flags = (Payments_GetPremiumGiftCodeOptions.Flags)(boost_peer != null ? 0x1 : 0), + boost_peer = boost_peer, + }); + + /// See + public static Task Payments_CheckGiftCode(this Client client, string slug) + => client.Invoke(new Payments_CheckGiftCode + { + slug = slug, + }); + + /// See + public static Task Payments_ApplyGiftCode(this Client client, string slug) + => client.Invoke(new Payments_ApplyGiftCode + { + slug = slug, + }); + + /// See + public static Task Payments_GetGiveawayInfo(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Payments_GetGiveawayInfo + { + peer = peer, + msg_id = msg_id, + }); + + /// See + public static Task Payments_LaunchPrepaidGiveaway(this Client client, InputPeer peer, long giveaway_id, InputStorePaymentPurpose purpose) + => client.Invoke(new Payments_LaunchPrepaidGiveaway + { + peer = peer, + giveaway_id = giveaway_id, + purpose = purpose, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is an animated stickerset @@ -5886,38 +5950,34 @@ namespace TL hidden = hidden, }); - /// Get the current boost status of a channel, see here » for more info on boosts. See Possible codes: 400 (details) - /// The channel - public static Task Stories_GetBoostsStatus(this Client client, InputPeer peer) - => client.Invoke(new Stories_GetBoostsStatus - { - peer = peer, - }); - - /// Obtain info about the users currently boosting a channel, see here » for more info about boosts. See Possible codes: 400 (details) - /// The channel. - /// Next offset for pagination, obtained from the next_offset field of . - /// Maximum number of results to return, see pagination - public static Task Stories_GetBoostersList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue) - => client.Invoke(new Stories_GetBoostersList + /// See + public static Task Premium_GetBoostsList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool gifts = false) + => client.Invoke(new Premium_GetBoostsList { + flags = (Premium_GetBoostsList.Flags)(gifts ? 0x1 : 0), peer = peer, offset = offset, limit = limit, }); - /// Check whether a channel can be boosted, see here for more info ». See Possible codes: 400 (details) - /// The channel to boost. - public static Task Stories_CanApplyBoost(this Client client, InputPeer peer) - => client.Invoke(new Stories_CanApplyBoost + /// See + public static Task Premium_GetMyBoosts(this Client client) + => client.Invoke(new Premium_GetMyBoosts { + }); + + /// See + public static Task Premium_ApplyBoost(this Client client, InputPeer peer, int[] slots = null) + => client.Invoke(new Premium_ApplyBoost + { + flags = (Premium_ApplyBoost.Flags)(slots != null ? 0x1 : 0), + slots = slots, peer = peer, }); - /// Boost » a channel, leveling it up and granting it permission to post stories ». See Possible codes: 400 (details) - /// The channel to boost. - public static Task Stories_ApplyBoost(this Client client, InputPeer peer) - => client.Invoke(new Stories_ApplyBoost + /// See + public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) + => client.Invoke(new Premium_GetBoostsStatus { peer = peer, }); @@ -6804,6 +6864,25 @@ namespace TL.Methods public string[] codes; } + [TLDef(0xA001CC43)] + public class Account_UpdateColor : IMethod + { + public Flags flags; + public int color; + [IfFlag(0)] public long background_emoji_id; + + [Flags] public enum Flags : uint + { + has_background_emoji_id = 0x1, + } + } + + [TLDef(0xA60AB9CE)] + public class Account_GetDefaultBackgroundEmojis : IMethod + { + public long hash; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -7174,6 +7253,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, update_stickersets_order = 0x8000, + invert_media = 0x10000, } } @@ -7203,6 +7283,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, update_stickersets_order = 0x8000, + invert_media = 0x10000, } } @@ -7668,6 +7749,7 @@ namespace TL.Methods has_message = 0x800, has_media = 0x4000, has_schedule_date = 0x8000, + invert_media = 0x10000, } } @@ -7688,6 +7770,7 @@ namespace TL.Methods has_entities = 0x8, has_message = 0x800, has_media = 0x4000, + invert_media = 0x10000, } } @@ -7731,22 +7814,23 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xB4331E3F)] + [TLDef(0x7FF3B806)] public class Messages_SaveDraft : IMethod { public Flags flags; - [IfFlag(0)] public int reply_to_msg_id; - [IfFlag(2)] public int top_msg_id; + [IfFlag(4)] public InputReplyTo reply_to; public InputPeer peer; public string message; [IfFlag(3)] public MessageEntity[] entities; + [IfFlag(5)] public InputMedia media; [Flags] public enum Flags : uint { - has_reply_to_msg_id = 0x1, no_webpage = 0x2, - has_top_msg_id = 0x4, has_entities = 0x8, + has_reply_to = 0x10, + has_media = 0x20, + invert_media = 0x40, } } @@ -8035,6 +8119,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, update_stickersets_order = 0x8000, + invert_media = 0x10000, } } @@ -9702,6 +9787,20 @@ namespace TL.Methods public byte[] random_id; } + [TLDef(0x621A201F)] + public class Channels_UpdateColor : IMethod + { + public Flags flags; + public InputChannelBase channel; + public int color; + [IfFlag(0)] public long background_emoji_id; + + [Flags] public enum Flags : uint + { + has_background_emoji_id = 0x1, + } + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -9929,6 +10028,45 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } + [TLDef(0x2757BA54)] + public class Payments_GetPremiumGiftCodeOptions : IMethod + { + public Flags flags; + [IfFlag(0)] public InputPeer boost_peer; + + [Flags] public enum Flags : uint + { + has_boost_peer = 0x1, + } + } + + [TLDef(0x8E51B4C1)] + public class Payments_CheckGiftCode : IMethod + { + public string slug; + } + + [TLDef(0xF6E26854)] + public class Payments_ApplyGiftCode : IMethod + { + public string slug; + } + + [TLDef(0xF4239425)] + public class Payments_GetGiveawayInfo : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0x5FF58F20)] + public class Payments_LaunchPrepaidGiveaway : IMethod + { + public InputPeer peer; + public long giveaway_id; + public InputStorePaymentPurpose purpose; + } + [TLDef(0x9021AB67)] public class Stickers_CreateStickerSet : IMethod { @@ -10723,28 +10861,38 @@ namespace TL.Methods public bool hidden; } - [TLDef(0x4C449472)] - public class Stories_GetBoostsStatus : IMethod - { - public InputPeer peer; - } - - [TLDef(0x337EF980)] - public class Stories_GetBoostersList : IMethod + [TLDef(0x60F67660)] + public class Premium_GetBoostsList : IMethod { + public Flags flags; public InputPeer peer; public string offset; public int limit; + + [Flags] public enum Flags : uint + { + gifts = 0x1, + } } - [TLDef(0xDB05C1BD)] - public class Stories_CanApplyBoost : IMethod + [TLDef(0x0BE77B4A)] + public class Premium_GetMyBoosts : IMethod { } + + [TLDef(0x6B7DA746)] + public class Premium_ApplyBoost : IMethod { + public Flags flags; + [IfFlag(0)] public int[] slots; public InputPeer peer; + + [Flags] public enum Flags : uint + { + has_slots = 0x1, + } } - [TLDef(0xF29D7C2B)] - public class Stories_ApplyBoost : IMethod + [TLDef(0x042F1F61)] + public class Premium_GetBoostsStatus : IMethod { public InputPeer peer; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 2534795..341e32a 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 = 165; // fetched 04/10/2023 17:10:52 + public const int Version = 166; // fetched 28/10/2023 21:16:53 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -99,6 +99,7 @@ namespace TL [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), [0x89FDD778] = typeof(InputMediaStory), + [0xC21B8849] = typeof(InputMediaWebPage), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -120,7 +121,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0xABB5F120] = typeof(User), + [0xEB602F25] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -132,7 +133,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x94F592DB] = typeof(Channel), + [0x1981EA7E] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), [0x723027BD] = typeof(ChannelFull), @@ -152,7 +153,7 @@ namespace TL [0x70322949] = typeof(MessageMediaContact), [0x9F84F49E] = typeof(MessageMediaUnsupported), [0x4CF4D72D] = typeof(MessageMediaDocument), - [0xA32DD600] = typeof(MessageMediaWebPage), + [0xDDF10C3B] = typeof(MessageMediaWebPage), [0x2EC0533F] = typeof(MessageMediaVenue), [0xFDB19008] = typeof(MessageMediaGame), [0xF6A548D3] = typeof(MessageMediaInvoice), @@ -160,6 +161,7 @@ namespace TL [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), [0x68CB6283] = typeof(MessageMediaStory), + [0x58260664] = typeof(MessageMediaGiveaway), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -199,6 +201,8 @@ namespace TL [0xFE77345D] = typeof(MessageActionRequestedPeer), [0xBC44A927] = typeof(MessageActionSetChatWallPaper), [0xC0787D6D] = typeof(MessageActionSetSameChatWallPaper), + [0xD2CFDB0E] = typeof(MessageActionGiftCode), + [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -484,8 +488,8 @@ namespace TL [0xE86602C3] = null,//Messages_AllStickersNotModified [0xCDBBCEBB] = typeof(Messages_AllStickers), [0x84D19185] = typeof(Messages_AffectedMessages), - [0xEB1477E8] = typeof(WebPageEmpty), - [0xC586DA1C] = typeof(WebPagePending), + [0x211A1788] = typeof(WebPageEmpty), + [0xB0D13E47] = typeof(WebPagePending), [0xE89C45B2] = typeof(WebPage), [0x7311CA11] = typeof(WebPageNotModified), [0xAD01D61D] = typeof(Authorization), @@ -498,7 +502,7 @@ namespace TL [0x0AB4A819] = typeof(ChatInviteExported), [0xED107AB7] = typeof(ChatInvitePublicJoinRequests), [0x5A686D7C] = typeof(ChatInviteAlready), - [0x300C44C1] = typeof(ChatInvite), + [0xCDE0EC40] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), [0xFFB62B95] = null,//InputStickerSetEmpty [0x9DE7A269] = typeof(InputStickerSetID), @@ -553,10 +557,10 @@ namespace TL [0x4C4E743F] = typeof(MessageEntityCashtag), [0x9C4E7E8B] = typeof(MessageEntityUnderline), [0xBF0693D4] = typeof(MessageEntityStrike), - [0x020DF5D0] = typeof(MessageEntityBlockquote), [0x761E6AF4] = typeof(MessageEntityBankCard), [0x32CA960F] = typeof(MessageEntitySpoiler), [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), + [0x020DF5D0] = typeof(MessageEntityBlockquote), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -594,6 +598,7 @@ namespace TL [0xA6EDBFFD] = typeof(InputBotInlineMessageMediaContact), [0x4B425864] = typeof(InputBotInlineMessageGame), [0xD7E78225] = typeof(InputBotInlineMessageMediaInvoice), + [0xBDDCC510] = typeof(InputBotInlineMessageMediaWebPage), [0x88BF9319] = typeof(InputBotInlineResult), [0xA8D864A7] = typeof(InputBotInlineResultPhoto), [0xFFF8FDC4] = typeof(InputBotInlineResultDocument), @@ -604,6 +609,7 @@ namespace TL [0x8A86659C] = typeof(BotInlineMessageMediaVenue), [0x18D1CDC2] = typeof(BotInlineMessageMediaContact), [0x354A9B09] = typeof(BotInlineMessageMediaInvoice), + [0x809AD9A6] = typeof(BotInlineMessageMediaWebPage), [0x11965F3A] = typeof(BotInlineResult), [0x17DB940B] = typeof(BotInlineMediaResult), [0xE021F2F6] = typeof(Messages_BotResults), @@ -630,7 +636,7 @@ namespace TL [0x70B772A8] = typeof(Contacts_TopPeers), [0xB52C939D] = typeof(Contacts_TopPeersDisabled), [0x1B0C841A] = typeof(DraftMessageEmpty), - [0xFD8E711F] = typeof(DraftMessage), + [0x3FCCF7EF] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified @@ -785,6 +791,8 @@ namespace TL [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), [0x64F36DFC] = typeof(ChannelAdminLogEventActionToggleAntiSpam), + [0x3C2B247B] = typeof(ChannelAdminLogEventActionChangeColor), + [0x445FC434] = typeof(ChannelAdminLogEventActionChangeBackgroundEmoji), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -952,7 +960,7 @@ namespace TL [0x455B853D] = typeof(MessageViews), [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), - [0xA6D57763] = typeof(MessageReplyHeader), + [0x6EEBCABD] = typeof(MessageReplyHeader), [0x9C98BFC1] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), @@ -1032,11 +1040,14 @@ namespace TL [0x1F307EB7] = typeof(Account_SavedRingtoneConverted), [0xC5B56859] = typeof(InputInvoiceMessage), [0xC326CAEF] = typeof(InputInvoiceSlug), + [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0x93752C52] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), + [0xA3805F3F] = typeof(InputStorePaymentPremiumGiftCode), + [0x7C9375E6] = typeof(InputStorePaymentPremiumGiveaway), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty @@ -1116,7 +1127,7 @@ namespace TL [0xB0BDEAC5] = typeof(StoryView), [0x46E9B9EC] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0x9C5386E4] = typeof(InputReplyToMessage), + [0x073EC805] = typeof(InputReplyToMessage), [0x15B0F283] = typeof(InputReplyToStory), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), @@ -1127,12 +1138,17 @@ namespace TL [0x14455871] = typeof(MediaAreaSuggestedReaction), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), - [0xE5C1AA5C] = typeof(Stories_BoostsStatus), - [0xC3173587] = typeof(Stories_CanApplyBoostOk), - [0x712C4655] = typeof(Stories_CanApplyBoostReplace), - [0x0E9E6380] = typeof(Booster), - [0xF3DD3D1D] = typeof(Stories_BoostersList), [0xFD5E12BD] = typeof(Messages_WebPage), + [0x257E962B] = typeof(PremiumGiftCodeOption), + [0xB722F158] = typeof(Payments_CheckedGiftCode), + [0x4367DAA0] = typeof(Payments_GiveawayInfo), + [0x00CD5570] = typeof(Payments_GiveawayInfoResults), + [0xB2539D54] = typeof(PrepaidGiveaway), + [0x2A1C8C71] = typeof(Boost), + [0x86F8613C] = typeof(Premium_BoostsList), + [0xC448415C] = typeof(MyBoost), + [0x9AE228E2] = typeof(Premium_MyBoosts), + [0x4959427A] = typeof(Premium_BoostsStatus), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d734d90..a7397e8 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: 165 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 166 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 96ff52fab8709952c760220f159495db0201d88e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 6 Nov 2023 23:58:48 +0100 Subject: [PATCH 134/336] API Layer 166.2: Premium_GetUserBoosts, UpdateBotChatBoost --- .github/dev.yml | 2 +- src/TL.Schema.cs | 8 ++++++++ src/TL.SchemaFuncs.cs | 15 +++++++++++++++ src/TL.Table.cs | 3 ++- 4 files changed, 26 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e20f7e3..dd9224a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.5.8-dev.$(Rev:r) +name: 3.5.9-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 624c276..25049dd 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4777,6 +4777,14 @@ namespace TL public int story_id; public Reaction reaction; } + /// See + [TLDef(0x904DD49C)] + public class UpdateBotChatBoost : Update + { + public Peer peer; + public Boost boost; + public int qts; + } /// Updates state. See [TLDef(0xA56C2A3E)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e15a205..5ff6817 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -5981,6 +5981,14 @@ namespace TL { peer = peer, }); + + /// See + public static Task Premium_GetUserBoosts(this Client client, InputPeer peer, InputUserBase user_id) + => client.Invoke(new Premium_GetUserBoosts + { + peer = peer, + user_id = user_id, + }); } } @@ -10896,4 +10904,11 @@ namespace TL.Methods { public InputPeer peer; } + + [TLDef(0x39854D1F)] + public class Premium_GetUserBoosts : IMethod + { + public InputPeer peer; + public InputUserBase user_id; + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 341e32a..1fc5e29 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 = 166; // fetched 28/10/2023 21:16:53 + public const int Version = 166; // fetched 06/11/2023 22:51:44 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -384,6 +384,7 @@ namespace TL [0x1BF335B9] = typeof(UpdateStoryID), [0x2C084DC1] = typeof(UpdateStoriesStealthMode), [0x7D627683] = typeof(UpdateSentStoryReaction), + [0x904DD49C] = typeof(UpdateBotChatBoost), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), From 3861255710391f0f9a88f3f607d764fc5e36f2cc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 11 Nov 2023 12:25:02 +0100 Subject: [PATCH 135/336] Support additional connection JSON params with Config("init_params") --- .github/dev.yml | 2 +- src/Client.cs | 4 ++++ src/TL.Helpers.cs | 14 +++++++++++++- 3 files changed, 18 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index dd9224a..9d831ea 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.5.9-dev.$(Rev:r) +name: 3.5.10-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 0b15116..67b3f0d 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -143,6 +143,7 @@ namespace WTelegram "lang_code" => CultureInfo.CurrentUICulture.TwoLetterISOLanguageName, "user_id" => "-1", "verification_code" or "email_verification_code" or "password" => AskConfig(what), + "init_params" => "{}", _ => null // api_id api_hash phone_number... it's up to you to reply to these correctly }; @@ -857,9 +858,11 @@ namespace WTelegram await CreateAuthorizationKey(this, _dcSession); var keepAliveTask = KeepAlive(_cts.Token); + var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonSerializer.Deserialize(Config("init_params"))); TLConfig = await this.InvokeWithLayer(Layer.Version, new TL.Methods.InitConnection { + flags = TL.Methods.InitConnection.Flags.has_params, api_id = _session.ApiId, device_model = Config("device_model"), system_version = Config("system_version"), @@ -867,6 +870,7 @@ namespace WTelegram system_lang_code = Config("system_lang_code"), lang_pack = Config("lang_pack"), lang_code = Config("lang_code"), + params_ = initParams, query = new TL.Methods.Help_GetConfig() }); _session.DcOptions = TLConfig.dc_options; diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 694ac24..746a734 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -639,7 +639,19 @@ namespace TL } partial class JsonObjectValue { public override string ToString() => $"{HttpUtility.JavaScriptStringEncode(key, true)}:{value}"; } - partial class JSONValue { public abstract object ToNative(); } + partial class JSONValue { public abstract object ToNative(); + private static JsonObjectValue FromJsonProperty(System.Text.Json.JsonProperty p) => new() { key = p.Name, value = FromJsonElement(p.Value) }; + public static JSONValue FromJsonElement(System.Text.Json.JsonElement elem) => elem.ValueKind switch + { + System.Text.Json.JsonValueKind.True or + System.Text.Json.JsonValueKind.False => new JsonBool { value = elem.GetBoolean() }, + System.Text.Json.JsonValueKind.Object => new JsonObject { value = elem.EnumerateObject().Select(FromJsonProperty).ToArray() }, + System.Text.Json.JsonValueKind.Array => new JsonArray { value = elem.EnumerateArray().Select(FromJsonElement).ToArray() }, + System.Text.Json.JsonValueKind.String => new JsonString { value = elem.GetString() }, + System.Text.Json.JsonValueKind.Number => new JsonNumber { value = elem.GetDouble() }, + _ => new JsonNull(), + }; + } partial class JsonNull { public override object ToNative() => null; public override string ToString() => "null"; } partial class JsonBool { public override object ToNative() => value; public override string ToString() => value ? "true" : "false"; } partial class JsonNumber { public override object ToNative() => value; public override string ToString() => value.ToString(CultureInfo.InvariantCulture); } From 6b44dbae8a4caa7103fc3c3ee8ee963cd99c431d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:36:49 +0100 Subject: [PATCH 136/336] Support blockquotes in HTML/Markdown --- README.md | 5 ++++- src/TL.Extensions.cs | 30 ++++++++++++++++++++++++++---- 2 files changed, 30 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 63e9b2e..e73b22e 100644 --- a/README.md +++ b/README.md @@ -168,7 +168,10 @@ See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. -The other configuration items that you can provide include: **session_pathname, email, email_verification_code, session_key, server_address, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** +To [prevent getting banned](https://wiz0u.github.io/WTelegramClient/FAQ#prevent-ban) during dev, you can connect to [test servers](https://docs.pyrogram.org/topics/test-servers), by adding this line in your Config callback: +`case "server_address": return "149.154.167.40:443"; // test DC` + +The other configuration items that you can provide include: **session_pathname, email, email_verification_code, session_key, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** Optional API parameters have a default value of `null` when unset. Passing `null` for a required string/array is the same as *empty* (0-length). Required API parameters/fields can sometimes be set to 0 or `null` when unused (check API documentation or experiment). diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index dc20256..aef2c56 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -56,6 +56,7 @@ namespace TL public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) { var entities = new List(); + MessageEntityBlockquote lastBlockQuote = null; var sb = new StringBuilder(text); for (int offset = 0; offset < sb.Length;) { @@ -101,6 +102,16 @@ namespace TL else ProcessEntity(); break; + case '>' when offset == 0 || sb[offset - 1] == '\n': + sb.Remove(offset, 1); + if (lastBlockQuote is null || lastBlockQuote.length < offset - lastBlockQuote.offset) + entities.Add(lastBlockQuote = new MessageEntityBlockquote { offset = offset, length = -1 }); + else + lastBlockQuote.length = -1; + break; + case '\n' when lastBlockQuote is { length: -1 }: + lastBlockQuote.length = ++offset - lastBlockQuote.offset; + break; case '!' when offset + 1 < sb.Length && sb[offset + 1] == '[': sb.Remove(offset, 1); goto case '['; @@ -146,6 +157,8 @@ namespace TL sb.Remove(offset, 1); } } + if (lastBlockQuote is { length: -1 }) + lastBlockQuote.length = sb.Length - lastBlockQuote.offset; text = sb.ToString(); return entities.Count == 0 ? null : entities.ToArray(); } @@ -163,16 +176,20 @@ namespace TL var sb = new StringBuilder(message); int entityIndex = 0; var nextEntity = entities[entityIndex]; + bool inBlockQuote = false; + char lastCh = '\0'; for (int offset = 0, i = 0; ; offset++, i++) { while (closings.Count != 0 && offset == closings[0].offset) { var md = closings[0].md; - if (i > 0 && md[0] == '_' && sb[i - 1] == '_') md = '\r' + md; - sb.Insert(i, md); i += md.Length; closings.RemoveAt(0); + if (i > 0 && md[0] == '_' && sb[i - 1] == '_') md = '\r' + md; + if (md[0] == '>') { inBlockQuote = false; if (lastCh != '\n' && i < sb.Length && sb[i] != '\n') md = "\n"; else continue; } + sb.Insert(i, md); i += md.Length; } if (i == sb.Length) break; + if (lastCh == '\n' && inBlockQuote) sb.Insert(i++, '>'); for (; offset == nextEntity?.offset; nextEntity = ++entityIndex < entities.Length ? entities[entityIndex] : null) { if (EntityToMD.TryGetValue(nextEntity.GetType(), out var md)) @@ -190,6 +207,8 @@ namespace TL if (premium) closing.md = $"](tg://emoji?id={mecu.document_id})"; else continue; } + else if (md[0] == '>') + { inBlockQuote = true; if (lastCh is not '\n' and not '\0') md = "\n>"; } else if (nextEntity is MessageEntityPre mep) md = $"```{mep.language}\n"; int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1)); @@ -198,11 +217,11 @@ namespace TL sb.Insert(i, md); i += md.Length; } } - switch (sb[i]) + switch (lastCh = sb[i]) { case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': - sb.Insert(i, '\\'); i++; + sb.Insert(i++, '\\'); break; } } @@ -222,6 +241,7 @@ namespace TL [typeof(MessageEntityStrike)] = "~", [typeof(MessageEntitySpoiler)] = "||", [typeof(MessageEntityCustomEmoji)] = "![", + [typeof(MessageEntityBlockquote)] = ">", }; /// Insert backslashes in front of Markdown reserved characters @@ -295,6 +315,7 @@ namespace TL case "code": ProcessEntity(); break; case "pre": ProcessEntity(); break; case "tg-emoji" when closing: ProcessEntity(); break; + case "blockquote": ProcessEntity(); break; default: if (closing) { @@ -412,6 +433,7 @@ namespace TL [typeof(MessageEntityStrike)] = "s", [typeof(MessageEntitySpoiler)] = "tg-spoiler", [typeof(MessageEntityCustomEmoji)] = "tg-emoji", + [typeof(MessageEntityBlockquote)] = "blockquote", }; /// Replace special HTML characters with their &xx; equivalent From 35f2f2530a7168dc8bf331170af0da4170ed3f8d Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 17 Nov 2023 18:37:22 +0100 Subject: [PATCH 137/336] SendMessageAsync preview param changed to support above/below/disabled --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.Helpers.cs | 8 +++++--- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 9d831ea..e1f441f 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.5.10-dev.$(Rev:r) +name: 3.6.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 7b1774a..0b50ce6 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.5.$(Rev:r) +name: 3.6.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 00f03fa..ab45b4e 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -133,6 +133,7 @@ namespace WTelegram return SendMessageAsync(peer, caption, new InputMediaUploadedDocument(mediaFile, mimeType), reply_to_msg_id, entities, schedule_date); } + public enum LinkPreview { Disabled = 0, BelowText = 1, AboveText = 2 }; /// Helper function to send a text or media message easily /// Destination of message (chat group, channel, user chat, etc..) /// The plain text of the message (or media caption) @@ -140,14 +141,15 @@ namespace WTelegram /// Your message is a reply to an existing message with this ID, in the same chat /// Text formatting entities. You can use HtmlToEntities or MarkdownToEntities to create these /// UTC timestamp when the message should be sent - /// Should website/media preview be shown or not, for URLs in your message + /// Should website/media preview be shown below, above or not, for URL links in your message /// The transmitted message as confirmed by Telegram - public async Task SendMessageAsync(InputPeer peer, string text, InputMedia media = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default, bool disable_preview = false) + public async Task SendMessageAsync(InputPeer peer, string text, InputMedia media = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default, LinkPreview preview = LinkPreview.BelowText) { UpdatesBase updates; long random_id = Helpers.RandomLong(); if (media == null) - updates = await this.Messages_SendMessage(peer, text, random_id, no_webpage: disable_preview, entities: entities, + updates = await this.Messages_SendMessage(peer, text, random_id, entities: entities, + no_webpage: preview == LinkPreview.Disabled, invert_media: preview == LinkPreview.AboveText, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date == default ? null : schedule_date); else updates = await this.Messages_SendMedia(peer, media, text, random_id, entities: entities, From 8f44137366f0556bcb8e3540d6d4eb055dbd370a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 25 Nov 2023 19:16:03 +0100 Subject: [PATCH 138/336] api doc --- src/TL.Schema.cs | 243 ++++++++++++++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 101 +++++++++++------- 2 files changed, 237 insertions(+), 107 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 25049dd..285b091 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -455,11 +455,13 @@ namespace TL /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } - /// See + /// Forwarded story See [TLDef(0x89FDD778)] public class InputMediaStory : InputMedia { + /// Peer where the story was posted public InputPeer peer; + /// Story ID public int id; } /// See @@ -1348,6 +1350,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » [IfFlag(30)] public ChatReactions available_reactions; + /// Channel stories [IfFlag(36)] public PeerStories stories; [Flags] public enum Flags : uint @@ -1830,6 +1833,7 @@ namespace TL public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; + /// Currently only used for story videos, may contain an alternative version of the story video, explicitly encoded using H.264 (in MPEG4 transport) at a lower resolution than document. [IfFlag(5)] public DocumentBase alt_document; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2184,7 +2188,7 @@ namespace TL public Flags flags; /// We have authorized the bot to send us messages by logging into a website via Telegram Login »; this field contains the domain name of the website on which the user has logged in. [IfFlag(0)] public string domain; - /// We have authorized the bot to send us messages by opening the specified bot web app. + /// We have authorized the bot to send us messages by opening the specified bot mini app. [IfFlag(2)] public BotApp app; [Flags] public enum Flags : uint @@ -2290,14 +2294,14 @@ namespace TL /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] public class MessageActionChatJoinedByRequest : MessageAction { } - /// Data from an opened reply keyboard bot web app was relayed to the bot that owns it (bot side service message). See + /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (bot side service message). See [TLDef(0x47DD8079, inheritBefore = true)] public class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent { /// Relayed data. public string data; } - /// Data from an opened reply keyboard bot web app was relayed to the bot that owns it (user side service message). See + /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (user side service message). See [TLDef(0xB4C38CB5)] public class MessageActionWebViewDataSent : MessageAction { @@ -2789,10 +2793,13 @@ namespace TL [IfFlag(1)] public bool silent; /// Date until which all notifications shall be switched off [IfFlag(2)] public int mute_until; - /// Name of an audio file for notification + /// Identifier of an audio file to play for notifications. [IfFlag(3)] public NotificationSound sound; + /// Whether story notifications should be disabled. [IfFlag(6)] public bool stories_muted; + /// Whether the sender name should be displayed in story notifications. [IfFlag(7)] public bool stories_hide_sender; + /// Identifier of an audio file to play for story notifications. [IfFlag(8)] public NotificationSound stories_sound; [Flags] public enum Flags : uint @@ -2832,10 +2839,15 @@ namespace TL [IfFlag(4)] public NotificationSound android_sound; /// Notification sound for other applications [IfFlag(5)] public NotificationSound other_sound; + /// Whether story notifications should be disabled. [IfFlag(6)] public bool stories_muted; + /// Whether the sender name should be displayed in story notifications. [IfFlag(7)] public bool stories_hide_sender; + /// Sound for story notifications on the official iOS application [IfFlag(8)] public NotificationSound stories_ios_sound; + /// Sound for story notifications on the official Android application [IfFlag(9)] public NotificationSound stories_android_sound; + /// Sound for story notifications on other applications [IfFlag(10)] public NotificationSound stories_other_sound; [Flags] public enum Flags : uint @@ -3491,7 +3503,7 @@ namespace TL /// Usernames. public Username[] usernames; } - /// Authorized to the current user's account through an unknown device. See + /// A new session logged into the current user's account through an unknown device. See [TLDef(0x8951ABEF)] public class UpdateNewAuthorization : Update { @@ -3508,6 +3520,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether the session is unconfirmed, see here » for more info. unconfirmed = 0x1, } } @@ -4232,12 +4245,13 @@ namespace TL /// A login token (for login via QR code) was accepted. See [TLDef(0x564FE691)] public class UpdateLoginToken : Update { } - /// A specific user has voted in a poll See + /// A specific peer has voted in a poll See [TLDef(0x24F40E77)] public class UpdateMessagePollVote : Update { /// Poll ID public long poll_id; + /// The peer that voted in the poll public Peer peer; /// Chosen option(s) public byte[][] options; @@ -4741,25 +4755,31 @@ namespace TL /// ID of the user we couldn't add. public long user_id; } - /// See + /// A new story was posted. See [TLDef(0x75B3B798)] public class UpdateStory : Update { + /// ID of the poster. public Peer peer; + /// The story that was posted. public StoryItemBase story; } - /// See + /// Stories of a specific peer were marked as read. See [TLDef(0xF74E932B)] public class UpdateReadStories : Update { + /// The peer public Peer peer; + /// ID of the last story that was marked as read public int max_id; } - /// See + /// A story was successfully uploaded. See [TLDef(0x1BF335B9)] public class UpdateStoryID : Update { + /// The id that was attributed to the story. public int id; + /// The random_id that was passed to Stories_SendStory. public long random_id; } /// Indicates that stories stealth mode was activated. See @@ -4769,12 +4789,15 @@ namespace TL /// Information about the current stealth mode session. public StoriesStealthMode stealth_mode; } - /// See + /// Indicates we reacted to a story ». See [TLDef(0x7D627683)] public class UpdateSentStoryReaction : Update { + /// The peer that sent the story public Peer peer; + /// ID of the story we reacted to public int story_id; + /// The reaction that was sent public Reaction reaction; } /// See @@ -5921,7 +5944,7 @@ namespace TL AddedByPhone = 0xD1219BDD, ///Whether people can send you voice messages VoiceMessages = 0xAEE69D68, - ///See + ///Whether people can see your bio About = 0x3823CC40, } @@ -5946,7 +5969,7 @@ namespace TL AddedByPhone = 0x42FFD42B, ///Whether the user accepts voice messages VoiceMessages = 0x0697F414, - ///See + ///Whether people can see your bio About = 0xA486B761, } @@ -5992,7 +6015,7 @@ namespace TL /// Disallowed chat IDs public long[] chats; } - /// See + /// Allow only close friends » See [TLDef(0x2F453E49)] public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } @@ -6038,7 +6061,7 @@ namespace TL /// Disallowed chats public long[] chats; } - /// See + /// Allow only close friends » See [TLDef(0xF7E8D89B)] public class PrivacyValueAllowCloseFriends : PrivacyRule { } @@ -6111,6 +6134,7 @@ namespace TL public int w; /// Video height public int h; + /// Number of bytes to preload when preloading videos (particularly video stories). [IfFlag(2)] public int preload_prefix_size; [Flags] public enum Flags : uint @@ -6121,6 +6145,7 @@ namespace TL supports_streaming = 0x2, /// Field has a value has_preload_prefix_size = 0x4, + /// Whether the specified document is a video file with no audio tracks (a GIF animation (even as MPEG4), for example) nosound = 0x8, } } @@ -6406,6 +6431,7 @@ namespace TL encrypted_requests_disabled = 0x8, /// Whether this session will accept phone calls call_requests_disabled = 0x10, + /// Whether the session is unconfirmed, see here » for more info. unconfirmed = 0x20, } } @@ -6628,8 +6654,11 @@ namespace TL has_about = 0x20, /// Whether the join request » must be first approved by an administrator request_needed = 0x40, + /// Is this chat or channel verified by Telegram? verified = 0x80, + /// This chat is probably a scam scam = 0x100, + /// If set, this chat was reported by many users as a fake or scam: be careful when interacting with it. fake = 0x200, } } @@ -6973,14 +7002,14 @@ namespace TL /// User ID public long user_id; } - /// Button to open a bot web app using Messages_RequestWebView, sending over user information after user confirmation. See + /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See [TLDef(0x13767230, inheritBefore = true)] public class KeyboardButtonWebView : KeyboardButton { /// Web app url public string url; } - /// Button to open a bot web app using Messages_RequestSimpleWebView, without sending user information to the web app. See + /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See [TLDef(0xA0C0505C)] public class KeyboardButtonSimpleWebView : KeyboardButtonWebView { @@ -8163,7 +8192,7 @@ namespace TL [IfFlag(1)] public string next_offset; /// Shown as a button on top of the remaining inline result list; if clicked, redirects the user to a private chat with the bot with the specified start parameter. [IfFlag(2)] public InlineBotSwitchPM switch_pm; - /// Shown as a button on top of the remaining inline result list; if clicked, opens the specified bot web app. + /// Shown as a button on top of the remaining inline result list; if clicked, opens the specified bot mini app. [IfFlag(3)] public InlineBotWebView switch_webview; /// The results public BotInlineResultBase[] results; @@ -9288,6 +9317,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; + /// Terms of service URL [IfFlag(10)] public string terms_url; [Flags] public enum Flags : uint @@ -11883,11 +11913,11 @@ namespace TL other = 0x1000, /// If set, allows the admin to create, delete or modify forum topics ». manage_topics = 0x2000, - /// If set, allows the admin to post stories as the channel. + /// If set, allows the admin to post stories as the channel. post_stories = 0x4000, - /// If set, allows the admin to edit stories posted by the other admins of the channel. + /// If set, allows the admin to edit stories posted by the other admins of the channel. edit_stories = 0x8000, - /// If set, allows the admin to delete stories posted by the other admins of the channel. + /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, } } @@ -12080,6 +12110,7 @@ namespace TL audio_preload_next = 0x4, /// Whether to enable data saving mode in phone calls phonecalls_less_data = 0x8, + /// Whether to preload stories; in particular, the first .preload_prefix_size bytes of story videos should be preloaded. stories_preload = 0x10, } } @@ -12540,6 +12571,7 @@ namespace TL public int count; /// Vote info for each user public MessagePeerVoteBase[] votes; + /// Mentioned chats public Dictionary chats; /// Info about users that voted in the poll public Dictionary users; @@ -12975,7 +13007,9 @@ namespace TL { /// Whether to archive and mute new chats from non-contacts archive_and_mute_new_noncontact_peers = 0x1, + /// Whether unmuted chats will be kept in the Archive chat list when they get a new message. keep_archived_unmuted = 0x2, + /// Whether unmuted chats that are always included or pinned in a folder, will be kept in the Archive chat list when they get a new message. Ignored if keep_archived_unmuted is set. keep_archived_folders = 0x4, } } @@ -13151,11 +13185,13 @@ namespace TL quote = 0x200, } } - /// See + /// Represents a reply to a story See [TLDef(0x9C98BFC1)] public class MessageReplyStoryHeader : MessageReplyHeaderBase { + /// ID of the user that posted a story public long user_id; + /// Story ID public int story_id; } @@ -13716,6 +13752,7 @@ namespace TL [IfFlag(2)] public int channel_post; /// Parameter for the bot start message if the sponsored chat is a chat with a bot. [IfFlag(0)] public string start_param; + /// Sponsored website [IfFlag(9)] public SponsoredWebPage webpage; /// Sponsored message public string message; @@ -14075,7 +14112,7 @@ namespace TL public string key; } - /// Represents an attachment menu icon color for bot web apps » See + /// Represents an attachment menu icon color for bot mini apps » See [TLDef(0x4576F3F0)] public class AttachMenuBotIconColor : IObject { @@ -14085,13 +14122,13 @@ namespace TL public int color; } - /// Represents an attachment menu icon for bot web apps » See + /// Represents an attachment menu icon for bot mini apps » See [TLDef(0xB2A7386B)] public class AttachMenuBotIcon : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot web app.

default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
+ /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot mini app.

default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
public string name; /// The actual icon file. public DocumentBase icon; @@ -14105,7 +14142,7 @@ namespace TL } } - ///
Represents a bot web app that can be launched from the attachment menu » See + /// Represents a bot mini app that can be launched from the attachment menu » See [TLDef(0xD90D8DFE)] public class AttachMenuBot : IObject { @@ -14134,24 +14171,24 @@ namespace TL } } - /// Represents a list of bot web apps that can be launched from the attachment menu » See + /// Represents a list of bot mini apps that can be launched from the attachment menu » See /// a value means attachMenuBotsNotModified [TLDef(0x3C4301C0)] public class AttachMenuBots : IObject { /// Hash for pagination, for more info click here public long hash; - /// List of bot web apps that can be launched from the attachment menu » + /// List of bot mini apps that can be launched from the attachment menu » public AttachMenuBot[] bots; /// Info about related users/bots public Dictionary users; } - /// Represents a bot web app that can be launched from the attachment menu » See + /// Represents a bot mini app that can be launched from the attachment menu » See [TLDef(0x93BF667F)] public class AttachMenuBotsBot : IObject { - /// Represents a bot web app that can be launched from the attachment menu »
+ /// Represents a bot mini app that can be launched from the attachment menu »
public AttachMenuBot bot; /// Info about related users and bots public Dictionary users; @@ -14256,7 +14293,7 @@ namespace TL public DocumentBase document; } - /// Indicates a supported peer type for a bot web app attachment menu See + /// Indicates a supported peer type for a bot mini app attachment menu See public enum AttachMenuPeerType : uint { ///The bot attachment menu entry is available in the chat with the bot that offers it @@ -14999,47 +15036,47 @@ namespace TL public JsonObject config; } - /// Used to fetch information about a named bot web app See Derived classes: , + /// Used to fetch information about a named bot mini app See Derived classes: , public abstract class InputBotApp : IObject { } - /// Used to fetch information about a named bot web app by its ID See + /// Used to fetch information about a named bot mini app by its ID See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { - /// named bot web app ID. + /// named bot mini app ID. public long id; /// REQUIRED FIELD. See how to obtain it
Access hash, obtained from the .
public long access_hash; } - /// Used to fetch information about a named bot web app by its short name See + /// Used to fetch information about a named bot mini app by its short name See [TLDef(0x908C0407)] public class InputBotAppShortName : InputBotApp { - /// ID of the bot that owns the bot web app + /// ID of the bot that owns the bot mini app public InputUserBase bot_id; - /// Short name, obtained from a named bot web app deep link + /// Short name, obtained from a named bot mini app deep link public string short_name; } - /// Contains information about a named bot web app. See + /// Contains information about a named bot mini app. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] public class BotApp : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Bot web app ID + /// bot mini app ID public long id; - /// Bot web app access hash + /// bot mini app access hash public long access_hash; - /// Bot web app short name, used to generate named bot web app deep links. + /// bot mini app short name, used to generate named bot mini app deep links. public string short_name; - /// Bot web app title. + /// bot mini app title. public string title; - /// Bot web app description. + /// bot mini app description. public string description; - /// Bot web app photo. + /// bot mini app photo. public PhotoBase photo; - /// Bot web app animation. + /// bot mini app animation. [IfFlag(0)] public DocumentBase document; /// Hash to pass to Messages_GetBotApp, to avoid refetching bot app info if it hasn't changed. public long hash; @@ -15051,7 +15088,7 @@ namespace TL } } - /// Contains information about a named bot web app See + /// Contains information about a named bot mini app See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { @@ -15070,9 +15107,9 @@ namespace TL } } - /// Contains the link that must be used to open a named bot web app. See Derived classes: + /// Contains the link that must be used to open a named bot mini app. See Derived classes: public abstract class AppWebViewResult : IObject { } - /// Contains the link that must be used to open a named bot web app. See + /// Contains the link that must be used to open a named bot mini app. See [TLDef(0x3C1B4F0D)] public class AppWebViewResultUrl : AppWebViewResult { @@ -15080,7 +15117,7 @@ namespace TL public string url; } - /// Specifies a bot web app button, shown on top of the inline query results list. See + /// Specifies a bot mini app button, shown on top of the inline query results list. See [TLDef(0xB57295D5)] public class InlineBotWebView : IObject { @@ -15239,53 +15276,72 @@ namespace TL public string description; } - /// See Derived classes: , , + /// How a user voted in a poll See Derived classes: , , public abstract class MessagePeerVoteBase : IObject { + /// Peer ID public virtual Peer Peer { get; } + /// When did the peer cast the vote public virtual DateTime Date { get; } } - /// See + /// How a peer voted in a poll See [TLDef(0xB6CC2D5C)] public class MessagePeerVote : MessagePeerVoteBase { + /// Peer ID public Peer peer; + /// The option chosen by the peer public byte[] option; + /// When did the peer cast the vote public DateTime date; + /// Peer ID public override Peer Peer => peer; + /// When did the peer cast the vote public override DateTime Date => date; } - /// See + /// How a peer voted in a poll (reduced constructor, returned if an option was provided to Messages_GetPollVotes) See [TLDef(0x74CDA504)] public class MessagePeerVoteInputOption : MessagePeerVoteBase { + /// The peer that voted for the queried option public Peer peer; + /// When did the peer cast the vote public DateTime date; + /// The peer that voted for the queried option public override Peer Peer => peer; + /// When did the peer cast the vote public override DateTime Date => date; } - /// See + /// How a peer voted in a multiple-choice poll See [TLDef(0x4628F6E6)] public class MessagePeerVoteMultiple : MessagePeerVoteBase { + /// Peer ID public Peer peer; + /// Options chosen by the peer public byte[][] options; + /// When did the peer cast their votes public DateTime date; + /// Peer ID public override Peer Peer => peer; + /// When did the peer cast their votes public override DateTime Date => date; } - /// See + /// Represents a sponsored website. See [TLDef(0x3DB8EC63)] public class SponsoredWebPage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Web page URL. public string url; + /// Website name. public string site_name; + /// Optional image preview. [IfFlag(0)] public PhotoBase photo; [Flags] public enum Flags : uint @@ -15295,16 +15351,20 @@ namespace TL } } - /// See + /// Aggregated view and reaction information of a story. See [TLDef(0x8D595CD6)] public class StoryViews : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// View counter of the story public int views_count; + /// Forward counter of the story [IfFlag(2)] public int forwards_count; + /// All reactions sent to this story [IfFlag(3)] public ReactionCount[] reactions; [IfFlag(4)] public int reactions_count; + /// User IDs of some recent viewers of the story [IfFlag(0)] public long[] recent_viewers; [Flags] public enum Flags : uint @@ -15321,27 +15381,33 @@ namespace TL } } - /// See Derived classes: , , + /// Represents a Telegram Story See Derived classes: , , public abstract class StoryItemBase : IObject { + /// Story ID public virtual int ID { get; } } - /// See + /// Represents a previously active story, that was deleted See [TLDef(0x51E6EE4F)] public class StoryItemDeleted : StoryItemBase { + /// Story ID public int id; + /// Story ID public override int ID => id; } - /// See + /// Represents an active story, whose full information was omitted for space and performance reasons; use Stories_GetStoriesByID to fetch full info about the skipped story when and if needed. See [TLDef(0xFFADC913)] public class StoryItemSkipped : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Story ID public int id; + /// When was the story posted. public DateTime date; + /// When does the story expire. public DateTime expire_date; [Flags] public enum Flags : uint @@ -15349,6 +15415,7 @@ namespace TL close_friends = 0x100, } + /// Story ID public override int ID => id; } /// Represents a story. See @@ -15371,7 +15438,9 @@ namespace TL public MessageMedia media; /// List of media areas, see here » for more info on media areas. [IfFlag(14)] public MediaArea[] media_areas; + /// Privacy rules indicating who can and can't view this story [IfFlag(2)] public PrivacyRule[] privacy; + /// View date and reaction information [IfFlag(3)] public StoryViews views; /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; @@ -15386,7 +15455,9 @@ namespace TL has_privacy = 0x4, /// Field has a value has_views = 0x8, + /// Whether this story is pinned on the user's profile pinned = 0x20, + /// Whether this story is public public_ = 0x80, close_friends = 0x100, min = 0x200, @@ -15408,62 +15479,78 @@ namespace TL public override int ID => id; } - /// See Derived classes: , + /// Full list of active (or active and hidden) stories. See Derived classes: , public abstract class Stories_AllStoriesBase : IObject { } - /// See + /// The list of active (or active and hidden) stories has not changed. See [TLDef(0x1158FE3E)] public class Stories_AllStoriesNotModified : Stories_AllStoriesBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// State to use to ask for updates public string state; + /// Current stealth mode information public StoriesStealthMode stealth_mode; [Flags] public enum Flags : uint { } } - /// See + /// Full list of active (or active and hidden) stories. See [TLDef(0x6EFC5E81)] public class Stories_AllStories : Stories_AllStoriesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of active (or active and hidden) stories public int count; + /// State to use for pagination public string state; + /// Stories public PeerStories[] peer_stories; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; + /// Current stealth mode information public StoriesStealthMode stealth_mode; [Flags] public enum Flags : uint { + /// Whether more results can be fetched as described here ». has_more = 0x1, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// List of stories See [TLDef(0x5DD8C3C8)] public class Stories_Stories : IObject, IPeerResolver { + /// Total number of stories that can be fetched public int count; + /// Stories public StoryItemBase[] stories; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Story view date and reaction information See [TLDef(0xB0BDEAC5)] public class StoryView : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The user that viewed the story public long user_id; + /// When did the user view the story public DateTime date; + /// If present, contains the reaction that the user left on the story [IfFlag(2)] public Reaction reaction; [Flags] public enum Flags : uint @@ -15475,16 +15562,20 @@ namespace TL } } - /// See + /// Reaction and view counters for a story See [TLDef(0x46E9B9EC)] public class Stories_StoryViewsList : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results that can be fetched public int count; public int reactions_count; + /// Story view date and reaction information public StoryView[] views; + /// Mentioned users public Dictionary users; + /// Offset for pagination [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint @@ -15494,11 +15585,13 @@ namespace TL } } - /// See + /// Reaction and view counters for a list of stories See [TLDef(0xDE9EED1D)] public class Stories_StoryViews : IObject { + /// View date and reaction information of multiple stories public StoryViews[] views; + /// Mentioned users public Dictionary users; } @@ -15540,10 +15633,11 @@ namespace TL public int story_id; } - /// See + /// Represents a story deep link. See [TLDef(0x3FC9053B)] public class ExportedStoryLink : IObject { + /// The story deep link. public string link; } @@ -15583,7 +15677,7 @@ namespace TL public double rotation; } - /// See Derived classes: , , , + /// Represents a story media area » See Derived classes: , , , public abstract class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] @@ -15604,12 +15698,15 @@ namespace TL /// Venue type in the provider's database public string venue_type; } - /// See + /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xB282217F)] public class InputMediaAreaVenue : MediaArea { + /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + /// The query_id from , see here » for more info. public long query_id; + /// The id of the chosen result, see here » for more info. public string result_id; } /// Represents a geolocation tag attached to a story. See @@ -15641,14 +15738,17 @@ namespace TL } } - /// See + /// Stories associated to a peer See [TLDef(0x9A35E999)] public class PeerStories : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The peer public Peer peer; + /// If set, contains the ID of the maximum read story [IfFlag(0)] public int max_read_id; + /// Stories public StoryItemBase[] stories; [Flags] public enum Flags : uint @@ -15658,12 +15758,15 @@ namespace TL } } - /// See + /// Active story list of a specific peer. See [TLDef(0xCAE68768)] public class Stories_PeerStories : IObject, IPeerResolver { + /// Stories public PeerStories stories; + /// Mentioned chats public Dictionary chats; + /// Mentioned users 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 5ff6817..8fc5ebf 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -299,7 +299,7 @@ namespace TL web_auth_token = web_auth_token, }); - /// Request an SMS code via Firebase. See [bots: ✓] Possible codes: 400 (details) + /// Request an SMS code via Firebase. See Possible codes: 400 (details) /// Phone number /// Phone code hash returned by Auth_SendCode /// On Android, a JWS object obtained as described in the auth documentation » @@ -757,7 +757,8 @@ namespace TL }); /// Returns list of chats with non-default notification settings See - /// If true, chats with non-default sound will also be returned + /// If set, chats with non-default sound will be returned + /// If set, chats with non-default notification settings for stories will be returned /// If specified, only chats of the specified category will be returned public static Task Account_GetNotifyExceptions(this Client client, InputNotifyPeerBase peer = null, bool compare_sound = false, bool compare_stories = false) => client.Invoke(new Account_GetNotifyExceptions @@ -1006,7 +1007,8 @@ namespace TL authorization_ttl_days = authorization_ttl_days, }); - /// Change settings related to the current session. See Possible codes: 400 (details) + /// Change settings related to a session. See Possible codes: 400 (details) + /// If set, confirms a newly logged in session ». /// Session ID from the , fetchable using Account_GetAuthorizations /// Whether to enable or disable receiving encrypted chats: if the flag is not set, the previous setting is not changed /// Whether to enable or disable receiving calls: if the flag is not set, the previous setting is not changed @@ -1144,7 +1146,8 @@ namespace TL { }); - /// See + /// Invalidate the specified login codes, see here » for more info. See + /// The login codes to invalidate. public static Task Account_InvalidateSignInCodes(this Client client, params string[] codes) => client.Invoke(new Account_InvalidateSignInCodes { @@ -1421,7 +1424,7 @@ namespace TL id = id, }); - /// Replace the contents of an entire blocklist, see here for more info ». See + /// Replace the contents of an entire blocklist, see here for more info ». See /// Whether to edit the story blocklist; if not set, will edit the main blocklist. See here » for differences between the two. /// Full content of the blocklist. /// Maximum number of results to return, see pagination @@ -2125,7 +2128,7 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified bot web app. + /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified bot mini app. public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, int cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { @@ -3359,7 +3362,7 @@ namespace TL limit = limit, }); - /// Returns installed attachment menu bot web apps » See + /// Returns installed attachment menu bot mini apps » See /// Hash for pagination, for more info click here /// a null value means attachMenuBotsNotModified public static Task Messages_GetAttachMenuBots(this Client client, long hash = default) @@ -3368,7 +3371,7 @@ namespace TL hash = hash, }); - /// Returns attachment menu entry for a bot web app that can be launched from the attachment menu » See Possible codes: 400 (details) + /// Returns attachment menu entry for a bot mini app that can be launched from the attachment menu » See Possible codes: 400 (details) /// Bot ID public static Task Messages_GetAttachMenuBot(this Client client, InputUserBase bot) => client.Invoke(new Messages_GetAttachMenuBot @@ -3388,7 +3391,7 @@ namespace TL enabled = enabled, }); - /// Open a bot web app, sending over user information after user confirmation. See + /// Open a bot mini app, sending over user information after user confirmation. See /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). @@ -3431,9 +3434,9 @@ namespace TL send_as = send_as, }); - /// Open a bot web app. See + /// Open a bot mini app. See /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. - /// Bot that owns the webapp + /// Bot that owns the mini app /// Web app URL /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores @@ -3458,7 +3461,7 @@ namespace TL result = result, }); - /// Used by the user to relay data from an opened reply keyboard bot web app to the bot that owns it. See + /// Used by the user to relay data from an opened reply keyboard bot mini app to the bot that owns it. See /// Bot that owns the web app /// Unique client message ID to prevent duplicate sending of the same event You can use /// Text of the that was pressed to open the web app. @@ -3647,8 +3650,8 @@ namespace TL peer = peer, }); - /// Obtain information about a named bot web app See Possible codes: 400 (details) - /// Bot app information obtained from a named bot web app deep link ». + /// Obtain information about a named bot mini app See Possible codes: 400 (details) + /// Bot app information obtained from a named bot mini app deep link ». /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp @@ -3657,11 +3660,11 @@ namespace TL hash = hash, }); - /// Open a bot web app from a named bot web app deep link, sending over user information after user confirmation. See - /// Set this flag if the bot is asking permission to send messages to the user as specified in the named bot web app deep link docs, and the user agreed. + /// Open a bot mini app from a named bot mini app deep link, sending over user information after user confirmation. See + /// Set this flag if the bot is asking permission to send messages to the user as specified in the named bot mini app deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. - /// The app obtained by invoking Messages_GetBotApp as specified in the named bot web app deep link docs. - /// If the startapp query string parameter is present in the named bot web app deep link, pass it to start_param. + /// The app obtained by invoking Messages_GetBotApp as specified in the named bot mini app deep link docs. + /// If the startapp query string parameter is present in the named bot mini app deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) @@ -4596,7 +4599,7 @@ namespace TL topics = topics, }); - /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400 (details) + /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) /// Supergroup /// Topic ID /// If present, will update the topic title (maximum UTF-8 length: 128). @@ -4679,7 +4682,9 @@ namespace TL enabled = enabled, }); - /// See Possible codes: 400 (details) + /// Informs the server that the user has either: See Possible codes: 400 (details) + /// Channel where the sponsored message was posted + /// Message ID public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) => client.Invoke(new Channels_ClickSponsoredMessage { @@ -5726,7 +5731,7 @@ namespace TL /// The story media. /// Media areas associated to the story, see here » for more info. /// Story caption. - /// Message entities for styled text + /// Message entities for styled text, if allowed by the stories_entities client configuration parameter ». /// Privacy rules for the story, indicating who can or can't view the story. /// Unique client message ID required to prevent message resending. You can use /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. @@ -5744,13 +5749,13 @@ namespace TL period = period.GetValueOrDefault(), }); - /// See Possible codes: 400 (details) + /// Edit an uploaded story See Possible codes: 400 (details) /// Peer where the story was posted. /// ID of story to edit. /// If specified, replaces the story media. /// Media areas associated to the story, see here » for more info. /// If specified, replaces the story caption. - /// Message entities for styled text in the caption + /// Message entities for styled text in the caption, if allowed by the stories_entities client configuration parameter ». /// If specified, alters the privacy settings » of the story, changing who can or can't view the story. public static Task Stories_EditStory(this Client client, InputPeer peer, int id, InputMedia media = null, string caption = null, MessageEntity[] entities = null, InputPrivacyRule[] privacy_rules = null, MediaArea[] media_areas = null) => client.Invoke(new Stories_EditStory @@ -5775,7 +5780,10 @@ namespace TL id = id, }); - /// See Possible codes: 400 (details) + /// Pin or unpin one or more stories See Possible codes: 400 (details) + /// Peer where to pin or unpin stories + /// IDs of stories to pin or unpin + /// Whether to pin or unpin the stories public static Task Stories_TogglePinned(this Client client, InputPeer peer, int[] id, bool pinned) => client.Invoke(new Stories_TogglePinned { @@ -5784,7 +5792,10 @@ namespace TL pinned = pinned, }); - /// See + /// Fetch the List of active (or active and hidden) stories, see here » for more info on watching stories. See + /// If next and state are both set, uses the passed state to paginate to the next results; if neither state nor next are set, fetches the initial page; if state is set and next is not set, check for changes in the active/hidden peerset, see here » for more info on the full flow. + /// If set, fetches the hidden active story list, otherwise fetches the active story list, see here » for more info on the full flow. + /// If next and state are both set, uses the passed state to paginate to the next results; if neither state nor next are set, fetches the initial page; if state is set and next is not set, check for changes in the active/hidden peerset, see here » for more info on the full flow. public static Task Stories_GetAllStories(this Client client, string state = null, bool next = false, bool hidden = false) => client.Invoke(new Stories_GetAllStories { @@ -5792,7 +5803,8 @@ namespace TL state = state, }); - /// See Possible codes: 400 (details) + /// Fetch the stories pinned on a peer's profile. See Possible codes: 400 (details) + /// Peer whose pinned stories should be fetched /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Stories_GetPinnedStories(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) @@ -5803,7 +5815,8 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Fetch the story archive » of a peer we control. See Possible codes: 400 (details) + /// Peer whose archived stories should be fetched /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Stories_GetStoriesArchive(this Client client, InputPeer peer, int offset_id = default, int limit = int.MaxValue) @@ -5814,7 +5827,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Obtain full info about a set of stories by their IDs. See Possible codes: 400 (details) + /// Peer where the stories were posted + /// Story IDs public static Task Stories_GetStoriesByID(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesByID { @@ -5822,15 +5837,17 @@ namespace TL id = id, }); - /// See + /// Hide the active stories of a specific peer, preventing them from being displayed on the action bar on the homescreen. See + /// Whether to hide or unhide all active stories of the peer public static Task Stories_ToggleAllStoriesHidden(this Client client, bool hidden) => client.Invoke(new Stories_ToggleAllStoriesHidden { hidden = hidden, }); - /// See Possible codes: 400 (details) + /// Mark all stories up to a certain ID as read, for a given peer; will emit an update to all logged-in sessions. See Possible codes: 400 (details) /// The peer whose stories should be marked as read. + /// Mark all stories up to and including this ID as read public static Task Stories_ReadStories(this Client client, InputPeer peer, int max_id = default) => client.Invoke(new Stories_ReadStories { @@ -5840,7 +5857,7 @@ namespace TL /// Increment the view counter of one or more stories. See Possible codes: 400 (details) /// Peer where the stories were posted. - /// IDs of the stories. + /// IDs of the stories (maximum 200 at a time). public static Task Stories_IncrementStoryViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_IncrementStoryViews { @@ -5848,7 +5865,12 @@ namespace TL id = id, }); - /// See Possible codes: 400 (details) + /// Obtain the list of users that have viewed a specific story we posted See Possible codes: 400 (details) + /// Whether to only fetch view reaction/views made by our contacts + /// Peer where the story was posted + /// Search for specific peers + /// Story ID + /// Offset for pagination, obtained from .next_offset /// Maximum number of results to return, see pagination public static Task Stories_GetStoryViewsList(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) => client.Invoke(new Stories_GetStoryViewsList @@ -5861,7 +5883,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: 400 (details) + /// Peer whose stories should be fetched + /// Story IDs public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_GetStoriesViews { @@ -5869,7 +5893,9 @@ namespace TL id = id, }); - /// See Possible codes: 400 (details) + /// Generate a story deep link for a specific story See Possible codes: 400 (details) + /// Peer where the story was posted + /// Story ID public static Task Stories_ExportStoryLink(this Client client, InputPeer peer, int id) => client.Invoke(new Stories_ExportStoryLink { @@ -5914,14 +5940,15 @@ namespace TL reaction = reaction, }); - /// See Possible codes: 400 (details) + /// Fetch the full active story list of a specific peer. See Possible codes: 400 (details) + /// Peer whose stories should be fetched public static Task Stories_GetPeerStories(this Client client, InputPeer peer) => client.Invoke(new Stories_GetPeerStories { peer = peer, }); - /// See + /// Obtain the latest read story ID for all peers when first logging in, returned as a list of updates, see here » for more info. See public static Task Stories_GetAllReadPeerStories(this Client client) => client.Invoke(new Stories_GetAllReadPeerStories { @@ -5934,7 +5961,7 @@ namespace TL id = id, }); - /// See + /// Obtain a list of channels where the user can post stories See public static Task Stories_GetChatsToSend(this Client client) => client.Invoke(new Stories_GetChatsToSend { From 9209d792a51c851ff7c8a65929d4fd4d2073afd1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 25 Nov 2023 19:16:51 +0100 Subject: [PATCH 139/336] - InputMediaUploadedDocument ctor accept attributes - SendMediaAsync: MP4 file or "video" mime type is now sent as streamable video - SendAlbumAsync: External videos URL are now sent as streamable videos by default (streamable videos might lack thumbnail if too big for client auto-download) --- src/Client.Helpers.cs | 35 +++++++++++++++++++---------------- src/TL.Helpers.cs | 9 +++++++++ 2 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index ab45b4e..57f4701 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -110,27 +110,30 @@ namespace WTelegram /// Helper function to send a media message more easily /// Destination of message (chat group, channel, user chat, etc..) /// Caption for the media (in plain text) or - /// Media file already uploaded to TG (see UploadFileAsync) - /// for automatic detection, "photo" for an inline photo, or a MIME type to send as a document + /// Media file already uploaded to TG (see UploadFileAsync) + /// for automatic detection, "photo" for an inline photo, "video" for a streamable MP4 video, or a MIME type to send as a document /// Your message is a reply to an existing message with this ID, in the same chat /// Text formatting entities for the caption. You can use MarkdownToEntities to create these /// UTC timestamp when the message should be sent /// The transmitted message confirmed by Telegram - public Task SendMediaAsync(InputPeer peer, string caption, InputFileBase mediaFile, string mimeType = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) + public Task SendMediaAsync(InputPeer peer, string caption, InputFileBase uploadedFile, string mimeType = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) { - mimeType ??= Path.GetExtension(mediaFile.Name)?.ToLowerInvariant() switch + mimeType ??= Path.GetExtension(uploadedFile.Name)?.ToLowerInvariant() switch { ".jpg" or ".jpeg" or ".png" or ".bmp" => "photo", + ".mp4" => "video", ".gif" => "image/gif", ".webp" => "image/webp", - ".mp4" => "video/mp4", ".mp3" => "audio/mpeg", ".wav" => "audio/x-wav", _ => "", // send as generic document with undefined MIME type }; if (mimeType == "photo") - return SendMessageAsync(peer, caption, new InputMediaUploadedPhoto { file = mediaFile }, reply_to_msg_id, entities, schedule_date); - return SendMessageAsync(peer, caption, new InputMediaUploadedDocument(mediaFile, mimeType), reply_to_msg_id, entities, schedule_date); + return SendMessageAsync(peer, caption, new InputMediaUploadedPhoto { file = uploadedFile }, reply_to_msg_id, entities, schedule_date); + else if (mimeType == "video") + return SendMessageAsync(peer, caption, new InputMediaUploadedDocument(uploadedFile, "video/mp4", new DocumentAttributeVideo { flags = DocumentAttributeVideo.Flags.supports_streaming }), reply_to_msg_id, entities, schedule_date); + else + return SendMessageAsync(peer, caption, new InputMediaUploadedDocument(uploadedFile, mimeType), reply_to_msg_id, entities, schedule_date); } public enum LinkPreview { Disabled = 0, BelowText = 1, AboveText = 2 }; @@ -184,6 +187,7 @@ namespace WTelegram /// Your message is a reply to an existing message with this ID, in the same chat /// Text formatting entities for the caption. You can use MarkdownToEntities to create these /// UTC timestamp when the message should be sent + /// Any URL pointing to a video should be considered as non-streamable /// The last of the media group messages, confirmed by Telegram /// /// * The caption/entities are set on the last media
@@ -191,7 +195,7 @@ namespace WTelegram /// WTelegramClient proxy settings don't apply to HttpClient
/// * You may run into errors if you mix, in the same album, photos and file documents having no thumbnails/video attributes ///
- public async Task SendAlbumAsync(InputPeer peer, ICollection medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default) + public async Task SendAlbumAsync(InputPeer peer, ICollection medias, string caption = null, int reply_to_msg_id = 0, MessageEntity[] entities = null, DateTime schedule_date = default, bool videoUrlAsFile = false) { System.Net.Http.HttpClient httpClient = null; int i = 0, length = medias.Count; @@ -215,7 +219,10 @@ namespace WTelegram case InputMediaDocumentExternal imde: string mimeType = null; var inputFile = await UploadFromUrl(imde.url); - ism.media = new InputMediaUploadedDocument(inputFile, mimeType); + if (mimeType?.StartsWith("video/") == true) + ism.media = new InputMediaUploadedDocument(inputFile, mimeType, new DocumentAttributeVideo { flags = DocumentAttributeVideo.Flags.supports_streaming }); + else + ism.media = new InputMediaUploadedDocument(inputFile, mimeType); goto retry; case InputMediaPhotoExternal impe: inputFile = await UploadFromUrl(impe.url); @@ -226,18 +233,14 @@ namespace WTelegram { var filename = Path.GetFileName(new Uri(url).LocalPath); httpClient ??= new(); - var response = await httpClient.GetAsync(url); + using var response = await httpClient.GetAsync(url, System.Net.Http.HttpCompletionOption.ResponseHeadersRead); + response.EnsureSuccessStatusCode(); using var stream = await response.Content.ReadAsStreamAsync(); mimeType = response.Content.Headers.ContentType?.MediaType; if (response.Content.Headers.ContentLength is long length) return await UploadFileAsync(new Helpers.IndirectStream(stream) { ContentLength = length }, filename); else - { - using var ms = new MemoryStream(); - await stream.CopyToAsync(ms); - ms.Position = 0; - return await UploadFileAsync(ms, filename); - } + return await UploadFileAsync(stream, filename); } } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 746a734..8d2636c 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -107,6 +107,15 @@ namespace TL mime_type = mimeType; if (inputFile.Name is string filename) attributes = new[] { new DocumentAttributeFilename { file_name = filename } }; } + public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType, params DocumentAttribute[] attribs) + { + file = inputFile; + mime_type = mimeType; + if (inputFile.Name is string filename && !attribs.Any(a => a is DocumentAttributeFilename)) + attributes = attribs.Append(new DocumentAttributeFilename { file_name = filename }).ToArray(); + else + attributes = attribs; + } } partial class InputPhoto From 35fab214930350e9c8e214ae86db1764ac17eeae Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:33:09 +0100 Subject: [PATCH 140/336] SendAlbumAsync now sets caption on first media instead of last --- .github/dev.yml | 18 ++++++++++++++++++ .github/release.yml | 4 ++-- README.md | 1 + src/Client.Helpers.cs | 8 ++++---- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e1f441f..6187dbb 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -34,3 +34,21 @@ steps: publishPackageMetadata: true nuGetFeedType: 'external' publishFeedCredentials: 'nuget.org' + +- task: InvokeRESTAPI@1 + inputs: + connectionType: 'connectedServiceName' + serviceConnection: 'Telegram Deploy Notice' + method: 'POST' + body: | + { + "status": "success", + "complete": true, + "message": "{ + \"commitId\": \"$(Build.SourceVersion)\", + \"buildNumber\": \"$(Build.BuildNumber)\", + \"teamProjectName\": \"$(System.TeamProject)\", + \"commitMessage\": \"$(Build.SourceVersionMessage)\" + }" + } + waitForCompletion: 'false' diff --git a/.github/release.yml b/.github/release.yml index 0b50ce6..14e7bdb 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -59,13 +59,13 @@ stages: serviceConnection: 'Telegram Deploy Notice' method: 'POST' body: | - { + { "status": "success", "complete": true, "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", - \"teamProjectName\": \"$(system.TeamProject)\" + \"teamProjectName\": \"$(System.TeamProject)\" }" } waitForCompletion: 'false' diff --git a/README.md b/README.md index e73b22e..0829baa 100644 --- a/README.md +++ b/README.md @@ -160,6 +160,7 @@ or a [broadcast channel](https://corefork.telegram.org/api/channel#channels) (th See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn more about it. - **DC** (DataCenter): There are a few datacenters depending on where in the world the user (or an uploaded media file) is from. - **Session** or **Authorization**: Pairing between a device and a phone number. You can have several active sessions for the same phone number. +- **Participant**: A member/subscriber of a chat group or channel # Other things to know diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 57f4701..b8776ab 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -244,10 +244,10 @@ namespace WTelegram } } } - var lastMedia = multiMedia[^1]; - lastMedia.message = caption; - lastMedia.entities = entities; - if (entities != null) lastMedia.flags = InputSingleMedia.Flags.has_entities; + var firstMedia = multiMedia[0]; + firstMedia.message = caption; + firstMedia.entities = entities; + if (entities != null) firstMedia.flags = InputSingleMedia.Flags.has_entities; var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date); RaiseUpdate(updates); From 5624eda8a036078505dd7ed8754357074374e3b2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:49:11 +0100 Subject: [PATCH 141/336] fix "dev.yml" --- .github/dev.yml | 88 +++++++++++++++++++++++++++---------------------- 1 file changed, 49 insertions(+), 39 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 6187dbb..bf0d4e4 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -10,45 +10,55 @@ variables: buildConfiguration: 'Release' Release_Notes: $[replace(variables['Build.SourceVersionMessage'], '"', '''''')] -steps: -- task: UseDotNet@2 - displayName: 'Use .NET Core sdk' - inputs: - packageType: 'sdk' - version: '6.0.x' - includePreviewVersions: true +stages: + - stage: publish + jobs: + - job: publish + steps: + - task: UseDotNet@2 + displayName: 'Use .NET Core sdk' + inputs: + packageType: 'sdk' + version: '6.0.x' + includePreviewVersions: true -- task: DotNetCoreCLI@2 - inputs: - command: 'pack' - packagesToPack: '**/*.csproj' - includesymbols: true - versioningScheme: 'byEnvVar' - versionEnvVar: 'Build.BuildNumber' - buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(Release_Notes)" + - task: DotNetCoreCLI@2 + inputs: + command: 'pack' + packagesToPack: '**/*.csproj' + includesymbols: true + versioningScheme: 'byEnvVar' + versionEnvVar: 'Build.BuildNumber' + buildProperties: NoWarn="0419;1573;1591";ContinuousIntegrationBuild=true;Version=$(Build.BuildNumber);"ReleaseNotes=$(Release_Notes)" -- task: NuGetCommand@2 - inputs: - command: 'push' - packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' - publishPackageMetadata: true - nuGetFeedType: 'external' - publishFeedCredentials: 'nuget.org' + - task: NuGetCommand@2 + inputs: + command: 'push' + packagesToPush: '$(Build.ArtifactStagingDirectory)/**/*.nupkg' + publishPackageMetadata: true + nuGetFeedType: 'external' + publishFeedCredentials: 'nuget.org' -- task: InvokeRESTAPI@1 - inputs: - connectionType: 'connectedServiceName' - serviceConnection: 'Telegram Deploy Notice' - method: 'POST' - body: | - { - "status": "success", - "complete": true, - "message": "{ - \"commitId\": \"$(Build.SourceVersion)\", - \"buildNumber\": \"$(Build.BuildNumber)\", - \"teamProjectName\": \"$(System.TeamProject)\", - \"commitMessage\": \"$(Build.SourceVersionMessage)\" - }" - } - waitForCompletion: 'false' + - stage: notify + jobs: + - job: notify + pool: + server + steps: + - task: InvokeRESTAPI@1 + inputs: + connectionType: 'connectedServiceName' + serviceConnection: 'Telegram Deploy Notice' + method: 'POST' + body: | + { + "status": "success", + "complete": true, + "message": "{ + \"commitId\": \"$(Build.SourceVersion)\", + \"buildNumber\": \"$(Build.BuildNumber)\", + \"teamProjectName\": \"$(System.TeamProject)\", + \"commitMessage\": \"$(Build.SourceVersionMessage)\" + }" + } + waitForCompletion: 'false' From 807ee0cc9afe8abda65876687392f302ca5c7e1e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 26 Nov 2023 23:53:58 +0100 Subject: [PATCH 142/336] fix "dev.yml" --- .github/dev.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index bf0d4e4..ec24e3c 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -58,7 +58,7 @@ stages: \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\", - \"commitMessage\": \"$(Build.SourceVersionMessage)\" + \"commitMessage\": \"$(Release_Notes)\" }" } waitForCompletion: 'false' From 5febd2d27bc3dda6c213c77a47daa4d13e7efcff Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 29 Nov 2023 15:16:35 +0100 Subject: [PATCH 143/336] Abort pending requests on Dispose (I thought it was already the case!?) --- src/Client.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index 67b3f0d..a9d43a9 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -174,6 +174,10 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); + var ex = new TaskCanceledException("WTelegram.Client was disposed"); + lock (_pendingRpcs) // abort all pending requests + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.TrySetException(ex); _networkStream = null; if (IsMainDC) _session.Dispose(); GC.SuppressFinalize(this); From 8f6e6440ba35f3b56a5245f30b2635b9a4912973 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 30 Nov 2023 01:51:23 +0100 Subject: [PATCH 144/336] api doc --- src/TL.Schema.cs | 9 +++++--- src/TL.SchemaFuncs.cs | 49 ++++++++++++++++++++++++------------------- 2 files changed, 34 insertions(+), 24 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 285b091..6afd8fb 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -14128,7 +14128,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot mini app.

default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
+ /// One of the following values: note that animated icons must be played when the user clicks on the button, activating the bot mini app.

default_static - Default attachment menu icon in SVG format
placeholder_static - Default placeholder for opened Web Apps in SVG format
ios_static - Attachment menu icon in SVG format for the official iOS app
ios_animated - Animated attachment menu icon in TGS format for the official iOS app
android_animated - Animated attachment menu icon in TGS format for the official Android app
macos_animated - Animated attachment menu icon in TGS format for the official native Mac OS app
ios_side_menu_static - Side menu icon in PNG format for the official iOS app
android_side_menu_static - Side menu icon in SVG format for the official android app
macos_side_menu_static - Side menu icon in PNG format for the official native Mac OS app
public string name; /// The actual icon file. public DocumentBase icon; @@ -14142,7 +14142,7 @@ namespace TL } } - ///
Represents a bot mini app that can be launched from the attachment menu » See + /// Represents a bot mini app that can be launched from the attachment/side menu » See [TLDef(0xD90D8DFE)] public class AttachMenuBot : IObject { @@ -14159,14 +14159,17 @@ namespace TL [Flags] public enum Flags : uint { - /// Whether this bot attachment menu entry should be shown in the attachment menu (toggle using Messages_ToggleBotInAttachMenu) + /// If set, before launching the mini app the client should ask the user to add the mini app to the attachment/side menu, and only if the user accepts, after invoking Messages_ToggleBotInAttachMenu the app should be opened. inactive = 0x1, /// True, if the bot supports the "settings_button_pressed" event » has_settings = 0x2, /// Whether the bot would like to send messages to the user. request_write_access = 0x4, + /// Whether, when installed, an attachment menu entry should be shown for the Mini App. show_in_attach_menu = 0x8, + /// Whether, when installed, an entry in the main view side menu should be shown for the Mini App. show_in_side_menu = 0x10, + /// If inactive if set and the user hasn't previously accepted the third-party mini apps Terms of Service for this bot, when showing the mini app installation prompt, an additional mandatory checkbox to accept the mini apps TOS and a disclaimer indicating that this Mini App is not affiliated to Telegram should be shown. side_menu_disclaimer_needed = 0x20, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 8fc5ebf..9c77ed5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1436,7 +1436,7 @@ namespace TL limit = limit, }); - /// This method is only for basic Chat. See Terminology 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: ✓]
+ /// This method is only for basic Chat. See Terminology 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) => client.Invoke(new Messages_GetMessages @@ -1546,7 +1546,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See
[bots: ✓] Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) @@ -1556,7 +1556,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages @@ -1693,7 +1693,7 @@ namespace TL message = message, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See
[bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details)
/// List of chat IDs public static Task Messages_GetChats(this Client client, params long[] id) => client.Invoke(new Messages_GetChats @@ -1701,7 +1701,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
/// Basic group ID. public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat @@ -1709,7 +1709,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) @@ -1719,7 +1719,7 @@ namespace TL title = title, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) @@ -1729,7 +1729,7 @@ namespace TL photo = photo, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
/// Chat ID /// User ID to be added /// Number of last messages to be forwarded @@ -1741,7 +1741,7 @@ namespace TL fwd_limit = fwd_limit, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted @@ -1888,7 +1888,7 @@ namespace TL peer = peer, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.Invoke(new Messages_ReadMessageContents @@ -2016,7 +2016,7 @@ namespace TL increment = increment, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a
basic group. See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a basic group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make them admin @@ -2028,7 +2028,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2103,7 +2103,7 @@ namespace TL unsave = unsave, }); - /// Query an inline bot See Possible codes: -503,400,406 (details) + /// Query an inline bot See Possible codes: 400,406,-503 (details) /// The bot to query /// The currently opened chat /// The geolocation, if requested @@ -2216,7 +2216,7 @@ namespace TL entities = entities, }); - /// Press an inline callback button and get a callback answer from the bot See Possible codes: -503,400 (details) + /// Press an inline callback button and get a callback answer from the bot See Possible codes: 400,-503 (details) /// Whether this is a "play game" button /// Where was the inline keyboard sent /// ID of the Message with the inline keyboard @@ -2967,7 +2967,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
/// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) => client.Invoke(new Messages_DeleteChat @@ -3397,7 +3397,7 @@ namespace TL /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). /// Bot that owns the web app /// Web app URL - /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. + /// If the web app was opened from the attachment menu using a attachment menu deep link, start_param should contain the data from the startattach parameter. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores /// If set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to the specified message or story. @@ -3436,8 +3436,10 @@ namespace TL /// Open a bot mini app. See /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. + /// Set this flag if opening the Mini App from the installed side menu entry » or from a startapp link ». /// Bot that owns the mini app - /// Web app URL + /// Web app URL, if opening from a keyboard button or inline result + /// Start parameter, if opening from a startapp link ». /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false) @@ -3451,7 +3453,7 @@ namespace TL platform = platform, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
/// Webview interaction ID obtained from Messages_RequestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) @@ -4839,21 +4841,26 @@ namespace TL active = active, }); - /// See Possible codes: 400 (details) + /// Check whether the specified bot can send us messages See Possible codes: 400 (details) + /// The bot public static Task Bots_CanSendMessage(this Client client, InputUserBase bot) => client.Invoke(new Bots_CanSendMessage { bot = bot, }); - /// See Possible codes: 400 (details) + /// Allow the specified bot to send us messages See Possible codes: 400 (details) + /// The bot public static Task Bots_AllowSendMessage(this Client client, InputUserBase bot) => client.Invoke(new Bots_AllowSendMessage { bot = bot, }); - /// See Possible codes: 400 (details) + /// Send a custom request from a mini bot app See Possible codes: 400 (details) + /// Identifier of the bot associated to the mini bot app + /// Identifier of the custom method to invoke + /// Method parameters public static Task Bots_InvokeWebViewCustomMethod(this Client client, InputUserBase bot, string custom_method, DataJSON params_) => client.Invoke(new Bots_InvokeWebViewCustomMethod { From b6c98658db29527ccc4e52ad1654f1d0e738d887 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:06:37 +0100 Subject: [PATCH 145/336] OnOwnUpdate handler can be used to intercept Updates replies to your API calls --- src/Client.Helpers.cs | 2 -- src/Client.cs | 27 ++++++++++++++++++++++++++- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index b8776ab..e7f0774 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -157,7 +157,6 @@ namespace WTelegram else updates = await this.Messages_SendMedia(peer, media, text, random_id, entities: entities, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date == default ? null : schedule_date); - RaiseUpdate(updates); int msgId = -1; if (updates is UpdateShortSentMessage sent) return new Message @@ -250,7 +249,6 @@ namespace WTelegram if (entities != null) firstMedia.flags = InputSingleMedia.Flags.has_entities; var updates = await this.Messages_SendMultiMedia(peer, multiMedia, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date); - RaiseUpdate(updates); var msgIds = new int[length]; var result = new Message[length]; foreach (var update in updates.UpdateList) diff --git a/src/Client.cs b/src/Client.cs index a9d43a9..05558f8 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -28,6 +28,8 @@ namespace WTelegram public event Func OnUpdate; /// This event is called for other types of notifications (login states, reactor errors, ...) public event Func OnOther; + /// Use this handler to intercept Updates that resulted from your own API calls + public event Func OnOwnUpdate; /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler; public delegate Task TcpFactory(string host, int port); @@ -568,7 +570,12 @@ namespace WTelegram if (result is RpcError rpcError) Helpers.Log(4, $" → RpcError {rpcError.error_code,3} {rpcError.error_message,-24} #{(short)msgId.GetHashCode():X4}"); else + { Helpers.Log(1, $" → {result?.GetType().Name,-37} #{(short)msgId.GetHashCode():X4}"); + if (OnOwnUpdate != null && result is UpdatesBase updates) + RaiseOwnUpdate(updates); + } + rpc.tcs.SetResult(result); } catch (Exception ex) @@ -587,7 +594,13 @@ namespace WTelegram } else if (ctorNb == (uint)Bool.False) result = false; else if (ctorNb == (uint)Bool.True) result = true; - else result = reader.ReadTLObject(ctorNb); + else + { + result = reader.ReadTLObject(ctorNb); + if (OnOwnUpdate != null && result is UpdatesBase updates) + RaiseOwnUpdate(updates); + } + var typeName = result?.GetType().Name; if (MsgIdToStamp(msgId) >= _session.SessionStart) Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); @@ -734,6 +747,18 @@ namespace WTelegram } } + private async void RaiseOwnUpdate(UpdatesBase updates) + { + try + { + await OnOwnUpdate(updates); + } + catch (Exception ex) + { + Helpers.Log(4, $"{nameof(OnOwnUpdate)}({updates.GetType().Name}) raised {ex}"); + } + } + static async Task DefaultTcpHandler(string host, int port) { var tcpClient = new TcpClient(); From d7ecd49b5c627ecd5ef2e404460b217c315d11a2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 30 Nov 2023 16:19:42 +0100 Subject: [PATCH 146/336] API Layer 167: PeerColor, wallpaper for_both, view_forum_as_messages, story forwards and more stats... --- README.md | 2 +- src/TL.Schema.cs | 258 +++++++++++++++++++++++++++++++------ src/TL.SchemaFuncs.cs | 150 +++++++++++++++++++-- src/TL.Table.cs | 41 ++++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 391 insertions(+), 62 deletions(-) diff --git a/README.md b/README.md index 0829baa..a715c3e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-166-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-167-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6afd8fb..130f26f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -739,7 +739,7 @@ namespace TL public long id; } /// Indicates info about a certain user See - [TLDef(0xEB602F25)] + [TLDef(0x215C4438)] public partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -775,8 +775,8 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; [IfFlag(37)] public int stories_max_id; - [IfFlag(39)] public int color; - [IfFlag(38)] public long background_emoji_id; + [IfFlag(40)] public PeerColor color; + [IfFlag(41)] public PeerColor profile_color; [Flags] public enum Flags : uint { @@ -850,10 +850,10 @@ namespace TL stories_unavailable = 0x10, /// Field has a value has_stories_max_id = 0x20, - /// Field has a value - has_background_emoji_id = 0x40, /// Field has a value - has_color = 0x80, + has_color = 0x100, + /// Field has a value + has_profile_color = 0x200, } } @@ -994,7 +994,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x1981EA7E)] + [TLDef(0x8E87CCD8)] public partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1026,8 +1026,7 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; [IfFlag(36)] public int stories_max_id; - [IfFlag(38)] public int color; - [IfFlag(37)] public long background_emoji_id; + [IfFlag(39)] public PeerColor color; [Flags] public enum Flags : uint { @@ -1094,10 +1093,8 @@ namespace TL stories_unavailable = 0x8, /// Field has a value has_stories_max_id = 0x10, - /// Field has a value - has_background_emoji_id = 0x20, /// Field has a value - has_color = 0x40, + has_color = 0x80, } /// ID of the channel @@ -1432,6 +1429,7 @@ namespace TL /// Field has a value has_stories = 0x10, stories_pinned_available = 0x20, + view_forum_as_messages = 0x40, } /// ID of the channel @@ -2394,15 +2392,19 @@ namespace TL public Peer peer; } /// The wallpaper » of the current chat was changed. See - [TLDef(0xBC44A927)] + [TLDef(0x5060A3F4)] public class MessageActionSetChatWallPaper : MessageAction { + public Flags flags; /// New wallpaper public WallPaperBase wallpaper; + + [Flags] public enum Flags : uint + { + same = 0x1, + for_both = 0x2, + } } - /// The user applied a wallpaper » previously sent by the other user in a message. See - [TLDef(0xC0787D6D)] - public class MessageActionSetSameChatWallPaper : MessageActionSetChatWallPaper { } /// See [TLDef(0xD2CFDB0E)] public class MessageActionGiftCode : MessageAction @@ -2422,6 +2424,13 @@ namespace TL /// See [TLDef(0x332BA9ED)] public class MessageActionGiveawayLaunch : MessageAction { } + /// See + [TLDef(0x2A9FADC5)] + public class MessageActionGiveawayResults : MessageAction + { + public int winners_count; + public int unclaimed_count; + } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -2476,6 +2485,7 @@ namespace TL has_folder_id = 0x10, /// Field has a value has_ttl_period = 0x20, + view_forum_as_messages = 0x40, } /// The chat @@ -3107,6 +3117,7 @@ namespace TL has_stories = 0x2000000, stories_pinned_available = 0x4000000, blocked_my_stories_from = 0x8000000, + wallpaper_overridden = 0x10000000, } } @@ -4808,6 +4819,26 @@ namespace TL public Boost boost; public int qts; } + /// See + [TLDef(0x07B68920, inheritBefore = true)] + public class UpdateChannelViewForumAsMessages : UpdateChannel + { + public bool enabled; + } + /// See + [TLDef(0xAE3F101D)] + public class UpdatePeerWallpaper : Update + { + public Flags flags; + public Peer peer; + [IfFlag(0)] public WallPaperBase wallpaper; + + [Flags] public enum Flags : uint + { + has_wallpaper = 0x1, + wallpaper_overridden = 0x2, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -12785,20 +12816,8 @@ namespace TL } } - /// Message interaction counters See - [TLDef(0xAD4FC9BD)] - public class MessageInteractionCounters : IObject - { - /// Message ID - public int msg_id; - /// Views - public int views; - /// Number of times this message was forwarded - public int forwards; - } - /// Channel statistics. See - [TLDef(0xBDF78394)] + [TLDef(0x396CA5FC)] public class Stats_BroadcastStats : IObject { /// Period in consideration @@ -12809,6 +12828,10 @@ namespace TL public StatsAbsValueAndPrev views_per_post; /// total_viewcount/postcount, for posts posted during the period in consideration (views_per_post).
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev shares_per_post; + public StatsAbsValueAndPrev reactions_per_post; + public StatsAbsValueAndPrev views_per_story; + public StatsAbsValueAndPrev shares_per_story; + public StatsAbsValueAndPrev reactions_per_story; /// Percentage of subscribers with enabled notifications public StatsPercentValue enabled_notifications; /// Channel growth graph (absolute subscriber count) @@ -12829,8 +12852,10 @@ namespace TL public StatsGraphBase new_followers_by_source_graph; /// Subscriber language graph (pie chart) public StatsGraphBase languages_graph; - /// Recent message interactions - public MessageInteractionCounters[] recent_message_interactions; + public StatsGraphBase reactions_by_emotion_graph; + public StatsGraphBase story_interactions_graph; + public StatsGraphBase story_reactions_by_emotion_graph; + public PostInteractionCounters[] recent_posts_interactions; } ///
Info about pinned MTProxy or Public Service Announcement peers. See Derived classes: , @@ -13146,7 +13171,7 @@ namespace TL /// Reply information See Derived classes: , public abstract class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See - [TLDef(0x6EEBCABD)] + [TLDef(0xAFBC09DB)] public class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13161,6 +13186,7 @@ namespace TL [IfFlag(1)] public int reply_to_top_id; [IfFlag(6)] public string quote_text; [IfFlag(7)] public MessageEntity[] quote_entities; + [IfFlag(10)] public int quote_offset; [Flags] public enum Flags : uint { @@ -13183,6 +13209,8 @@ namespace TL /// Field has a value has_reply_media = 0x100, quote = 0x200, + /// Field has a value + has_quote_offset = 0x400, } } /// Represents a reply to a story See @@ -13238,11 +13266,12 @@ namespace TL } /// Message statistics See - [TLDef(0x8999F295)] + [TLDef(0x7FE91C14)] public class Stats_MessageStats : IObject { /// Message view graph public StatsGraphBase views_graph; + public StatsGraphBase reactions_by_emotion_graph; } /// A group call See Derived classes: , @@ -13735,7 +13764,7 @@ namespace TL public class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xDAAFFF6B)] + [TLDef(0xED5383F7)] public class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13754,10 +13783,12 @@ namespace TL [IfFlag(0)] public string start_param; /// Sponsored website [IfFlag(9)] public SponsoredWebPage webpage; + [IfFlag(10)] public BotApp app; /// Sponsored message public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + [IfFlag(11)] public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. @@ -13785,6 +13816,10 @@ namespace TL has_additional_info = 0x100, /// Field has a value has_webpage = 0x200, + /// Field has a value + has_app = 0x400, + /// Field has a value + has_button_text = 0x800, } } @@ -14346,7 +14381,7 @@ namespace TL } /// Transcribed text from a voice message » See - [TLDef(0x93752C52)] + [TLDef(0xCFB9D957)] public class Messages_TranscribedAudio : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14355,11 +14390,15 @@ namespace TL public long transcription_id; /// Transcripted text public string text; + [IfFlag(1)] public int trial_remains_num; + [IfFlag(1)] public DateTime trial_remains_until_date; [Flags] public enum Flags : uint { /// Whether the transcription is partial because audio transcription is still in progress, if set the user may receive further updates with the updated transcription. pending = 0x1, + /// Fields and have a value + has_trial_remains_num = 0x2, } } @@ -15422,7 +15461,7 @@ namespace TL public override int ID => id; } /// Represents a story. See - [TLDef(0x44C457CE)] + [TLDef(0xAF6365A1)] public class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15431,6 +15470,7 @@ namespace TL public int id; /// When was the story posted. public DateTime date; + [IfFlag(17)] public StoryFwdHeader fwd_from; /// When does the story expire. public DateTime expire_date; /// Story caption. @@ -15476,6 +15516,8 @@ namespace TL has_sent_reaction = 0x8000, /// indicates whether we sent this story. out_ = 0x10000, + /// Field has a value + has_fwd_from = 0x20000, } /// ID of the story. @@ -15601,7 +15643,7 @@ namespace TL /// Contains info about a message or story to reply to. See Derived classes: , public abstract class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0x073EC805)] + [TLDef(0x22C0F6D5)] public class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15613,6 +15655,7 @@ namespace TL [IfFlag(1)] public InputPeer reply_to_peer_id; [IfFlag(2)] public string quote_text; [IfFlag(3)] public MessageEntity[] quote_entities; + [IfFlag(4)] public int quote_offset; [Flags] public enum Flags : uint { @@ -15624,6 +15667,8 @@ namespace TL has_quote_text = 0x4, /// Field has a value has_quote_entities = 0x8, + /// Field has a value + has_quote_offset = 0x10, } } /// Reply to a story. See @@ -15979,4 +16024,143 @@ namespace TL has_gift_boosts = 0x10, } } + + /// See + [TLDef(0xB826E150)] + public class StoryFwdHeader : IObject + { + public Flags flags; + [IfFlag(0)] public Peer from; + [IfFlag(1)] public string from_name; + [IfFlag(2)] public int story_id; + + [Flags] public enum Flags : uint + { + has_from = 0x1, + has_from_name = 0x2, + has_story_id = 0x4, + modified = 0x8, + } + } + + /// See + public abstract class PostInteractionCounters : IObject + { + public int views; + public int forwards; + public int reactions; + } + /// See + [TLDef(0xE7058E7F)] + public class PostInteractionCountersMessage : PostInteractionCounters + { + public int msg_id; + } + /// See + [TLDef(0x8A480E27)] + public class PostInteractionCountersStory : PostInteractionCounters + { + public int story_id; + } + + /// See + [TLDef(0x50CD067C)] + public class Stats_StoryStats : IObject + { + public StatsGraphBase views_graph; + public StatsGraphBase reactions_by_emotion_graph; + } + + /// See + public abstract class PublicForward : IObject { } + /// See + [TLDef(0x01F2BF4A)] + public class PublicForwardMessage : PublicForward + { + public MessageBase message; + } + /// See + [TLDef(0xEDF3ADD0)] + public class PublicForwardStory : PublicForward + { + public Peer peer; + public StoryItemBase story; + } + + /// See + [TLDef(0x93037E20)] + public class Stats_PublicForwards : IObject, IPeerResolver + { + public Flags flags; + public int count; + public PublicForward[] forwards; + [IfFlag(0)] public string next_offset; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xB54B5ACF)] + public class PeerColor : IObject + { + public Flags flags; + [IfFlag(0)] public int color; + [IfFlag(1)] public long background_emoji_id; + + [Flags] public enum Flags : uint + { + has_color = 0x1, + has_background_emoji_id = 0x2, + } + } + + /// See + public abstract class Help_PeerColorSetBase : IObject { } + /// See + [TLDef(0x26219A58)] + public class Help_PeerColorSet : Help_PeerColorSetBase + { + public int[] colors; + } + /// See + [TLDef(0x767D61EB)] + public class Help_PeerColorProfileSet : Help_PeerColorSetBase + { + public int[] palette_colors; + public int[] bg_colors; + public int[] story_colors; + } + + /// See + [TLDef(0x135BD42F)] + public class Help_PeerColorOption : IObject + { + public Flags flags; + public int color_id; + [IfFlag(1)] public Help_PeerColorSetBase colors; + [IfFlag(2)] public Help_PeerColorSetBase dark_colors; + + [Flags] public enum Flags : uint + { + hidden = 0x1, + has_colors = 0x2, + has_dark_colors = 0x4, + } + } + + /// See + /// a value means help.peerColorsNotModified + [TLDef(0x00F8ED08)] + public class Help_PeerColors : IObject + { + public int hash; + public Help_PeerColorOption[] colors; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9c77ed5..db99dd6 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1155,11 +1155,11 @@ namespace TL }); /// See - public static Task Account_UpdateColor(this Client client, int color, long? background_emoji_id = null) + public static Task Account_UpdateColor(this Client client, long? background_emoji_id = null, int? color = null, bool for_profile = false) => client.Invoke(new Account_UpdateColor { - flags = (Account_UpdateColor.Flags)(background_emoji_id != null ? 0x1 : 0), - color = color, + flags = (Account_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), + color = color.GetValueOrDefault(), background_emoji_id = background_emoji_id.GetValueOrDefault(), }); @@ -3685,16 +3685,26 @@ namespace TL /// The wallpaper », obtained as described in the wallpaper documentation »; must not be provided when installing a wallpaper obtained from a service message (id must be provided, instead). /// Wallpaper settings, obtained as described in the wallpaper documentation » or from .wallpaper.settings. /// If the wallpaper was obtained from a service message, must contain the ID of that message. - public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null) + public static Task Messages_SetChatWallPaper(this Client client, InputPeer peer, InputWallPaperBase wallpaper = null, int? id = null, WallPaperSettings settings = null, bool for_both = false, bool revert = false) => client.Invoke(new Messages_SetChatWallPaper { - flags = (Messages_SetChatWallPaper.Flags)((wallpaper != null ? 0x1 : 0) | (id != null ? 0x2 : 0) | (settings != null ? 0x4 : 0)), + flags = (Messages_SetChatWallPaper.Flags)((wallpaper != null ? 0x1 : 0) | (id != null ? 0x2 : 0) | (settings != null ? 0x4 : 0) | (for_both ? 0x8 : 0) | (revert ? 0x10 : 0)), peer = peer, wallpaper = wallpaper, settings = settings, id = id.GetValueOrDefault(), }); + /// See + /// a null value means messages.foundStickerSetsNotModified + public static Task Messages_SearchEmojiStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) + => client.Invoke(new Messages_SearchEmojiStickerSets + { + flags = (Messages_SearchEmojiStickerSets.Flags)(exclude_featured ? 0x1 : 0), + q = q, + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4083,6 +4093,22 @@ namespace TL { }); + /// See + /// a null value means help.peerColorsNotModified + public static Task Help_GetPeerColors(this Client client, int hash = default) + => client.Invoke(new Help_GetPeerColors + { + hash = hash, + }); + + /// See + /// a null value means help.peerColorsNotModified + public static Task Help_GetPeerProfileColors(this Client client, int hash = default) + => client.Invoke(new Help_GetPeerProfileColors + { + hash = hash, + }); + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read @@ -4704,6 +4730,21 @@ namespace TL background_emoji_id = background_emoji_id.GetValueOrDefault(), }); + /// See + public static Task Channels_ToggleViewForumAsMessages(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleViewForumAsMessages + { + channel = channel, + enabled = enabled, + }); + + /// See + public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_GetChannelRecommendations + { + channel = channel, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5616,6 +5657,25 @@ namespace TL msg_id = msg_id, }); + /// See + public static Task Stats_GetStoryStats(this Client client, InputPeer peer, int id, bool dark = false) + => client.Invoke(new Stats_GetStoryStats + { + flags = (Stats_GetStoryStats.Flags)(dark ? 0x1 : 0), + peer = peer, + id = id, + }); + + /// See + public static Task Stats_GetStoryPublicForwards(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue) + => client.Invoke(new Stats_GetStoryPublicForwards + { + peer = peer, + id = id, + offset = offset, + limit = limit, + }); + /// Export a folder », creating a chat folder deep link ». See Possible codes: 400 (details) /// The folder to export /// An optional name for the link @@ -5742,10 +5802,10 @@ namespace TL /// Privacy rules for the story, indicating who can or can't view the story. /// Unique client message ID required to prevent message resending. You can use /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. - public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, bool pinned = false, bool noforwards = false) + public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { - flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0)), + flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (fwd_from_id != null ? 0x40 : 0) | (fwd_from_story != null ? 0x40 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (fwd_modified ? 0x80 : 0)), peer = peer, media = media, media_areas = media_areas, @@ -5754,6 +5814,8 @@ namespace TL privacy_rules = privacy_rules, random_id = random_id, period = period.GetValueOrDefault(), + fwd_from_id = fwd_from_id, + fwd_from_story = fwd_from_story.GetValueOrDefault(), }); /// Edit an uploaded story See Possible codes: 400 (details) @@ -6906,16 +6968,18 @@ namespace TL.Methods public string[] codes; } - [TLDef(0xA001CC43)] + [TLDef(0x7CEFA15D)] public class Account_UpdateColor : IMethod { public Flags flags; - public int color; + [IfFlag(2)] public int color; [IfFlag(0)] public long background_emoji_id; [Flags] public enum Flags : uint { has_background_emoji_id = 0x1, + for_profile = 0x2, + has_color = 0x4, } } @@ -9063,6 +9127,21 @@ namespace TL.Methods has_wallpaper = 0x1, has_id = 0x2, has_settings = 0x4, + for_both = 0x8, + revert = 0x10, + } + } + + [TLDef(0x92B4494C)] + public class Messages_SearchEmojiStickerSets : IMethod + { + public Flags flags; + public string q; + public long hash; + + [Flags] public enum Flags : uint + { + exclude_featured = 0x1, } } @@ -9359,6 +9438,18 @@ namespace TL.Methods [TLDef(0xB81B93D4)] public class Help_GetPremiumPromo : IMethod { } + [TLDef(0xDA80F42F)] + public class Help_GetPeerColors : IMethod + { + public int hash; + } + + [TLDef(0xABCFA9FD)] + public class Help_GetPeerProfileColors : IMethod + { + public int hash; + } + [TLDef(0xCC104937)] public class Channels_ReadHistory : IMethod { @@ -9843,6 +9934,19 @@ namespace TL.Methods } } + [TLDef(0x9738BB15)] + public class Channels_ToggleViewForumAsMessages : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + + [TLDef(0x83B70D97)] + public class Channels_GetChannelRecommendations : IMethod + { + public InputChannelBase channel; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -10606,6 +10710,28 @@ namespace TL.Methods } } + [TLDef(0x374FEF40)] + public class Stats_GetStoryStats : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } + + [TLDef(0xA6437EF6)] + public class Stats_GetStoryPublicForwards : IMethod + { + public InputPeer peer; + public int id; + public string offset; + public int limit; + } + [TLDef(0x8472478E)] public class Chatlists_ExportChatlistInvite : IMethod { @@ -10694,7 +10820,7 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0xBCB73644)] + [TLDef(0xE4E6694B)] public class Stories_SendStory : IMethod { public Flags flags; @@ -10706,6 +10832,8 @@ namespace TL.Methods public InputPrivacyRule[] privacy_rules; public long random_id; [IfFlag(3)] public int period; + [IfFlag(6)] public InputPeer fwd_from_id; + [IfFlag(6)] public int fwd_from_story; [Flags] public enum Flags : uint { @@ -10715,6 +10843,8 @@ namespace TL.Methods has_period = 0x8, noforwards = 0x10, has_media_areas = 0x20, + has_fwd_from_id = 0x40, + fwd_modified = 0x80, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 1fc5e29..3142dd1 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 = 166; // fetched 06/11/2023 22:51:44 + public const int Version = 167; // fetched 30/11/2023 15:07:08 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -121,7 +121,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0xEB602F25] = typeof(User), + [0x215C4438] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -133,7 +133,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x1981EA7E] = typeof(Channel), + [0x8E87CCD8] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), [0x723027BD] = typeof(ChannelFull), @@ -199,10 +199,10 @@ namespace TL [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0xFE77345D] = typeof(MessageActionRequestedPeer), - [0xBC44A927] = typeof(MessageActionSetChatWallPaper), - [0xC0787D6D] = typeof(MessageActionSetSameChatWallPaper), + [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), [0xD2CFDB0E] = typeof(MessageActionGiftCode), [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), + [0x2A9FADC5] = typeof(MessageActionGiveawayResults), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -385,6 +385,8 @@ namespace TL [0x2C084DC1] = typeof(UpdateStoriesStealthMode), [0x7D627683] = typeof(UpdateSentStoryReaction), [0x904DD49C] = typeof(UpdateBotChatBoost), + [0x07B68920] = typeof(UpdateChannelViewForumAsMessages), + [0xAE3F101D] = typeof(UpdatePeerWallpaper), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -942,8 +944,7 @@ namespace TL [0x4A27EB2D] = typeof(StatsGraphAsync), [0xBEDC9822] = typeof(StatsGraphError), [0x8EA464B6] = typeof(StatsGraph), - [0xAD4FC9BD] = typeof(MessageInteractionCounters), - [0xBDF78394] = typeof(Stats_BroadcastStats), + [0x396CA5FC] = typeof(Stats_BroadcastStats), [0x98F6AC75] = typeof(Help_PromoDataEmpty), [0x8C39793F] = typeof(Help_PromoData), [0xDE33B094] = typeof(VideoSize), @@ -961,11 +962,11 @@ namespace TL [0x455B853D] = typeof(MessageViews), [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), - [0x6EEBCABD] = typeof(MessageReplyHeader), + [0xAFBC09DB] = typeof(MessageReplyHeader), [0x9C98BFC1] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), - [0x8999F295] = typeof(Stats_MessageStats), + [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), [0xD597650C] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), @@ -998,7 +999,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xDAAFFF6B] = typeof(SponsoredMessage), + [0xED5383F7] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1043,7 +1044,7 @@ namespace TL [0xC326CAEF] = typeof(InputInvoiceSlug), [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), - [0x93752C52] = typeof(Messages_TranscribedAudio), + [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), @@ -1121,14 +1122,14 @@ namespace TL [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), - [0x44C457CE] = typeof(StoryItem), + [0xAF6365A1] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), [0x5DD8C3C8] = typeof(Stories_Stories), [0xB0BDEAC5] = typeof(StoryView), [0x46E9B9EC] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0x073EC805] = typeof(InputReplyToMessage), + [0x22C0F6D5] = typeof(InputReplyToMessage), [0x15B0F283] = typeof(InputReplyToStory), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), @@ -1150,6 +1151,19 @@ namespace TL [0xC448415C] = typeof(MyBoost), [0x9AE228E2] = typeof(Premium_MyBoosts), [0x4959427A] = typeof(Premium_BoostsStatus), + [0xB826E150] = typeof(StoryFwdHeader), + [0xE7058E7F] = typeof(PostInteractionCountersMessage), + [0x8A480E27] = typeof(PostInteractionCountersStory), + [0x50CD067C] = typeof(Stats_StoryStats), + [0x01F2BF4A] = typeof(PublicForwardMessage), + [0xEDF3ADD0] = typeof(PublicForwardStory), + [0x93037E20] = typeof(Stats_PublicForwards), + [0xB54B5ACF] = typeof(PeerColor), + [0x26219A58] = typeof(Help_PeerColorSet), + [0x767D61EB] = typeof(Help_PeerColorProfileSet), + [0x135BD42F] = typeof(Help_PeerColorOption), + [0x2BA1F5CE] = null,//Help_PeerColorsNotModified + [0x00F8ED08] = typeof(Help_PeerColors), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1272,6 +1286,7 @@ namespace TL [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified [typeof(BotApp)] = 0x5DA674B7, //botAppNotModified + [typeof(Help_PeerColors)] = 0x2BA1F5CE, //help.peerColorsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index a7397e8..a0081dd 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: 166 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 167 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 7c65ce70ec6de3f7e8f14be76e550f8f8a8c4d0c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 5 Dec 2023 01:13:19 +0100 Subject: [PATCH 147/336] api doc --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 2 +- src/TL.Helpers.cs | 3 +- src/TL.Schema.cs | 68 ++++++++++++++++++++++++++++++------------- src/TL.SchemaFuncs.cs | 67 +++++++++++++++++++++--------------------- 5 files changed, 85 insertions(+), 57 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ec24e3c..4624127 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.1-dev.$(Rev:r) +name: 3.6.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index e7f0774..4bed1ae 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -505,7 +505,7 @@ namespace WTelegram /// first letters used to search for in participants names
(default values crafted with ♥ to find most latin and cyrillic names) /// second (and further) letters used to search for in participants names /// Can be used to abort the work of this method - /// Field count indicates the total count of members. Field participants contains those that were successfully fetched + /// Field count indicates the total count of members. Field participants contains those that were successfully fetched /// ⚠ This method can take a few minutes to complete on big broadcast channels. It likely won't be able to obtain the full total count of members public async Task Channels_GetAllParticipants(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ", CancellationToken cancellationToken = default) { diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 8d2636c..6907426 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -27,7 +27,7 @@ namespace TL } partial class InputPeerChat { - /// ⚠ Only for small private Chat. Chat groups of type Channel must use InputPeerChannel. See Terminology in README + /// This type is only for basic Chat. See Terminology in the README to understand what this means
Chat groups of type Channel must use .
/// Chat identifier public InputPeerChat(long chat_id) => this.chat_id = chat_id; internal InputPeerChat() { } @@ -207,6 +207,7 @@ namespace TL { /// Is this chat among current user active chats? public abstract bool IsActive { get; } + /// Is this chat a broadcast channel? public virtual bool IsChannel => false; public bool IsGroup => !IsChannel; public virtual string MainUsername => null; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 130f26f..4068515 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -774,6 +774,7 @@ namespace TL [IfFlag(30)] public EmojiStatus emoji_status; /// Additional usernames [IfFlag(32)] public Username[] usernames; + /// ID of the maximum read story. [IfFlag(37)] public int stories_max_id; [IfFlag(40)] public PeerColor color; [IfFlag(41)] public PeerColor profile_color; @@ -844,6 +845,7 @@ namespace TL has_usernames = 0x1, /// Whether we can edit the profile picture, name, about text and description of this bot because we own it. bot_can_edit = 0x2, + /// Whether we marked this user as a close friend, see here » for more info close_friend = 0x4, /// Whether we have hidden » all active stories of this user. stories_hidden = 0x8, @@ -1025,6 +1027,7 @@ namespace TL [IfFlag(17)] public int participants_count; /// Additional usernames [IfFlag(32)] public Username[] usernames; + /// ID of the maximum read story. [IfFlag(36)] public int stories_max_id; [IfFlag(39)] public PeerColor color; @@ -1032,7 +1035,7 @@ namespace TL { /// Whether the current user is the creator of this channel creator = 0x1, - /// Whether the current user has left this channel + /// Whether the current user has left or is not a member of this channel left = 0x4, /// Is this a channel? broadcast = 0x20, @@ -1088,7 +1091,9 @@ namespace TL { /// Field has a value has_usernames = 0x1, + /// Whether we have hidden all stories posted by this channel ». stories_hidden = 0x2, + /// If set, indicates that the stories_hidden flag was not populated, and its value must cannot be relied on; use the previously cached value, or re-fetch the constructor using Channels_GetChannels to obtain the latest value of the stories_hidden flag. stories_hidden_min = 0x4, stories_unavailable = 0x8, /// Field has a value @@ -1428,6 +1433,7 @@ namespace TL translations_disabled = 0x8, /// Field has a value has_stories = 0x10, + /// Whether this user has some pinned stories. stories_pinned_available = 0x20, view_forum_as_messages = 0x40, } @@ -1968,20 +1974,24 @@ namespace TL /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } - /// See + /// Represents a forwarded story or a story mention. See [TLDef(0x68CB6283)] public class MessageMediaStory : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Peer that posted the story. public Peer peer; + /// Story ID public int id; + /// The story itself, if absent fetch it using Stories_GetStoriesByID and the peer/id parameters specified above. [IfFlag(0)] public StoryItemBase story; [Flags] public enum Flags : uint { /// Field has a value has_story = 0x1, + /// If set, indicates that this someone has mentioned us in this story (i.e. by tagging us in the description) or vice versa, we have mentioned the other peer (if the message is outgoing). via_mention = 0x2, } } @@ -2197,6 +2207,7 @@ namespace TL attach_menu = 0x2, /// Field has a value has_app = 0x4, + /// We have allowed the bot to send us messages using Bots_AllowSendMessage. from_request = 0x8, } } @@ -3065,6 +3076,7 @@ namespace TL [IfFlag(19)] public PremiumGiftOption[] premium_gifts; /// Wallpaper to use in the private chat with the user. [IfFlag(24)] public WallPaperBase wallpaper; + /// Active stories » [IfFlag(25)] public PeerStories stories; [Flags] public enum Flags : uint @@ -3115,7 +3127,9 @@ namespace TL has_wallpaper = 0x1000000, /// Field has a value has_stories = 0x2000000, + /// Whether this user has some pinned stories. stories_pinned_available = 0x4000000, + /// Whether we've blocked this user, preventing them from seeing our stories ». blocked_my_stories_from = 0x8000000, wallpaper_overridden = 0x10000000, } @@ -8223,7 +8237,7 @@ namespace TL [IfFlag(1)] public string next_offset; /// Shown as a button on top of the remaining inline result list; if clicked, redirects the user to a private chat with the bot with the specified start parameter. [IfFlag(2)] public InlineBotSwitchPM switch_pm; - /// Shown as a button on top of the remaining inline result list; if clicked, opens the specified bot mini app. + /// Shown as a button on top of the remaining inline result list; if clicked, opens the specified inline mode mini app. [IfFlag(3)] public InlineBotWebView switch_webview; /// The results public BotInlineResultBase[] results; @@ -10736,7 +10750,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Join events + /// Join events, including joins using invite links and join requests. join = 0x1, /// Leave events leave = 0x2, @@ -10754,9 +10768,9 @@ namespace TL promote = 0x80, /// Admin demotion events demote = 0x100, - /// Info change events (when about, linked chat, location, photo, stickerset, title or username data of a channel gets modified) + /// Info change events (when about, linked chat, location, photo, stickerset, title or username, slowmode, history TTL settings of a channel gets modified) info = 0x200, - /// Settings change events (invites, hidden prehistory, signatures, default banned rights) + /// Settings change events (invites, hidden prehistory, signatures, default banned rights, forum toggle events) settings = 0x400, /// Message pin events pinned = 0x800, @@ -12575,14 +12589,17 @@ namespace TL has_settings = 0x2, } } - /// See + /// Webpage preview of a Telegram story See [TLDef(0x2E94C3E7)] public class WebPageAttributeStory : WebPageAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Peer that posted the story public Peer peer; + /// Story ID public int id; + /// May contain the story, if not the story should be fetched when and if needed using Stories_GetStoriesByID with the above id and peer. [IfFlag(0)] public StoryItemBase story; [Flags] public enum Flags : uint @@ -14845,7 +14862,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Total number of topics matching query; may be less than the topics contained in topics, in which case pagination is required. + /// Total number of topics matching query; may be more than the topics contained in topics, in which case pagination is required. public int count; /// Forum topics public ForumTopicBase[] topics; @@ -14860,7 +14877,7 @@ namespace TL [Flags] public enum Flags : uint { - /// Whether the returned topics are ordered by creation date; if set, pagination by next_offset should use .date; otherwise topics are ordered by the last message date, so paginate by the date of the referenced by .top_message. + /// Whether the returned topics are ordered by creation date; if set, pagination by offset_date should use .date; otherwise topics are ordered by the last message date, so paginate by the date of the referenced by .top_message. order_by_create_date = 0x1, } /// returns a or for the given Peer @@ -15078,28 +15095,28 @@ namespace TL public JsonObject config; } - /// Used to fetch information about a named bot mini app See Derived classes: , + /// Used to fetch information about a named Mini App See Derived classes: , public abstract class InputBotApp : IObject { } - /// Used to fetch information about a named bot mini app by its ID See + /// Used to fetch information about a named Mini App by its ID See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { - /// named bot mini app ID. + /// named Mini App ID. public long id; /// REQUIRED FIELD. See how to obtain it
Access hash, obtained from the .
public long access_hash; } - /// Used to fetch information about a named bot mini app by its short name See + /// Used to fetch information about a named Mini App by its short name See [TLDef(0x908C0407)] public class InputBotAppShortName : InputBotApp { /// ID of the bot that owns the bot mini app public InputUserBase bot_id; - /// Short name, obtained from a named bot mini app deep link + /// Short name, obtained from a named Mini App deep link public string short_name; } - /// Contains information about a named bot mini app. See + /// Contains information about a named Mini App. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] public class BotApp : IObject @@ -15110,7 +15127,7 @@ namespace TL public long id; /// bot mini app access hash public long access_hash; - /// bot mini app short name, used to generate named bot mini app deep links. + /// bot mini app short name, used to generate named Mini App deep links. public string short_name; /// bot mini app title. public string title; @@ -15130,7 +15147,7 @@ namespace TL } } - /// Contains information about a named bot mini app See + /// Contains information about a named Mini App See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { @@ -15149,9 +15166,9 @@ namespace TL } } - /// Contains the link that must be used to open a named bot mini app. See Derived classes: + /// Contains the link that must be used to open a named Mini App. See Derived classes: public abstract class AppWebViewResult : IObject { } - /// Contains the link that must be used to open a named bot mini app. See + /// Contains the link that must be used to open a named Mini App. See [TLDef(0x3C1B4F0D)] public class AppWebViewResultUrl : AppWebViewResult { @@ -15159,7 +15176,7 @@ namespace TL public string url; } - /// Specifies a bot mini app button, shown on top of the inline query results list. See + /// Specifies an inline mode mini app button, shown on top of the inline query results list. See [TLDef(0xB57295D5)] public class InlineBotWebView : IObject { @@ -15405,6 +15422,7 @@ namespace TL [IfFlag(2)] public int forwards_count; /// All reactions sent to this story [IfFlag(3)] public ReactionCount[] reactions; + /// Number of reactions added to the story [IfFlag(4)] public int reactions_count; /// User IDs of some recent viewers of the story [IfFlag(0)] public long[] recent_viewers; @@ -15454,6 +15472,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether this story can only be viewed by our close friends, see here » for more info close_friends = 0x100, } @@ -15500,15 +15519,19 @@ namespace TL has_views = 0x8, /// Whether this story is pinned on the user's profile pinned = 0x20, - /// Whether this story is public + /// Whether this story is public and can be viewed by everyone public_ = 0x80, + /// Whether this story can only be viewed by our close friends, see here » for more info close_friends = 0x100, + /// Full information about this story was omitted for space and performance reasons; use Stories_GetStoriesByID to fetch full info about this story when and if needed. min = 0x200, /// Whether this story is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera). noforwards = 0x400, /// Indicates whether the story was edited. edited = 0x800, + /// Whether this story can only be viewed by our contacts contacts = 0x1000, + /// Whether this story can only be viewed by a select list of our contacts selected_contacts = 0x2000, /// Field has a value has_media_areas = 0x4000, @@ -15600,7 +15623,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether we have completely blocked this user, including from viewing more of our stories. blocked = 0x1, + /// Whether we have blocked this user from viewing more of our stories. blocked_my_stories_from = 0x2, /// Field has a value has_reaction = 0x4, @@ -15615,6 +15640,7 @@ namespace TL public Flags flags; /// Total number of results that can be fetched public int count; + /// Number of reactions that were added to the story public int reactions_count; /// Story view date and reaction information public StoryView[] views; diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index db99dd6..c0aff4c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1436,7 +1436,7 @@ namespace TL limit = limit, }); - /// This method is only for basic Chat. See Terminology 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: ✓]
+ /// 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) => client.Invoke(new Messages_GetMessages @@ -1486,8 +1486,8 @@ namespace TL hash = hash, }); - /// Returns found messages See Possible codes: 400,403 (details) - /// User or chat, histories with which are searched, or for global search + /// Search for messages. See Possible codes: 400,403 (details) + /// User or chat, histories with which are searched, or to search in all private chats and normal groups (not channels) ». Use Messages_SearchGlobal to search globally in all chats, groups, supergroups and channels. /// Text search request /// Only return messages sent by the specified user ID /// Thread ID @@ -1546,7 +1546,7 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
+ /// 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
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) @@ -1556,7 +1556,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
+ /// 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
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. public static Task Messages_ReceivedMessages(this Client client, int max_id = default) => client.Invoke(new Messages_ReceivedMessages @@ -1693,7 +1693,7 @@ namespace TL message = message, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Returns chat basic info on their IDs. See
[bots: ✓] Possible codes: 400 (details)
+ /// 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 chat basic info on their IDs. See [bots: ✓] Possible codes: 400 (details)
/// List of chat IDs public static Task Messages_GetChats(this Client client, params long[] id) => client.Invoke(new Messages_GetChats @@ -1701,7 +1701,7 @@ namespace TL id = id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Get full info about a basic group. See [bots: ✓] Possible codes: 400 (details)
/// Basic group ID. public static Task Messages_GetFullChat(this Client client, long chat_id) => client.Invoke(new Messages_GetFullChat @@ -1709,7 +1709,7 @@ namespace TL chat_id = chat_id, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Changes chat name and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// New chat name, different from the old one public static Task Messages_EditChatTitle(this Client client, long chat_id, string title) @@ -1719,7 +1719,7 @@ namespace TL title = title, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Changes chat photo and sends a service message on it See [bots: ✓] Possible codes: 400 (details)
/// Chat ID /// Photo to be set public static Task Messages_EditChatPhoto(this Client client, long chat_id, InputChatPhotoBase photo) @@ -1729,7 +1729,7 @@ namespace TL photo = photo, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
+ /// 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
Adds a user to a chat and sends a service message on it. See Possible codes: 400,403 (details)
/// Chat ID /// User ID to be added /// Number of last messages to be forwarded @@ -1741,7 +1741,7 @@ namespace TL fwd_limit = fwd_limit, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Deletes a user from a chat and sends a service message on it. See [bots: ✓] Possible codes: 400 (details)
/// Remove the entire chat history of the specified user in this chat. /// Chat ID /// User ID to be deleted @@ -1888,7 +1888,7 @@ namespace TL peer = peer, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// 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
Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.Invoke(new Messages_ReadMessageContents @@ -1945,7 +1945,7 @@ namespace TL title = title, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406,500 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2016,7 +2016,7 @@ namespace TL increment = increment, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Make a user admin in a basic group. See Possible codes: 400 (details)
+ /// 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
Make a user admin in a basic group. See Possible codes: 400 (details)
/// The ID of the group /// The user to make admin /// Whether to make them admin @@ -2028,7 +2028,7 @@ namespace TL is_admin = is_admin, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
+ /// 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
Turn a basic group into a supergroup See Possible codes: 400,403,500 (details)
/// Basic group to migrate public static Task Messages_MigrateChat(this Client client, long chat_id) => client.Invoke(new Messages_MigrateChat @@ -2128,7 +2128,7 @@ namespace TL /// The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300. /// Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes. /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to a private chat with the bot and sends the bot a start message with a certain parameter. - /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified bot mini app. + /// If passed, clients will display a button on top of the remaining inline result list with the specified text, that switches the user to the specified inline mode mini app. public static Task Messages_SetInlineBotResults(this Client client, long query_id, InputBotInlineResultBase[] results, int cache_time, string next_offset = null, InlineBotSwitchPM switch_pm = null, InlineBotWebView switch_webview = null, bool gallery = false, bool private_ = false) => client.Invoke(new Messages_SetInlineBotResults { @@ -2967,7 +2967,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Delete a chat See Possible codes: 400 (details)
+ /// 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
Delete a chat See Possible codes: 400 (details)
/// Chat ID public static Task Messages_DeleteChat(this Client client, long chat_id) => client.Invoke(new Messages_DeleteChat @@ -3436,10 +3436,10 @@ namespace TL /// Open a bot mini app. See /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. - /// Set this flag if opening the Mini App from the installed side menu entry » or from a startapp link ». + /// Set this flag if opening the Mini App from the installed side menu entry » or from a Mini App link ». /// Bot that owns the mini app /// Web app URL, if opening from a keyboard button or inline result - /// Start parameter, if opening from a startapp link ». + /// Start parameter, if opening from a Mini App link ». /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false) @@ -3453,7 +3453,7 @@ namespace TL platform = platform, }); - /// This method is only for basic Chat. See Terminology to understand what this means
Search for a similar method name starting with Channels_ if you're dealing with a
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
/// Webview interaction ID obtained from Messages_RequestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) @@ -3652,8 +3652,8 @@ namespace TL peer = peer, }); - /// Obtain information about a named bot mini app See Possible codes: 400 (details) - /// Bot app information obtained from a named bot mini app deep link ». + /// Obtain information about a named Mini App See Possible codes: 400 (details) + /// Bot app information obtained from a named Mini App deep link ». /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp @@ -3662,11 +3662,11 @@ namespace TL hash = hash, }); - /// Open a bot mini app from a named bot mini app deep link, sending over user information after user confirmation. See - /// Set this flag if the bot is asking permission to send messages to the user as specified in the named bot mini app deep link docs, and the user agreed. + /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See + /// Set this flag if the bot is asking permission to send messages to the user as specified in the named Mini App deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. - /// The app obtained by invoking Messages_GetBotApp as specified in the named bot mini app deep link docs. - /// If the startapp query string parameter is present in the named bot mini app deep link, pass it to start_param. + /// The app obtained by invoking Messages_GetBotApp as specified in the named Mini App deep link docs. + /// If the startapp query string parameter is present in the named Mini App deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) @@ -3785,7 +3785,7 @@ namespace TL /// Returns the list of user photos. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped - /// If a positive value was transferred, the method will return only photos with IDs less than the set one + /// If a positive value was transferred, the method will return only photos with IDs less than the set one. This parameter is often useful when refetching file references », as in conjuction with limit=1 and offset=-1 the object with the id specified in max_id can be fetched. /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset = default, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Photos_GetUserPhotos @@ -4194,7 +4194,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,406 (details) + /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -4601,10 +4601,10 @@ namespace TL /// Get topics of a forum See Possible codes: 400 (details) /// Supergroup /// Search query - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination + /// Offsets for pagination, for more info click here, date of the last message of the last found topic. Use 0 or any date in the future to get results from the last topic. + /// Offsets for pagination, for more info click here, ID of the last message of the last found topic (or initially 0). + /// Offsets for pagination, for more info click here, ID of the last found topic (or initially 0). + /// Maximum number of results to return, see pagination. For optimal performance, the number of returned topics is chosen by the server and can be smaller than the specified limit. public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) => client.Invoke(new Channels_GetForumTopics { @@ -4669,7 +4669,7 @@ namespace TL }); /// Reorder pinned forum topics See [bots: ✓] - /// If set, topics pinned server-side but not present in the order field will be unpinned. + /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) /// Supergroup ID ///
Topic IDs » public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) @@ -5936,6 +5936,7 @@ namespace TL /// Obtain the list of users that have viewed a specific story we posted See Possible codes: 400 (details) /// Whether to only fetch view reaction/views made by our contacts + /// Whether to return info about users that reacted to the story (i.e. if set, the server will also sort results based on the presence of a reaction, after sorting it by date as usual). /// Peer where the story was posted /// Search for specific peers /// Story ID From 5f51b1f77eb6d0bfbc458d9e028738dfb9555a5a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:39:55 +0100 Subject: [PATCH 148/336] MBox helpers for updates --- .github/workflows/telegram-api.yml | 2 +- README.md | 2 +- src/TL.Helpers.cs | 3 ++ src/TL.Schema.cs | 57 ++++++++++++++++++++++++++++-- 4 files changed, 59 insertions(+), 5 deletions(-) diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index ca93ff0..b2e6a52 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -16,7 +16,7 @@ jobs: with: support-label: 'telegram api' issue-comment: > - **Github Issues** should be used only for problems with the library itself. + Please note that **Github Issues** should be used only for problems with the library code itself. For questions about Telegram API usage, you can search the [API official documentation](https://core.telegram.org/api#getting-started) or [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. diff --git a/README.md b/README.md index a715c3e..44fe5df 100644 --- a/README.md +++ b/README.md @@ -188,7 +188,7 @@ This library works best with **.NET 5.0+** (faster, no dependencies) and is also This library can be used for any Telegram scenario including: - Sequential or parallel automated steps based on API requests/responses - Real-time [monitoring](https://wiz0u.github.io/WTelegramClient/EXAMPLES#updates) of incoming Updates/Messages -- Download/upload of files/media +- [Download](https://wiz0u.github.io/WTelegramClient/EXAMPLES#download)/[upload](https://wiz0u.github.io/WTelegramClient/EXAMPLES#upload) of files/media - Exchange end-to-end encrypted messages/files in [Secret Chats](https://wiz0u.github.io/WTelegramClient/EXAMPLES#e2e) - Building a full-featured interactive client diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 6907426..6f0021d 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -430,18 +430,21 @@ namespace TL public virtual Dictionary Chats => NoChats; private static readonly Dictionary NoUsers = new(); private static readonly Dictionary NoChats = new(); + public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; } partial class UpdatesCombined { public override Update[] UpdateList => updates; public override Dictionary Users => users; public override Dictionary Chats => chats; + public override (long mbox_id, int pts, int pts_count) GetMBox() => (-2, seq, seq - seq_start + 1); } partial class Updates { public override Update[] UpdateList => updates; public override Dictionary Users => users; public override Dictionary Chats => chats; + public override (long mbox_id, int pts, int pts_count) GetMBox() => (-2, seq, 1); } partial class UpdatesTooLong { public override Update[] UpdateList => Array.Empty(); } partial class UpdateShort { public override Update[] UpdateList => new[] { update }; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 4068515..6c39236 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3455,7 +3455,10 @@ namespace TL public class InputMessagesFilterPinned : MessagesFilter { } /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , - public abstract class Update : IObject { } + public abstract class Update : IObject + { + public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; + } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] public class UpdateNewMessage : Update @@ -3466,6 +3469,8 @@ namespace TL public int pts; /// Number of generated events public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] @@ -3486,6 +3491,8 @@ namespace TL public int pts; /// Number of generated events public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See [TLDef(0xC01E857F, inheritBefore = true)] @@ -3557,6 +3564,8 @@ namespace TL public EncryptedMessageBase message; /// New qts value, see updates » for more info. public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// Interlocutor is typing a message in an encrypted chat. Update period is 6 second. If upon this time there is no repeated update, it shall be considered that the interlocutor stopped typing. See [TLDef(0x1710F156)] @@ -3689,6 +3698,8 @@ namespace TL /// Field has a value has_folder_id = 0x1, } + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// Outgoing messages were read See [TLDef(0x2F2F21BF)] @@ -3702,6 +3713,8 @@ namespace TL public int pts; /// Number of events that were generated public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// An instant view webpage preview was generated See [TLDef(0x7F891213)] @@ -3713,6 +3726,8 @@ namespace TL public int pts; /// Number of events that were generated public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// Contents of messages in the common message box were read See [TLDef(0xF8227181)] @@ -3733,6 +3748,8 @@ namespace TL /// Field has a value has_date = 0x1, } + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] @@ -3750,6 +3767,8 @@ namespace TL /// Field has a value has_pts = 0x1, } + + public override (long, int, int) GetMBox() => (channel_id, pts, 0); } /// A new channel or supergroup is available, or info about an existing channel has changed and must be refeteched. See [TLDef(0x635B4C09)] @@ -3760,7 +3779,10 @@ namespace TL } /// A new message was sent in a channel/supergroup See [TLDef(0x62BA04D9)] - public class UpdateNewChannelMessage : UpdateNewMessage { } + public class UpdateNewChannelMessage : UpdateNewMessage + { + public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + } /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] public class UpdateReadChannelInbox : Update @@ -3783,6 +3805,8 @@ namespace TL /// Field has a value has_folder_id = 0x1, } + + public override (long, int, int) GetMBox() => (channel_id, pts, 0); } /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12)] @@ -3790,6 +3814,8 @@ namespace TL { /// Channel ID public long channel_id; + + public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); } /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08, inheritBefore = true)] @@ -3897,7 +3923,10 @@ namespace TL } /// A message was edited in a channel/supergroup See [TLDef(0x1B3F4DF7)] - public class UpdateEditChannelMessage : UpdateEditMessage { } + public class UpdateEditChannelMessage : UpdateEditMessage + { + public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + } /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] public class UpdateBotCallbackQuery : Update @@ -3937,6 +3966,8 @@ namespace TL public int pts; /// PTS count public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] @@ -4011,6 +4042,8 @@ namespace TL { /// Channel/supergroup ID public long channel_id; + + public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); } /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] @@ -4218,6 +4251,8 @@ namespace TL public int pts; /// Number of events that were generated public int pts_count; + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] @@ -4282,6 +4317,8 @@ namespace TL public byte[][] options; /// New qts value, see updates » for more info. public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// A new folder was added See [TLDef(0x26FFDE7D)] @@ -4420,6 +4457,8 @@ namespace TL /// Whether the messages were pinned or unpinned pinned = 0x1, } + + public override (long, int, int) GetMBox() => (0, pts, pts_count); } /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] @@ -4441,6 +4480,8 @@ namespace TL /// Whether the messages were pinned or unpinned pinned = 0x1, } + + public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); } /// A new chat is available See [TLDef(0xF89A6A4E)] @@ -4518,6 +4559,8 @@ namespace TL /// Field has a value has_invite = 0x4, } + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] @@ -4553,6 +4596,8 @@ namespace TL /// Whether the participant joined using a chat folder deep link ». via_chatlist = 0x8, } + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] @@ -4566,6 +4611,8 @@ namespace TL public bool stopped; /// New qts value, see updates » for more info. public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// New WebRTC parameters See [TLDef(0x0B783982)] @@ -4620,6 +4667,8 @@ namespace TL public ExportedChatInvite invite; /// QTS event sequence identifier public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// New message reactions » are available See [TLDef(0x5E1B3CB8)] @@ -4832,6 +4881,8 @@ namespace TL public Peer peer; public Boost boost; public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); } /// See [TLDef(0x07B68920, inheritBefore = true)] From cce7a64cd924e723c5158d1514cd97a9e51f58d4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 17 Dec 2023 23:40:26 +0100 Subject: [PATCH 149/336] api doc --- src/TL.Schema.cs | 208 ++++++++++++++++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 109 ++++++++++++++++------ 2 files changed, 251 insertions(+), 66 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6c39236..7d45260 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -178,7 +178,7 @@ namespace TL public override string Name { get => name; set => name = value; } } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract class InputMedia : IObject { } /// Photo See @@ -468,6 +468,7 @@ namespace TL [TLDef(0xC21B8849)] public class InputMediaWebPage : InputMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string url; @@ -597,7 +598,7 @@ namespace TL /// REQUIRED FIELD. See how to obtain it
Checksum, access_hash parameter value from
public long access_hash; } - ///
Empty constructor for takeout See + /// Used to download a JSON file that will contain all personal data related to features that do not have a specialized takeout method yet, see here » for more info on the takeout API. See [TLDef(0x29BE5899)] public class InputTakeoutFileLocation : InputFileLocationBase { } /// Use this object to download a photo with Upload_GetFile method See @@ -1707,6 +1708,7 @@ namespace TL has_ttl_period = 0x2000000, /// Whether this message is protected and thus cannot be forwarded; clients should also prevent users from saving attached media (i.e. videos should only be streamed, photos should be kept in RAM, et cetera). noforwards = 0x4000000, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8000000, } @@ -1780,7 +1782,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -1860,6 +1862,7 @@ namespace TL [TLDef(0xDDF10C3B)] public partial class MessageMediaWebPage : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Webpage preview public WebPageBase webpage; @@ -1999,6 +2002,7 @@ namespace TL [TLDef(0x58260664)] public class MessageMediaGiveaway : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long[] channels; [IfFlag(1)] public string[] countries_iso2; @@ -2009,11 +2013,12 @@ namespace TL [Flags] public enum Flags : uint { only_new_subscribers = 0x1, + /// Field has a value has_countries_iso2 = 0x2, } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract class MessageAction : IObject { } /// Group created See @@ -2406,13 +2411,16 @@ namespace TL [TLDef(0x5060A3F4)] public class MessageActionSetChatWallPaper : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// New wallpaper public WallPaperBase wallpaper; [Flags] public enum Flags : uint { + /// If set, indicates the user applied a wallpaper » previously sent by the other user in a message. same = 0x1, + /// If set, indicates the wallpaper was forcefully applied for both sides, without explicit confirmation from the other side.
If the message is incoming, and we did not like the new wallpaper the other user has chosen for us, we can re-set our previous wallpaper just on our side, by invoking Messages_SetChatWallPaper, providing only the revert flag (and obviously the peer parameter).
for_both = 0x2, } } @@ -2420,6 +2428,7 @@ namespace TL [TLDef(0xD2CFDB0E)] public class MessageActionGiftCode : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public Peer boost_peer; public int months; @@ -2428,6 +2437,7 @@ namespace TL [Flags] public enum Flags : uint { via_giveaway = 0x1, + /// Field has a value has_boost_peer = 0x2, unclaimed = 0x4, } @@ -3131,6 +3141,7 @@ namespace TL stories_pinned_available = 0x4000000, /// Whether we've blocked this user, preventing them from seeing our stories ». blocked_my_stories_from = 0x8000000, + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, } } @@ -3454,7 +3465,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -3655,6 +3666,7 @@ namespace TL popup = 0x1, /// Field has a value has_inbox_date = 0x2, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x4, } } @@ -4890,16 +4902,19 @@ namespace TL { public bool enabled; } - /// See + /// The wallpaper » of a given peer has changed. See [TLDef(0xAE3F101D)] public class UpdatePeerWallpaper : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The peer where the wallpaper has changed. public Peer peer; [IfFlag(0)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint { + /// Field has a value has_wallpaper = 0x1, wallpaper_overridden = 0x2, } @@ -6355,6 +6370,7 @@ namespace TL [TLDef(0x211A1788)] public class WebPageEmpty : WebPageBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Preview ID public long id; @@ -6374,6 +6390,7 @@ namespace TL [TLDef(0xB0D13E47)] public class WebPagePending : WebPageBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// ID of preview public long id; @@ -7195,7 +7212,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -7678,7 +7695,7 @@ namespace TL public DocumentBase[] gifs; } - /// Represents a sent inline message from the perspective of a bot See Derived classes: , , , , , , + /// Represents a sent inline message from the perspective of a bot See Derived classes: , , , , , , , public abstract class InputBotInlineMessage : IObject { } /// A media See [TLDef(0x3380C786)] @@ -7699,6 +7716,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, } } @@ -7723,6 +7741,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, } } @@ -7855,16 +7874,21 @@ namespace TL [TLDef(0xBDDCC510)] public class InputBotInlineMessageMediaWebPage : InputBotInlineMessage { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; public string url; [IfFlag(2)] public ReplyMarkup reply_markup; [Flags] public enum Flags : uint { + /// Field has a value has_entities = 0x2, + /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, force_large_media = 0x10, force_small_media = 0x20, @@ -7989,7 +8013,7 @@ namespace TL public override InputBotInlineMessage SendMessage { get => send_message; set => send_message = value; } } - /// Inline message See Derived classes: , , , , , + /// Inline message See Derived classes: , , , , , , public abstract class BotInlineMessage : IObject { } /// Send whatever media is attached to the See [TLDef(0x764CF810)] @@ -8010,6 +8034,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, } } @@ -8034,6 +8059,7 @@ namespace TL has_entities = 0x2, /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, } } @@ -8151,16 +8177,21 @@ namespace TL [TLDef(0x809AD9A6)] public class BotInlineMessageMediaWebPage : BotInlineMessage { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string message; + /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; public string url; [IfFlag(2)] public ReplyMarkup reply_markup; [Flags] public enum Flags : uint { + /// Field has a value has_entities = 0x2, + /// Field has a value has_reply_markup = 0x4, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, force_large_media = 0x10, force_small_media = 0x20, @@ -8703,6 +8734,7 @@ namespace TL has_reply_to = 0x10, /// Field has a value has_media = 0x20, + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x40, } } @@ -10398,7 +10430,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -10749,14 +10781,14 @@ namespace TL /// Whether antispam functionality was enabled or disabled. public bool new_value; } - /// See + /// The background profile color » of a channel was changed. See [TLDef(0x3C2B247B)] public class ChannelAdminLogEventActionChangeColor : ChannelAdminLogEventAction { public int prev_value; public int new_value; } - /// See + /// The custom emoji used to generate the pattern of the background profile color » of a channel was changed. See [TLDef(0x445FC434)] public class ChannelAdminLogEventActionChangeBackgroundEmoji : ChannelAdminLogEventAction { @@ -13208,7 +13240,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Discussion messages + /// The messages from which the thread starts. The messages are returned in reverse chronological order (i.e., in order of decreasing message ID). public MessageBase[] messages; /// Message ID of latest reply in this thread [IfFlag(0)] public int max_id; @@ -13253,6 +13285,7 @@ namespace TL /// ID of the message that started this message thread [IfFlag(1)] public int reply_to_top_id; [IfFlag(6)] public string quote_text; + /// Message entities for styled text [IfFlag(7)] public MessageEntity[] quote_entities; [IfFlag(10)] public int quote_offset; @@ -14414,7 +14447,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , + /// An invoice See Derived classes: , , public abstract class InputInvoice : IObject { } /// An invoice contained in a message. See [TLDef(0xC5B56859)] @@ -14458,7 +14491,9 @@ namespace TL public long transcription_id; /// Transcripted text public string text; + /// For non-Premium users, this flag will be set, indicating the remaining transcriptions in the free trial period. [IfFlag(1)] public int trial_remains_num; + /// For non-Premium users, this flag will be set, indicating the date when the trial_remains_num counter will be reset to the maximum value of transcribe_audio_trial_weekly_number. [IfFlag(1)] public DateTime trial_remains_until_date; [Flags] public enum Flags : uint @@ -14488,7 +14523,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , + /// Info about a Telegram Premium purchase See Derived classes: , , , public abstract class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -14520,6 +14555,7 @@ namespace TL [TLDef(0xA3805F3F)] public class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputUserBase[] users; [IfFlag(0)] public InputPeer boost_peer; @@ -14528,6 +14564,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_boost_peer = 0x1, } } @@ -14535,6 +14572,7 @@ namespace TL [TLDef(0x7C9375E6)] public class InputStorePaymentPremiumGiveaway : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputPeer boost_peer; [IfFlag(1)] public InputPeer[] additional_peers; @@ -14547,7 +14585,9 @@ namespace TL [Flags] public enum Flags : uint { only_new_subscribers = 0x1, + /// Field has a value has_additional_peers = 0x2, + /// Field has a value has_countries_iso2 = 0x4, } } @@ -15540,6 +15580,7 @@ namespace TL public int id; /// When was the story posted. public DateTime date; + /// For reposted stories », contains info about the original story. [IfFlag(17)] public StoryFwdHeader fwd_from; /// When does the story expire. public DateTime expire_date; @@ -15731,6 +15772,7 @@ namespace TL [IfFlag(0)] public int top_msg_id; [IfFlag(1)] public InputPeer reply_to_peer_id; [IfFlag(2)] public string quote_text; + /// Message entities for styled text [IfFlag(3)] public MessageEntity[] quote_entities; [IfFlag(4)] public int quote_offset; @@ -15912,6 +15954,7 @@ namespace TL [TLDef(0x257E962B)] public class PremiumGiftCodeOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int users; public int months; @@ -15922,7 +15965,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_store_product = 0x1, + /// Field has a value has_store_quantity = 0x2, } } @@ -15931,6 +15976,7 @@ namespace TL [TLDef(0xB722F158)] public class Payments_CheckedGiftCode : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer from_id; [IfFlag(3)] public int giveaway_msg_id; @@ -15943,16 +15989,19 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_to_id = 0x1, + /// Field has a value has_used_date = 0x2, via_giveaway = 0x4, + /// Field has a value has_giveaway_msg_id = 0x8, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Info about a Telegram Premium Giveaway. See Derived classes: , public abstract class Payments_GiveawayInfoBase : IObject { public virtual DateTime StartDate { get; } @@ -15961,6 +16010,7 @@ namespace TL [TLDef(0x4367DAA0)] public class Payments_GiveawayInfo : Payments_GiveawayInfoBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DateTime start_date; [IfFlag(1)] public DateTime joined_too_early_date; @@ -15970,9 +16020,12 @@ namespace TL [Flags] public enum Flags : uint { participating = 0x1, + /// Field has a value has_joined_too_early_date = 0x2, + /// Field has a value has_admin_disallowed_chat_id = 0x4, preparing_results = 0x8, + /// Field has a value has_disallowed_country = 0x10, } @@ -15982,6 +16035,7 @@ namespace TL [TLDef(0x00CD5570)] public class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DateTime start_date; [IfFlag(0)] public string gift_code_slug; @@ -16008,236 +16062,318 @@ namespace TL public DateTime date; } - /// See + /// Info about one or more boosts applied by a specific user. See [TLDef(0x2A1C8C71)] public class Boost : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Unique ID for this set of boosts. public string id; + /// ID of the user that applied the boost. [IfFlag(0)] public long user_id; [IfFlag(2)] public int giveaway_msg_id; + /// When was the boost applied public DateTime date; + /// When does the boost expire public DateTime expires; [IfFlag(4)] public string used_gift_slug; + /// If set, this boost counts as multiplier boosts, otherwise it counts as a single boost. [IfFlag(5)] public int multiplier; [Flags] public enum Flags : uint { + /// Field has a value has_user_id = 0x1, gift = 0x2, giveaway = 0x4, unclaimed = 0x8, + /// Field has a value has_used_gift_slug = 0x10, + /// Field has a value has_multiplier = 0x20, } } - /// See + /// List of boosts that were applied to a peer by multiple users. See [TLDef(0x86F8613C)] public class Premium_BoostsList : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results public int count; + /// Boosts public Boost[] boosts; + /// Offset that can be used for pagination. [IfFlag(0)] public string next_offset; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } - /// See + /// Contains information about a single boost slot ». See [TLDef(0xC448415C)] public class MyBoost : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Boost slot ID » public int slot; + /// If set, indicates this slot is currently occupied, i.e. we are boosting this peer.
Note that we can assign multiple boost slots to the same peer.
[IfFlag(0)] public Peer peer; + /// When (unixtime) we started boosting the peer, 0 otherwise. public DateTime date; + /// Indicates the (unixtime) expiration date of the boost in peer (0 if peer is not set). public DateTime expires; + /// If peer is set, indicates the (unixtime) date after which this boost can be reassigned to another channel. [IfFlag(1)] public DateTime cooldown_until_date; [Flags] public enum Flags : uint { + /// Field has a value has_peer = 0x1, + /// Field has a value has_cooldown_until_date = 0x2, } } - /// See + /// A list of peers we are currently boosting, and how many boost slots we have left. See [TLDef(0x9AE228E2)] public class Premium_MyBoosts : IObject, IPeerResolver { + /// Info about boosted peers and remaining boost slots. public MyBoost[] my_boosts; + /// Referenced chats public Dictionary chats; + /// Referenced users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains info about the current boost status of a peer. See [TLDef(0x4959427A)] public class Premium_BoostsStatus : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The current boost level of the channel. public int level; + /// The number of boosts acquired so far in the current level. public int current_level_boosts; + /// Total number of boosts acquired so far. public int boosts; + /// The number of boosts acquired from created Telegram Premium gift codes and giveaways; only returned to channel admins. [IfFlag(4)] public int gift_boosts; + /// Total number of boosts needed to reach the next level; if absent, the next level isn't available. [IfFlag(0)] public int next_level_boosts; + /// Only returned to channel admins: contains the approximated number of Premium users subscribed to the channel, related to the total number of subscribers. [IfFlag(1)] public StatsPercentValue premium_audience; + /// Boost deep link » that can be used to boost the chat. public string boost_url; + /// A list of prepaid giveaways available for the chat; only returned to channel admins. [IfFlag(3)] public PrepaidGiveaway[] prepaid_giveaways; + /// Indicates which of our boost slots we've assigned to this peer (populated if my_boost is set). [IfFlag(2)] public int[] my_boost_slots; [Flags] public enum Flags : uint { + /// Field has a value has_next_level_boosts = 0x1, + /// Field has a value has_premium_audience = 0x2, + /// Whether we're currently boosting this channel, my_boost_slots will also be set. my_boost = 0x4, + /// Field has a value has_prepaid_giveaways = 0x8, + /// Field has a value has_gift_boosts = 0x10, } } - /// See + /// Contains info about the original poster of a reposted story. See [TLDef(0xB826E150)] public class StoryFwdHeader : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Peer that originally posted the story; will be empty for stories forwarded from a user with forwards privacy enabled, in which case from_name will be set, instead. [IfFlag(0)] public Peer from; + /// Will be set for stories forwarded from a user with forwards privacy enabled, in which case from will also be empty. [IfFlag(1)] public string from_name; + /// , contains the story ID [IfFlag(2)] public int story_id; [Flags] public enum Flags : uint { + /// Field has a value has_from = 0x1, + /// Field has a value has_from_name = 0x2, + /// Field has a value has_story_id = 0x4, + /// Whether the story media was modified before reposting it (for example by overlaying a round video with a reaction). modified = 0x8, } } - /// See + /// Interaction counters See Derived classes: , public abstract class PostInteractionCounters : IObject { + /// Number of views public int views; + /// Number of forwards to public channels public int forwards; + /// Number of reactions public int reactions; } - /// See + /// Interaction counters for a message. See [TLDef(0xE7058E7F)] public class PostInteractionCountersMessage : PostInteractionCounters { + /// Message ID public int msg_id; } - /// See + /// Interaction counters for a story. See [TLDef(0x8A480E27)] public class PostInteractionCountersStory : PostInteractionCounters { + /// Story ID public int story_id; } - /// See + /// Contains statistics about a story. See [TLDef(0x50CD067C)] public class Stats_StoryStats : IObject { + /// A graph containing the number of story views and shares public StatsGraphBase views_graph; + /// A bar graph containing the number of story reactions categorized by "emotion" (i.e. Positive, Negative, Other, etc...) public StatsGraphBase reactions_by_emotion_graph; } - /// See + /// Contains info about the forwards of a story as a message to public chats and reposts by public channels. See Derived classes: , public abstract class PublicForward : IObject { } - /// See + /// Contains info about a forward of a story as a message. See [TLDef(0x01F2BF4A)] public class PublicForwardMessage : PublicForward { + /// Info about the message with the reposted story. public MessageBase message; } - /// See + /// Contains info about a forward of a story as a repost by a public channel. See [TLDef(0xEDF3ADD0)] public class PublicForwardStory : PublicForward { + /// The channel that reposted the story. public Peer peer; + /// The reposted story (may be different from the original story). public StoryItemBase story; } - /// See + /// Contains info about the forwards of a story as a message to public chats and reposts by public channels. See [TLDef(0x93037E20)] public class Stats_PublicForwards : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results public int count; + /// Info about the forwards of a story. public PublicForward[] forwards; + /// Offset used for pagination. [IfFlag(0)] public string next_offset; public Dictionary chats; public Dictionary users; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a color palette ». See [TLDef(0xB54B5ACF)] public class PeerColor : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Color palette ID, see here » for more info. [IfFlag(0)] public int color; + /// Custom emoji ID used to generate the pattern. [IfFlag(1)] public long background_emoji_id; [Flags] public enum Flags : uint { + /// Field has a value has_color = 0x1, + /// Field has a value has_background_emoji_id = 0x2, } } - /// See + /// Contains info about a color palette ». See Derived classes: , public abstract class Help_PeerColorSetBase : IObject { } - /// See + /// Represents a color palette that can be used in message accents ». See [TLDef(0x26219A58)] public class Help_PeerColorSet : Help_PeerColorSetBase { + /// A list of 1-3 colors in RGB format, describing the accent color. public int[] colors; } - /// See + /// Represents a color palette that can be used in profile pages ». See [TLDef(0x767D61EB)] public class Help_PeerColorProfileSet : Help_PeerColorSetBase { + /// A list of 1-2 colors in RGB format, shown in the color palette settings to describe the current palette. public int[] palette_colors; + /// A list of 1-2 colors in RGB format describing the colors used to generate the actual background used in the profile page. public int[] bg_colors; + /// A list of 2 colors in RGB format describing the colors of the gradient used for the unread active story indicator around the profile photo. public int[] story_colors; } - /// See + /// Contains info about a color palette ». See [TLDef(0x135BD42F)] public class Help_PeerColorOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Palette ID. public int color_id; + /// Light mode palette.
Will be empty for IDs 0 to 6 inclusive, in which case a palette containing a single color from the following colors should be used: red, orange, violet, green, cyan, blue, pink for indexes 0 to 6.
[IfFlag(1)] public Help_PeerColorSetBase colors; + /// Dark mode palette. Optional, defaults to the palette in colors (or the autogenerated palette for IDs 0 to 6) if absent. [IfFlag(2)] public Help_PeerColorSetBase dark_colors; [Flags] public enum Flags : uint { + /// Whether this palette should not be displayed as an option to the user when choosing a palette to apply to profile pages or message accents. hidden = 0x1, + /// Field has a value has_colors = 0x2, + /// Field has a value has_dark_colors = 0x4, } } - ///
See + /// Contains info about multiple color palettes ». See /// a value means help.peerColorsNotModified [TLDef(0x00F8ED08)] public class Help_PeerColors : IObject { + /// Hash for pagination, for more info click here public int hash; + /// Usable color palettes. public Help_PeerColorOption[] colors; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c0aff4c..3d415e5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -82,8 +82,8 @@ namespace TL query = query, }); - /// Invoke a method within a takeout session See - /// Takeout session ID + /// Invoke a method within a takeout session, see here » for more info. See + /// Takeout session ID » /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) => client.Invoke(new InvokeWithTakeout @@ -699,7 +699,7 @@ namespace TL verification = verification, }); - /// Initialize account takeout session See Possible codes: 420 (details) + /// Initialize a takeout session, see here » for more info. See Possible codes: 420 (details) /// Whether to export contacts /// Whether to export messages in private chats /// Whether to export messages in basic groups @@ -714,7 +714,7 @@ namespace TL file_max_size = file_max_size.GetValueOrDefault(), }); - /// Finish account takeout session See Possible codes: 403 (details) + /// Terminate a takeout session, see here » for more info. See Possible codes: 403 (details) /// Data exported successfully public static Task Account_FinishTakeoutSession(this Client client, bool success = false) => client.Invoke(new Account_FinishTakeoutSession @@ -1154,7 +1154,10 @@ namespace TL codes = codes, }); - /// See + /// Update the accent color and background custom emoji » of the current account. See Possible codes: 400 (details) + /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. + /// ID of the accent color palette » to use (not RGB24, see here » for more info). + /// Custom emoji ID used in the accent color pattern. public static Task Account_UpdateColor(this Client client, long? background_emoji_id = null, int? color = null, bool for_profile = false) => client.Invoke(new Account_UpdateColor { @@ -1163,7 +1166,8 @@ namespace TL background_emoji_id = background_emoji_id.GetValueOrDefault(), }); - /// See + /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See + /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultBackgroundEmojis @@ -1332,7 +1336,7 @@ namespace TL { }); - /// Get all contacts See Possible codes: 403 (details) + /// Get all contacts, requires a takeout session, see here » for more info. See Possible codes: 403 (details) public static Task Contacts_GetSaved(this Client client) => client.Invoke(new Contacts_GetSaved { @@ -1382,11 +1386,11 @@ namespace TL self_expires = self_expires.GetValueOrDefault(), }); - /// Stop getting notifications about thread replies of a certain user in @replies See + /// Stop getting notifications about discussion replies of a certain user in @replies See /// Whether to delete the specified message as well /// Whether to delete all @replies messages from this user as well /// Whether to also report this user for spam - /// ID of the message in the @replies chat + /// ID of the message in the @replies chat public static Task Contacts_BlockFromReplies(this Client client, int msg_id, bool delete_message = false, bool delete_history = false, bool report_spam = false) => client.Invoke(new Contacts_BlockFromReplies { @@ -1584,6 +1588,7 @@ namespace TL /// Clear the draft field /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// The destination where the message will be sent /// If set, indicates that the message should be sent in reply to the specified message or story. /// The message @@ -1612,6 +1617,7 @@ namespace TL /// Clear the draft /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// Destination /// If set, indicates that the message should be sent in reply to the specified message or story. /// Attached media @@ -2178,6 +2184,7 @@ namespace TL /// Edit message See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Disable webpage preview + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// Where was the message sent /// ID of the message to edit /// New message @@ -2200,6 +2207,7 @@ namespace TL /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) /// Disable webpage preview + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// Sent inline message ID /// Message /// Media @@ -2258,9 +2266,12 @@ namespace TL /// Save a message draft associated to a chat. See Possible codes: 400 (details) /// Disable generation of the webpage preview + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. + /// If set, indicates that the message should be sent in reply to the specified message or story. /// Destination of the message that should be sent /// The draft /// Message entities for styled text + /// Attached media public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { @@ -2578,6 +2589,7 @@ namespace TL /// Whether to clear drafts /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » + /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// The destination chat /// If set, indicates that the message should be sent in reply to the specified message or story. /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. @@ -3681,6 +3693,8 @@ namespace TL }); /// Set a custom wallpaper » in a specific private chat with another user. See [bots: ✓] Possible codes: 400 (details) + /// Only for Premium users, sets the specified wallpaper for both users of the chat, without requiring confirmation from the other user. + /// If we don't like the new wallpaper the other user of the chat has chosen for us using the for_both flag, we can re-set our previous wallpaper just on our side using this flag. /// The private chat where the wallpaper will be set /// The wallpaper », obtained as described in the wallpaper documentation »; must not be provided when installing a wallpaper obtained from a service message (id must be provided, instead). /// Wallpaper settings, obtained as described in the wallpaper documentation » or from .wallpaper.settings. @@ -3695,7 +3709,10 @@ namespace TL id = id.GetValueOrDefault(), }); - /// See + /// Search for custom emoji stickersets » See + /// Exclude featured stickersets from results + /// Query string + /// Hash for pagination, for more info click here /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchEmojiStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchEmojiStickerSets @@ -4093,7 +4110,8 @@ namespace TL { }); - /// See + /// Get the set of accent color palettes » that can be used for message accents. See + /// Hash for pagination, for more info click here /// a null value means help.peerColorsNotModified public static Task Help_GetPeerColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerColors @@ -4101,7 +4119,8 @@ namespace TL hash = hash, }); - /// See + /// Get the set of accent color palettes » that can be used in profile page backgrounds. See + /// Hash for pagination, for more info click here /// a null value means help.peerColorsNotModified public static Task Help_GetPeerProfileColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerProfileColors @@ -4410,7 +4429,7 @@ namespace TL enabled = enabled, }); - /// Get a list of channels/supergroups we left See Possible codes: 403 (details) + /// Get a list of channels/supergroups we left, requires a takeout session, see here » for more info. See Possible codes: 403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset = default) => client.Invoke(new Channels_GetLeftChannels @@ -4720,7 +4739,10 @@ namespace TL random_id = random_id, }); - /// See + /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) + /// Channel whose accent color should be changed. + /// ID of the accent color palette » to use (not RGB24, see here » for more info). + /// Custom emoji ID used in the accent color pattern. public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, int color, long? background_emoji_id = null) => client.Invoke(new Channels_UpdateColor { @@ -4730,7 +4752,7 @@ namespace TL background_emoji_id = background_emoji_id.GetValueOrDefault(), }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_ToggleViewForumAsMessages(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleViewForumAsMessages { @@ -4738,7 +4760,8 @@ namespace TL enabled = enabled, }); - /// See + /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) + /// The method will return channels related to the passed channel. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetChannelRecommendations { @@ -4898,7 +4921,7 @@ namespace TL bot = bot, }); - /// Send a custom request from a mini bot app See Possible codes: 400 (details) + /// Send a custom request from a mini bot app, triggered by a web_app_invoke_custom_method event ». See Possible codes: 400 (details) /// Identifier of the bot associated to the mini bot app /// Identifier of the custom method to invoke /// Method parameters @@ -5021,7 +5044,7 @@ namespace TL purpose = purpose, }); - /// See + /// Obtain a list of Telegram Premium giveaway/gift code » options. See public static Task Payments_GetPremiumGiftCodeOptions(this Client client, InputPeer boost_peer = null) => client.Invoke(new Payments_GetPremiumGiftCodeOptions { @@ -5029,21 +5052,25 @@ namespace TL boost_peer = boost_peer, }); - /// See + /// Obtain information about a Telegram Premium giftcode » See Possible codes: 400 (details) + /// The giftcode to check public static Task Payments_CheckGiftCode(this Client client, string slug) => client.Invoke(new Payments_CheckGiftCode { slug = slug, }); - /// See + /// Apply a Telegram Premium giftcode » See Possible codes: 406 (details) + /// The code to apply public static Task Payments_ApplyGiftCode(this Client client, string slug) => client.Invoke(new Payments_ApplyGiftCode { slug = slug, }); - /// See + /// Obtain information about a Telegram Premium giveaway ». See Possible codes: 400 (details) + /// The peer where the giveaway was posted. + /// Message ID of the service message public static Task Payments_GetGiveawayInfo(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Payments_GetGiveawayInfo { @@ -5051,7 +5078,10 @@ namespace TL msg_id = msg_id, }); - /// See + /// Launch a prepaid giveaway ». See Possible codes: 400 (details) + /// The peer where to launch the giveaway. + /// The prepaid giveaway ID. + /// Giveway parameters public static Task Payments_LaunchPrepaidGiveaway(this Client client, InputPeer peer, long giveaway_id, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_LaunchPrepaidGiveaway { @@ -5657,7 +5687,10 @@ namespace TL msg_id = msg_id, }); - /// See + /// Get statistics for a certain story. See Possible codes: 400 (details) + /// Whether to enable the dark theme for graph colors + /// The peer that posted the story + /// Story ID public static Task Stats_GetStoryStats(this Client client, InputPeer peer, int id, bool dark = false) => client.Invoke(new Stats_GetStoryStats { @@ -5666,7 +5699,11 @@ namespace TL id = id, }); - /// See + /// Obtain forwards of a story as a message to public chats and reposts by public channels. See Possible codes: 400 (details) + /// Peer where the story was originally posted + /// Story ID + /// Offset for pagination, from .next_offset. + /// Maximum number of results to return, see pagination public static Task Stats_GetStoryPublicForwards(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue) => client.Invoke(new Stats_GetStoryPublicForwards { @@ -5794,6 +5831,7 @@ namespace TL /// Uploads a Telegram Story. See Possible codes: 400 (details) /// Whether to add the story to the profile automatically upon expiration. If not set, the story will only be added to the archive, see here » for more info. /// If set, disables forwards, screenshots, and downloads. + /// Set this flag when reposting stories with fwd_from_id+fwd_from_id, if the media was modified before reposting. /// The peer to send the story as. /// The story media. /// Media areas associated to the story, see here » for more info. @@ -5802,6 +5840,8 @@ namespace TL /// Privacy rules for the story, indicating who can or can't view the story. /// Unique client message ID required to prevent message resending. You can use /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. + /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. + /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { @@ -5936,7 +5976,7 @@ namespace TL /// Obtain the list of users that have viewed a specific story we posted See Possible codes: 400 (details) /// Whether to only fetch view reaction/views made by our contacts - /// Whether to return info about users that reacted to the story (i.e. if set, the server will also sort results based on the presence of a reaction, after sorting it by date as usual). + /// Whether to return info about users that reacted to the story (i.e. if set, the server will first sort results by view date as usual, and then also additionally sort the list by putting s with an associated reaction first in the list). /// Peer where the story was posted /// Search for specific peers /// Story ID @@ -6047,7 +6087,11 @@ namespace TL hidden = hidden, }); - /// See + /// Obtains info about the boosts that were applied to a certain channel (admins only) See Possible codes: 400 (details) + /// Whether to return only info about boosts received from gift codes and giveaways created by the channel » + /// The channel + /// Offset for pagination, obtained from .next_offset + /// Maximum number of results to return, see pagination public static Task Premium_GetBoostsList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool gifts = false) => client.Invoke(new Premium_GetBoostsList { @@ -6057,13 +6101,15 @@ namespace TL limit = limit, }); - /// See + /// Obtain which peers are we currently boosting, and how many boost slots we have left. See public static Task Premium_GetMyBoosts(this Client client) => client.Invoke(new Premium_GetMyBoosts { }); - /// See + /// Apply one or more boosts » to a peer. See Possible codes: 400 (details) + /// Which boost slots to assign to this peer. + /// The peer to boost. public static Task Premium_ApplyBoost(this Client client, InputPeer peer, int[] slots = null) => client.Invoke(new Premium_ApplyBoost { @@ -6072,14 +6118,17 @@ namespace TL peer = peer, }); - /// See + /// Gets the current boost status of a peer. See Possible codes: 400 (details) + /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus { peer = peer, }); - /// See + /// Returns the lists of boost that were applied to a channel by a specific user (admins only) See [bots: ✓] Possible codes: 400 (details) + /// The channel + /// The user public static Task Premium_GetUserBoosts(this Client client, InputPeer peer, InputUserBase user_id) => client.Invoke(new Premium_GetUserBoosts { From e6fa972295a689948318dafa4c5b35d03d0c10ec Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Dec 2023 00:01:07 +0100 Subject: [PATCH 150/336] Fix #216: The old salt should be accepted for a further 1800 seconds --- src/Client.cs | 7 +++++-- src/Encryption.cs | 1 + src/Session.cs | 1 + 3 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 05558f8..8d6c512 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -437,9 +437,10 @@ namespace WTelegram _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); - if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) + if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.OldSalt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) { Helpers.Log(3, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); + _dcSession.OldSalt = _dcSession.Salt; _dcSession.Salt = serverSalt; if (++_saltChangeCounter >= 10) throw new WTException("Server salt changed too often! Security issue?"); @@ -490,7 +491,7 @@ namespace WTelegram var keys = _dcSession.Salts.Keys; if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing var now = DateTime.UtcNow.AddTicks(_dcSession.ServerTicksOffset); - for (; keys.Count > 1 && keys[1] < now; _dcSession.Salt = _dcSession.Salts.Values[0]) + for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0]) _dcSession.Salts.RemoveAt(0); if (_dcSession.Salts.Count > 48) return; } @@ -503,6 +504,7 @@ namespace WTelegram _dcSession.Salts.Remove(DateTime.MaxValue); foreach (var entry in gfs.Result.salts) _dcSession.Salts[entry.valid_since] = entry.salt; + _dcSession.OldSalt = _dcSession.Salt; _dcSession.Salt = _dcSession.Salts.Values[0]; _session.Save(); } @@ -695,6 +697,7 @@ namespace WTelegram } break; case 48: // incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it) + _dcSession.OldSalt = _dcSession.Salt; _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; CheckSalt(); break; diff --git a/src/Encryption.cs b/src/Encryption.cs index b94edf1..23ab8fc 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -162,6 +162,7 @@ namespace WTelegram session.AuthKeyID = BinaryPrimitives.ReadInt64LittleEndian(authKeyHash.AsSpan(12)); session.AuthKey = authKey; session.Salt = BinaryPrimitives.ReadInt64LittleEndian(pqInnerData.new_nonce.raw) ^ BinaryPrimitives.ReadInt64LittleEndian(resPQ.server_nonce.raw); + session.OldSalt = session.Salt; (byte[] key, byte[] iv) ConstructTmpAESKeyIV(Int128 server_nonce, Int256 new_nonce) { diff --git a/src/Session.cs b/src/Session.cs index d09b99d..11bf28a 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -23,6 +23,7 @@ namespace WTelegram public long AuthKeyID; public byte[] AuthKey; // 2048-bit = 256 bytes public long UserId; + public long OldSalt; // still accepted for a further 1800 seconds public long Salt; public SortedList Salts; public int Seqno; From 2d7a64fc2dd52539d1748ab8903556d3acacc858 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Dec 2023 20:39:48 +0100 Subject: [PATCH 151/336] API Layer 169 (https://corefork.telegram.org/api/layers): Channel appearance, giveaway prize/winners, premium gift payments, stories reposts, bot reactions and more... (https://t.me/tginfoen/1804) --- README.md | 2 +- src/Client.cs | 2 +- src/Session.cs | 14 +- src/TL.Schema.cs | 431 ++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 140 ++++++++---- src/TL.Table.cs | 42 ++-- src/WTelegramClient.csproj | 2 +- 7 files changed, 518 insertions(+), 115 deletions(-) diff --git a/README.md b/README.md index 44fe5df..749db94 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-167-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-169-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://www.buymeacoffee.com/wizou) diff --git a/src/Client.cs b/src/Client.cs index 8d6c512..325cfeb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -491,7 +491,7 @@ namespace WTelegram var keys = _dcSession.Salts.Keys; if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing var now = DateTime.UtcNow.AddTicks(_dcSession.ServerTicksOffset); - for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0]) + for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0]) _dcSession.Salts.RemoveAt(0); if (_dcSession.Salts.Count > 48) return; } diff --git a/src/Session.cs b/src/Session.cs index 11bf28a..b76ecbc 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -7,6 +7,10 @@ using System.Net; using System.Security.Cryptography; using System.Text.Json; +//( Fuck you Andrei, you don't know what you're doing! You're lowering the security, contrary to Telegram recommended practices. +//( Read the official API documentation. And if you want to mess around, at least don't publish a lame copy of my lib on nuget. +//( Also you're apparently a noob in C#, so don't judge my experienced code where every line is carefully written on purpose. + namespace WTelegram { internal class Session : IDisposable @@ -78,7 +82,7 @@ namespace WTelegram public DateTime SessionStart => _sessionStart; private readonly DateTime _sessionStart = DateTime.UtcNow; - private readonly SHA256 _sha256 = SHA256.Create(); + private readonly SHA256 _sha256 = SHA256.Create(); // put private Stream _store; private byte[] _reuseKey; // used only if AES Encryptor.CanReuseTransform = false (Mono) private byte[] _encrypted = new byte[16]; @@ -92,7 +96,7 @@ namespace WTelegram _store.Dispose(); _encryptor.Dispose(); _jsonWriter.Dispose(); - _jsonStream.Dispose(); + _jsonStream.Dispose(); // this } internal static Session LoadOrCreate(Stream store, byte[] rgbKey) @@ -104,7 +108,7 @@ namespace WTelegram var length = (int)store.Length; if (length > 0) { - var input = new byte[length]; + var input = new byte[length]; // code if (store.Read(input, 0, length) != length) throw new WTException($"Can't read session block ({store.Position}, {length})"); using var sha256 = SHA256.Create(); @@ -138,7 +142,7 @@ namespace WTelegram int encryptedLen = 64 + (utf8JsonLen & ~15); lock (_store) // while updating _encrypted buffer and writing to store { - if (encryptedLen > _encrypted.Length) + if (encryptedLen > _encrypted.Length) // back Array.Copy(_encrypted, _encrypted = new byte[encryptedLen + 256], 16); _encryptor.TransformBlock(_sha256.ComputeHash(utf8Json, 0, utf8JsonLen), 0, 32, _encrypted, 16); _encryptor.TransformBlock(utf8Json, 0, encryptedLen - 64, _encrypted, 48); @@ -155,7 +159,7 @@ namespace WTelegram } } - internal class SessionStore : FileStream + internal class SessionStore : FileStream // This class is designed to be high-performance and failure-resilient with Writes (but when you're Andrei, you can't understand that) { public override long Length { get; } public override long Position { get => base.Position; set { } } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7d45260..3ffc471 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -464,18 +464,22 @@ namespace TL /// Story ID public int id; } - /// See + /// Specifies options that will be used to generate the link preview for the caption, or even a standalone link preview without an attached message. See [TLDef(0xC21B8849)] public class InputMediaWebPage : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The URL to use for the link preview. public string url; [Flags] public enum Flags : uint { + /// If set, specifies that a large media preview should be used. force_large_media = 0x1, + /// If set, specifies that a small media preview should be used. force_small_media = 0x2, + /// If not set, a WEBPAGE_NOT_FOUND RPC error will be emitted if a webpage preview cannot be generated for the specified url; otherwise, no error will be emitted (unless the provided message is also empty, in which case a MESSAGE_EMPTY will be emitted, instead). optional = 0x4, } } @@ -777,7 +781,9 @@ namespace TL [IfFlag(32)] public Username[] usernames; /// ID of the maximum read story. [IfFlag(37)] public int stories_max_id; + /// The user's accent color. [IfFlag(40)] public PeerColor color; + /// The user's profile color. [IfFlag(41)] public PeerColor profile_color; [Flags] public enum Flags : uint @@ -850,6 +856,7 @@ namespace TL close_friend = 0x4, /// Whether we have hidden » all active stories of this user. stories_hidden = 0x8, + /// No stories from this user are visible. stories_unavailable = 0x10, /// Field has a value has_stories_max_id = 0x20, @@ -997,7 +1004,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x8E87CCD8)] + [TLDef(0x0AADFC8F)] public partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1030,7 +1037,11 @@ namespace TL [IfFlag(32)] public Username[] usernames; /// ID of the maximum read story. [IfFlag(36)] public int stories_max_id; + /// The channel's accent color. [IfFlag(39)] public PeerColor color; + [IfFlag(40)] public PeerColor profile_color; + [IfFlag(41)] public EmojiStatus emoji_status; + [IfFlag(42)] public int level; [Flags] public enum Flags : uint { @@ -1096,11 +1107,18 @@ namespace TL stories_hidden = 0x2, /// If set, indicates that the stories_hidden flag was not populated, and its value must cannot be relied on; use the previously cached value, or re-fetch the constructor using Channels_GetChannels to obtain the latest value of the stories_hidden flag. stories_hidden_min = 0x4, + /// No stories from the channel are visible. stories_unavailable = 0x8, /// Field has a value has_stories_max_id = 0x10, /// Field has a value has_color = 0x80, + /// Field has a value + has_profile_color = 0x100, + /// Field has a value + has_emoji_status = 0x200, + /// Field has a value + has_level = 0x400, } /// ID of the channel @@ -1276,7 +1294,7 @@ namespace TL public override ChatReactions AvailableReactions => available_reactions; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x723027BD)] + [TLDef(0x0F2BCB6F)] public partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1355,6 +1373,7 @@ namespace TL [IfFlag(30)] public ChatReactions available_reactions; /// Channel stories [IfFlag(36)] public PeerStories stories; + [IfFlag(39)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint { @@ -1436,7 +1455,10 @@ namespace TL has_stories = 0x10, /// Whether this user has some pinned stories. stories_pinned_available = 0x20, + /// Users may also choose to display messages from all topics of a forum as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of this flag.
view_forum_as_messages = 0x40, + /// Field has a value + has_wallpaper = 0x80, } /// ID of the channel @@ -1869,9 +1891,13 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, specifies that a large media preview should be used. force_large_media = 0x1, + /// If set, specifies that a small media preview should be used. force_small_media = 0x2, + /// If set, indicates that the URL used for the webpage preview was specified manually using , and may not be related to any of the URLs specified in the message. manual = 0x8, + /// If set, the webpage can be opened directly without user confirmation; otherwise, user confirmation is required, showing the exact URL that will be opened. safe = 0x10, } } @@ -1998,23 +2024,56 @@ namespace TL via_mention = 0x2, } } - /// See - [TLDef(0x58260664)] + /// Contains info about a giveaway, see here » for more info. See + [TLDef(0xDAAD85B0)] public class MessageMediaGiveaway : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The channels that the user must join to participate in the giveaway. public long[] channels; + /// If set, only users residing in these countries can participate in the giveaway, (specified as a list of two-letter ISO 3166-1 alpha-2 country codes); otherwise there are no country-based limitations. [IfFlag(1)] public string[] countries_iso2; + [IfFlag(3)] public string prize_description; + /// Number of Telegram Premium subscriptions given away. public int quantity; + /// Duration in months of each Telegram Premium subscription in the giveaway. public int months; + /// The end date of the giveaway. + public DateTime until_date; + + [Flags] public enum Flags : uint + { + /// If set, only new subscribers starting from the giveaway creation date will be able to participate to the giveaway. + only_new_subscribers = 0x1, + /// Field has a value + has_countries_iso2 = 0x2, + winners_are_visible = 0x4, + /// Field has a value + has_prize_description = 0x8, + } + } + /// See + [TLDef(0xC6991068)] + public class MessageMediaGiveawayResults : MessageMedia + { + public Flags flags; + public long channel_id; + [IfFlag(3)] public int additional_peers_count; + public int launch_msg_id; + public int winners_count; + public int unclaimed_count; + public long[] winners; + public int months; + [IfFlag(1)] public string prize_description; public DateTime until_date; [Flags] public enum Flags : uint { only_new_subscribers = 0x1, - /// Field has a value - has_countries_iso2 = 0x2, + has_prize_description = 0x2, + refunded = 0x4, + has_additional_peers_count = 0x8, } } @@ -2399,13 +2458,12 @@ namespace TL public PhotoBase photo; } /// Contains info about a peer that the user shared with the bot after clicking on a button. See - [TLDef(0xFE77345D)] + [TLDef(0x31518E9B)] public class MessageActionRequestedPeer : MessageAction { /// button_id contained in the public int button_id; - /// The shared peer - public Peer peer; + public Peer[] peers; } /// The wallpaper » of the current chat was changed. See [TLDef(0x5060A3F4)] @@ -2424,32 +2482,45 @@ namespace TL for_both = 0x2, } } - /// See - [TLDef(0xD2CFDB0E)] + /// Contains a Telegram Premium giftcode link. See + [TLDef(0x678C2E09)] public class MessageActionGiftCode : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the channel that created the gift code either directly or through a giveaway: if we import this giftcode link, we will also automatically boost this channel. [IfFlag(1)] public Peer boost_peer; + /// Duration in months of the gifted Telegram Premium subscription. public int months; + /// Slug of the Telegram Premium giftcode link public string slug; + [IfFlag(2)] public string currency; + [IfFlag(2)] public long amount; + [IfFlag(3)] public string crypto_currency; + [IfFlag(3)] public long crypto_amount; [Flags] public enum Flags : uint { + /// If set, this gift code was received from a giveaway » started by a channel we're subscribed to. via_giveaway = 0x1, /// Field has a value has_boost_peer = 0x2, + /// If set, the link was not redeemed yet. unclaimed = 0x4, + /// Fields and have a value + has_crypto_currency = 0x8, } } - /// See + /// A giveaway was started. See [TLDef(0x332BA9ED)] public class MessageActionGiveawayLaunch : MessageAction { } - /// See + /// A giveaway has ended. See [TLDef(0x2A9FADC5)] public class MessageActionGiveawayResults : MessageAction { + /// Number of winners in the giveaway public int winners_count; + /// Number of undistributed prizes public int unclaimed_count; } @@ -2506,6 +2577,7 @@ namespace TL has_folder_id = 0x10, /// Field has a value has_ttl_period = 0x20, + /// Users may also choose to display messages from all topics of a forum as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of this flag.
view_forum_as_messages = 0x40, } @@ -3753,6 +3825,7 @@ namespace TL public int pts; /// Number of events that were generated public int pts_count; + /// When was the last message in messages marked as read. [IfFlag(0)] public DateTime date; [Flags] public enum Flags : uint @@ -4886,20 +4959,24 @@ namespace TL /// The reaction that was sent public Reaction reaction; } - /// See + /// A channel boost has changed (bots only) See [TLDef(0x904DD49C)] public class UpdateBotChatBoost : Update { + /// Channel public Peer peer; + /// New boost information public Boost boost; + /// QTS event sequence identifier public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
[TLDef(0x07B68920, inheritBefore = true)] public class UpdateChannelViewForumAsMessages : UpdateChannel { + /// The new value of the toggle. public bool enabled; } /// The wallpaper » of a given peer has changed. See @@ -4910,15 +4987,43 @@ namespace TL public Flags flags; /// The peer where the wallpaper has changed. public Peer peer; + /// The new wallpaper, if none the wallpaper was removed and the default wallpaper should be used. [IfFlag(0)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint { /// Field has a value has_wallpaper = 0x1, + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x2, } } + /// See + [TLDef(0xAC21D3CE)] + public class UpdateBotMessageReaction : Update + { + public Peer peer; + public int msg_id; + public DateTime date; + public Peer actor; + public Reaction[] old_reactions; + public Reaction[] new_reactions; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } + /// See + [TLDef(0x09CB7759)] + public class UpdateBotMessageReactions : Update + { + public Peer peer; + public int msg_id; + public DateTime date; + public ReactionCount[] reactions; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6364,6 +6469,7 @@ namespace TL { /// Preview ID public virtual long ID { get; } + /// URL of the webpage. public virtual string Url { get; } } /// No preview is available for the webpage See @@ -6374,6 +6480,7 @@ namespace TL public Flags flags; /// Preview ID public long id; + /// URL of the webpage. [IfFlag(0)] public string url; [Flags] public enum Flags : uint @@ -6384,6 +6491,7 @@ namespace TL /// Preview ID public override long ID => id; + /// URL of the webpage. public override string Url => url; } /// A preview of the webpage is currently being generated See @@ -6394,6 +6502,7 @@ namespace TL public Flags flags; /// ID of preview public long id; + /// URL of the webpage [IfFlag(0)] public string url; /// When was the processing started public DateTime date; @@ -6406,6 +6515,7 @@ namespace TL /// ID of preview public override long ID => id; + /// URL of the webpage public override string Url => url; } /// Webpage preview See @@ -6477,6 +6587,7 @@ namespace TL has_cached_page = 0x400, /// Field has a value has_attributes = 0x1000, + /// Whether the size of the media in the preview can be changed. has_large_media = 0x2000, } @@ -6749,6 +6860,7 @@ namespace TL public int participants_count; /// A few of the participants that are in the group [IfFlag(4)] public UserBase[] participants; + /// Profile color palette ID public int color; [Flags] public enum Flags : uint @@ -6829,6 +6941,9 @@ namespace TL /// Default custom emoji stickerset for forum topic icons See [TLDef(0x44C1F8E9)] public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } + /// See + [TLDef(0x49748553)] + public class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -6879,7 +6994,9 @@ namespace TL emojis = 0x80, /// Field has a value has_thumb_document_id = 0x100, + /// Whether the color of this TGS custom emoji stickerset should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. text_color = 0x200, + channel_emoji_status = 0x400, } } @@ -7128,13 +7245,14 @@ namespace TL { } /// Prompts the user to select and share a peer with the bot using Messages_SendBotRequestedPeer See - [TLDef(0x0D0B468C, inheritBefore = true)] + [TLDef(0x53D7BFD8, inheritBefore = true)] public class KeyboardButtonRequestPeer : KeyboardButton { /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use a peer of the specified type, if needed.
public RequestPeerType peer_type; + public int max_quantity; } ///
Inline keyboard row See @@ -7870,16 +7988,19 @@ namespace TL has_reply_markup = 0x4, } } - /// See + /// Specifies options that will be used to generate the link preview for the message, or even a standalone link preview without an attached message. See [TLDef(0xBDDCC510)] public class InputBotInlineMessageMediaWebPage : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The message, can be empty. public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// The URL to use for the link preview. public string url; + /// Inline keyboard [IfFlag(2)] public ReplyMarkup reply_markup; [Flags] public enum Flags : uint @@ -7890,8 +8011,11 @@ namespace TL has_reply_markup = 0x4, /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, + /// If set, specifies that a large media preview should be used. force_large_media = 0x10, + /// If set, specifies that a small media preview should be used. force_small_media = 0x20, + /// If not set, a WEBPAGE_NOT_FOUND RPC error will be emitted if a webpage preview cannot be generated for the specified url; otherwise, no error will be emitted (unless the provided message is also empty, in which case a MESSAGE_EMPTY will be emitted, instead). optional = 0x40, } } @@ -8173,16 +8297,19 @@ namespace TL test = 0x8, } } - /// See + /// Specifies options that must be used to generate the link preview for the message, or even a standalone link preview without an attached message. See [TLDef(0x809AD9A6)] public class BotInlineMessageMediaWebPage : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The message, can be empty. public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// The URL to use for the link preview. public string url; + /// Reply markup for sending bot buttons [IfFlag(2)] public ReplyMarkup reply_markup; [Flags] public enum Flags : uint @@ -8193,9 +8320,13 @@ namespace TL has_reply_markup = 0x4, /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8, + /// If set, specifies that a large media preview should be used. force_large_media = 0x10, + /// If set, specifies that a small media preview should be used. force_small_media = 0x20, + /// If set, indicates that the URL used for the webpage preview was specified manually using , and may not be related to any of the URLs specified in the message. manual = 0x80, + /// If set, the link can be opened directly without user confirmation. safe = 0x100, } } @@ -8715,11 +8846,13 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// If set, indicates that the message should be sent in reply to the specified message or story. [IfFlag(4)] public InputReplyTo reply_to; /// The draft public string message; /// Message entities for styled text. [IfFlag(3)] public MessageEntity[] entities; + /// Media. [IfFlag(5)] public InputMedia media; /// Date of last update of the draft. public DateTime date; @@ -10781,19 +10914,29 @@ namespace TL /// Whether antispam functionality was enabled or disabled. public bool new_value; } - /// The background profile color » of a channel was changed. See - [TLDef(0x3C2B247B)] - public class ChannelAdminLogEventActionChangeColor : ChannelAdminLogEventAction + /// See + [TLDef(0x5796E780)] + public class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction { - public int prev_value; - public int new_value; + public PeerColor prev_value; + public PeerColor new_value; } - /// The custom emoji used to generate the pattern of the background profile color » of a channel was changed. See - [TLDef(0x445FC434)] - public class ChannelAdminLogEventActionChangeBackgroundEmoji : ChannelAdminLogEventAction + /// See + [TLDef(0x5E477B25)] + public class ChannelAdminLogEventActionChangeProfilePeerColor : ChannelAdminLogEventActionChangePeerColor { } + /// See + [TLDef(0x31BB5D52)] + public class ChannelAdminLogEventActionChangeWallpaper : ChannelAdminLogEventAction { - public long prev_value; - public long new_value; + public WallPaperBase prev_value; + public WallPaperBase new_value; + } + /// See + [TLDef(0x3EA9FEB1)] + public class ChannelAdminLogEventActionChangeEmojiStatus : ChannelAdminLogEventAction + { + public EmojiStatus prev_value; + public EmojiStatus new_value; } /// Admin log event See @@ -12174,7 +12317,7 @@ namespace TL } /// Wallpaper rendering information. See - [TLDef(0x1DC1BCA4)] + [TLDef(0x372EFCD0)] public class WallPaperSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -12191,6 +12334,7 @@ namespace TL [IfFlag(3)] public int intensity; /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45. [IfFlag(4)] public int rotation; + [IfFlag(7)] public string emoticon; [Flags] public enum Flags : uint { @@ -12208,6 +12352,8 @@ namespace TL has_third_background_color = 0x20, /// Field has a value has_fourth_background_color = 0x40, + /// Field has a value + has_emoticon = 0x80, } } @@ -12924,13 +13070,17 @@ namespace TL public StatsDateRangeDays period; /// Follower count change for period in consideration public StatsAbsValueAndPrev followers; - /// total_viewcount/postcount, for posts posted during the period in consideration (views_per_post).
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date).
+ /// total_viewcount/postcount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date).
public StatsAbsValueAndPrev views_per_post; - /// total_viewcount/postcount, for posts posted during the period in consideration (views_per_post).
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
+ /// total_sharecount/postcount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev shares_per_post; + /// total_reactions/postcount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev reactions_per_post; + /// total_views/storycount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev views_per_story; + /// total_shares/storycount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev shares_per_story; + /// total_reactions/storycount, for posts posted during the period in consideration.
Note that in this case, current refers to the period in consideration (min_date till max_date), and prev refers to the previous period ((min_date - (max_date - min_date)) till min_date)
public StatsAbsValueAndPrev reactions_per_story; /// Percentage of subscribers with enabled notifications public StatsPercentValue enabled_notifications; @@ -12952,9 +13102,13 @@ namespace TL public StatsGraphBase new_followers_by_source_graph; /// Subscriber language graph (pie chart) public StatsGraphBase languages_graph; + /// A graph containing the number of reactions on posts categorized by emotion public StatsGraphBase reactions_by_emotion_graph; + /// A graph containing the number of story views and shares public StatsGraphBase story_interactions_graph; + /// A graph containing the number of reactions on stories categorized by emotion public StatsGraphBase story_reactions_by_emotion_graph; + /// Detailed statistics about number of views and shares of recently sent messages and stories public PostInteractionCounters[] recent_posts_interactions; } @@ -13280,13 +13434,17 @@ namespace TL [IfFlag(4)] public int reply_to_msg_id; ///
For replies sent in channel discussion threads of which the current user is not a member, the discussion group ID [IfFlag(0)] public Peer reply_to_peer_id; + /// When replying to a message sent by a certain peer to another chat, contains info about the peer that originally sent the message to that other chat. [IfFlag(5)] public MessageFwdHeader reply_from; + /// When replying to a media sent by a certain peer to another chat, contains the media of the replied-to message. [IfFlag(8)] public MessageMedia reply_media; /// ID of the message that started this message thread [IfFlag(1)] public int reply_to_top_id; + /// Used to quote-reply to only a certain section (specified here) of the original message. [IfFlag(6)] public string quote_text; - /// Message entities for styled text + /// Message entities for styled text from the quote_text field. [IfFlag(7)] public MessageEntity[] quote_entities; + /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(10)] public int quote_offset; [Flags] public enum Flags : uint @@ -13309,6 +13467,7 @@ namespace TL has_quote_entities = 0x80, /// Field has a value has_reply_media = 0x100, + /// Whether this message is quoting a part of another message. quote = 0x200, /// Field has a value has_quote_offset = 0x400, @@ -13372,6 +13531,7 @@ namespace TL { /// Message view graph public StatsGraphBase views_graph; + /// A graph containing the number of reactions on stories categorized by emotion public StatsGraphBase reactions_by_emotion_graph; } @@ -13884,11 +14044,13 @@ namespace TL [IfFlag(0)] public string start_param; /// Sponsored website [IfFlag(9)] public SponsoredWebPage webpage; + /// Mini App » to open when the sponsored message is clicked. [IfFlag(10)] public BotApp app; /// Sponsored message public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// Text of the sponsored message button. [IfFlag(11)] public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; @@ -14297,7 +14459,7 @@ namespace TL { /// If set, before launching the mini app the client should ask the user to add the mini app to the attachment/side menu, and only if the user accepts, after invoking Messages_ToggleBotInAttachMenu the app should be opened. inactive = 0x1, - /// True, if the bot supports the "settings_button_pressed" event » + /// Deprecated flag, can be ignored. has_settings = 0x2, /// Whether the bot would like to send messages to the user. request_write_access = 0x4, @@ -14465,11 +14627,13 @@ namespace TL /// The invoice slug public string slug; } - /// See + /// Used if the user wishes to start a channel giveaway or send some giftcodes to members of a channel, in exchange for boosts. See [TLDef(0x98986C0D)] public class InputInvoicePremiumGiftCode : InputInvoice { + /// Should be populated with for giveaways and for gifts. public InputStorePaymentPurpose purpose; + /// Should be populated with one of the giveaway options returned by Payments_GetPremiumGiftCodeOptions, see the giveaways » documentation for more info. public PremiumGiftCodeOption option; } @@ -14551,15 +14715,19 @@ namespace TL /// 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 amount; } - /// See + /// Used to gift Telegram Premium subscriptions only to some specific subscribers of a channel or to some of our contacts, see here » for more info on giveaways and gifts. See [TLDef(0xA3805F3F)] public class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The users that will receive the Telegram Premium subscriptions. public InputUserBase[] users; + /// If set, the gifts will be sent on behalf of a channel we are an admin of, which will also assign some boosts to it. Otherwise, the gift will be sent directly from the currently logged in users, and we will gain some extra boost slots. See here » for more info on giveaways and gifts. [IfFlag(0)] public InputPeer boost_peer; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; [Flags] public enum Flags : uint @@ -14568,27 +14736,39 @@ namespace TL has_boost_peer = 0x1, } } - /// See - [TLDef(0x7C9375E6)] + /// Used to pay for a giveaway, see here » for more info. See + [TLDef(0x160544CA)] public class InputStorePaymentPremiumGiveaway : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The channel starting the giveaway, that the user must join to participate, that will receive the giveaway boosts; see here » for more info on giveaways. public InputPeer boost_peer; + /// Additional channels that the user must join to participate to the giveaway can be specified here. [IfFlag(1)] public InputPeer[] additional_peers; + /// The set of users that can participate to the giveaway can be restricted by passing here an explicit whitelist of up to giveaway_countries_max countries, specified as two-letter ISO 3166-1 alpha-2 country codes. [IfFlag(2)] public string[] countries_iso2; + [IfFlag(4)] public string prize_description; + /// Random ID to avoid resending the giveaway public long random_id; + /// The end date of the giveaway, must be at most giveaway_period_max seconds in the future; see here » for more info on giveaways. public DateTime until_date; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; [Flags] public enum Flags : uint { + /// If set, only new subscribers starting from the giveaway creation date will be able to participate to the giveaway. only_new_subscribers = 0x1, /// Field has a value has_additional_peers = 0x2, /// Field has a value has_countries_iso2 = 0x4, + winners_are_visible = 0x8, + /// Field has a value + has_prize_description = 0x10, } } @@ -15522,6 +15702,7 @@ namespace TL { /// Field has a value has_recent_viewers = 0x1, + /// If set, indicates that the viewers list is currently viewable, and was not yet deleted because the story has expired while the user didn't have a Premium account. has_viewers = 0x2, /// Field has a value has_forwards_count = 0x4, @@ -15700,9 +15881,11 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Story view date and reaction information See Derived classes: + public abstract class StoryViewBase : IObject { } /// Story view date and reaction information See [TLDef(0xB0BDEAC5)] - public class StoryView : IObject + public class StoryView : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15723,19 +15906,49 @@ namespace TL has_reaction = 0x4, } } + /// See + [TLDef(0x9083670B)] + public class StoryViewPublicForward : StoryViewBase + { + public Flags flags; + public MessageBase message; + + [Flags] public enum Flags : uint + { + blocked = 0x1, + blocked_my_stories_from = 0x2, + } + } + /// See + [TLDef(0xBD74CF49)] + public class StoryViewPublicRepost : StoryViewBase + { + public Flags flags; + public Peer peer_id; + public StoryItemBase story; + + [Flags] public enum Flags : uint + { + blocked = 0x1, + blocked_my_stories_from = 0x2, + } + } /// Reaction and view counters for a story See - [TLDef(0x46E9B9EC)] - public class Stories_StoryViewsList : IObject + [TLDef(0x59D78FC5)] + public class Stories_StoryViewsList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of results that can be fetched public int count; + public int views_count; + public int forwards_count; /// Number of reactions that were added to the story public int reactions_count; /// Story view date and reaction information - public StoryView[] views; + public StoryViewBase[] views; + public Dictionary chats; /// Mentioned users public Dictionary users; /// Offset for pagination @@ -15746,6 +15959,8 @@ namespace TL /// Field has a value has_next_offset = 0x1, } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Reaction and view counters for a list of stories See @@ -15770,10 +15985,13 @@ namespace TL public int reply_to_msg_id; /// This field must contain the topic ID only when replying to messages in forum topics different from the "General" topic (i.e. reply_to_msg_id is set and reply_to_msg_id != topicID and topicID != 1).
If the replied-to message is deleted before the method finishes execution, the value in this field will be used to send the message to the correct topic, instead of the "General" topic.
[IfFlag(0)] public int top_msg_id; + /// Used to reply to messages sent to another chat (specified here), can only be used for non-protected chats and messages. [IfFlag(1)] public InputPeer reply_to_peer_id; + /// Used to quote-reply to only a certain section (specified here) of the original message. [IfFlag(2)] public string quote_text; - ///
Message entities for styled text + /// Message entities for styled text from the quote_text field. [IfFlag(3)] public MessageEntity[] quote_entities; + /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; [Flags] public enum Flags : uint @@ -15904,6 +16122,22 @@ namespace TL flipped = 0x2, } } + /// See + [TLDef(0x770416AF)] + public class MediaAreaChannelPost : MediaArea + { + public MediaAreaCoordinates coordinates; + public long channel_id; + public int msg_id; + } + /// See + [TLDef(0x2271F2BF)] + public class InputMediaAreaChannelPost : MediaArea + { + public MediaAreaCoordinates coordinates; + public InputChannelBase channel; + public int msg_id; + } /// Stories associated to a peer See [TLDef(0x9A35E999)] @@ -15939,28 +16173,37 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents an Instant View webpage. See [TLDef(0xFD5E12BD)] public class Messages_WebPage : IObject, IPeerResolver { + /// The instant view webpage. public WebPageBase webpage; + /// Chats mentioned in the webpage. public Dictionary chats; + /// Users mentioned in the webpage. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains info about a giveaway/gift option. See [TLDef(0x257E962B)] public class PremiumGiftCodeOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Number of users which will be able to activate the gift codes. public int users; + /// Duration in months of each gifted Telegram Premium subscription. public int months; + /// Identifier of the store product associated with the option, official apps only. [IfFlag(0)] public string store_product; + /// Number of times the store product must be paid [IfFlag(1)] public int store_quantity; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; [Flags] public enum Flags : uint @@ -15972,19 +16215,27 @@ namespace TL } } - /// See - [TLDef(0xB722F158)] + /// Contains info about a Telegram Premium giftcode link. See + [TLDef(0x284A1096)] public class Payments_CheckedGiftCode : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - public Peer from_id; + /// The peer that created the gift code. + [IfFlag(4)] public Peer from_id; + /// Message ID of the giveaway in the channel specified in from_id. [IfFlag(3)] public int giveaway_msg_id; + /// The destination user of the gift. [IfFlag(0)] public long to_id; + /// Creation date of the gift code. public DateTime date; + /// Duration in months of the gifted Telegram Premium subscription. public int months; + /// When was the giftcode imported, if it was imported. [IfFlag(1)] public DateTime used_date; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint @@ -15993,9 +16244,12 @@ namespace TL has_to_id = 0x1, /// Field has a value has_used_date = 0x2, + /// Whether this giftcode was created by a giveaway. via_giveaway = 0x4, /// Field has a value has_giveaway_msg_id = 0x8, + /// Field has a value + has_from_id = 0x10, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -16004,61 +16258,81 @@ namespace TL /// Info about a Telegram Premium Giveaway. See Derived classes: , public abstract class Payments_GiveawayInfoBase : IObject { + /// When was the giveaway started public virtual DateTime StartDate { get; } } - /// See + /// Contains info about an ongoing giveaway. See [TLDef(0x4367DAA0)] public class Payments_GiveawayInfo : Payments_GiveawayInfoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// When was the giveaway started public DateTime start_date; + /// The current user can't participate in the giveaway, because they were already a member of the channel when the giveaway started, and the only_new_subscribers was set when starting the giveaway. [IfFlag(1)] public DateTime joined_too_early_date; + /// If set, the current user can't participate in the giveaway, because they are an administrator in one of the channels (ID specified in this flag) that created the giveaway. [IfFlag(2)] public long admin_disallowed_chat_id; + /// If set, the current user can't participate in this giveaway, because their phone number is from the specified disallowed country (specified as a two-letter ISO 3166-1 alpha-2 country code). [IfFlag(4)] public string disallowed_country; [Flags] public enum Flags : uint { + /// The current user is participating in the giveaway. participating = 0x1, /// Field has a value has_joined_too_early_date = 0x2, /// Field has a value has_admin_disallowed_chat_id = 0x4, + /// If set, the giveaway has ended and the results are being prepared. preparing_results = 0x8, /// Field has a value has_disallowed_country = 0x10, } + /// When was the giveaway started public override DateTime StartDate => start_date; } - /// See + /// A giveaway has ended. See [TLDef(0x00CD5570)] public class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Start date of the giveaway public DateTime start_date; + /// If we're one of the winners of this giveaway, contains the Premium gift code, see here » for more info on the full giveaway flow. [IfFlag(0)] public string gift_code_slug; + /// End date of the giveaway. May be bigger than the end date specified in parameters of the giveaway. public DateTime finish_date; + /// Number of winners in the giveaway public int winners_count; + /// Number of winners, which activated their gift codes. public int activated_count; [Flags] public enum Flags : uint { + /// Whether we're one of the winners of this giveaway. winner = 0x1, + /// Whether the giveaway was canceled and was fully refunded. refunded = 0x2, } + /// Start date of the giveaway public override DateTime StartDate => start_date; } - /// See + /// Contains info about a prepaid giveaway ». See [TLDef(0xB2539D54)] public class PrepaidGiveaway : IObject { + /// Prepaid giveaway ID. public long id; + /// Duration in months of each gifted Telegram Premium subscription. public int months; + /// Number of given away Telegram Premium subscriptions. public int quantity; + /// Payment date. public DateTime date; } @@ -16072,11 +16346,13 @@ namespace TL public string id; /// ID of the user that applied the boost. [IfFlag(0)] public long user_id; + /// The message ID of the giveaway [IfFlag(2)] public int giveaway_msg_id; /// When was the boost applied public DateTime date; /// When does the boost expire public DateTime expires; + /// The created Telegram Premium gift code, only set if either gift or giveaway are set AND it is either a gift code for the currently logged in user or if it was already claimed. [IfFlag(4)] public string used_gift_slug; /// If set, this boost counts as multiplier boosts, otherwise it counts as a single boost. [IfFlag(5)] public int multiplier; @@ -16085,8 +16361,11 @@ namespace TL { /// Field has a value has_user_id = 0x1, + /// Whether this boost was applied because the channel directly gifted a subscription to the user. gift = 0x2, + /// Whether this boost was applied because the user was chosen in a giveaway started by the channel. giveaway = 0x4, + /// If set, the user hasn't yet invoked Payments_ApplyGiftCode to claim a subscription gifted directly or in a giveaway by the channel. unclaimed = 0x8, /// Field has a value has_used_gift_slug = 0x10, @@ -16289,7 +16568,9 @@ namespace TL public PublicForward[] forwards; /// Offset used for pagination. [IfFlag(0)] public string next_offset; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint @@ -16343,7 +16624,7 @@ namespace TL } /// Contains info about a color palette ». See - [TLDef(0x135BD42F)] + [TLDef(0xEF8430AB)] public class Help_PeerColorOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -16354,6 +16635,7 @@ namespace TL [IfFlag(1)] public Help_PeerColorSetBase colors; /// Dark mode palette. Optional, defaults to the palette in colors (or the autogenerated palette for IDs 0 to 6) if absent. [IfFlag(2)] public Help_PeerColorSetBase dark_colors; + [IfFlag(3)] public int channel_min_level; [Flags] public enum Flags : uint { @@ -16363,6 +16645,8 @@ namespace TL has_colors = 0x2, /// Field has a value has_dark_colors = 0x4, + /// Field has a value + has_channel_min_level = 0x8, } } @@ -16376,4 +16660,47 @@ namespace TL /// Usable color palettes. public Help_PeerColorOption[] colors; } + + /// See + public abstract class StoryReactionBase : IObject { } + /// See + [TLDef(0x6090D6D5)] + public class StoryReaction : StoryReactionBase + { + public Peer peer_id; + public DateTime date; + public Reaction reaction; + } + /// See + [TLDef(0xBBAB2643)] + public class StoryReactionPublicForward : StoryReactionBase + { + public MessageBase message; + } + /// See + [TLDef(0xCFCD0F13)] + public class StoryReactionPublicRepost : StoryReactionBase + { + public Peer peer_id; + public StoryItemBase story; + } + + /// See + [TLDef(0xAA5F789C)] + public class Stories_StoryReactionsList : IObject, IPeerResolver + { + public Flags flags; + public int count; + public StoryReactionBase[] reactions; + public Dictionary chats; + public Dictionary users; + [IfFlag(0)] public string next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + /// 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 3d415e5..be261bb 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1175,6 +1175,22 @@ namespace TL hash = hash, }); + /// See + /// a null value means account.emojiStatusesNotModified + public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) + => client.Invoke(new Account_GetChannelDefaultEmojiStatuses + { + hash = hash, + }); + + /// See + /// a null value means emojiListNotModified + public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) + => client.Invoke(new Account_GetChannelRestrictedStatusEmojis + { + hash = hash, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -3606,14 +3622,13 @@ namespace TL /// The bot that sent the button. /// ID of the message that contained the reply keyboard with the button. /// The button_id field from the . - /// The chosen peer. - public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, InputPeer requested_peer) + public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, params InputPeer[] requested_peers) => client.Invoke(new Messages_SendBotRequestedPeer { peer = peer, msg_id = msg_id, button_id = button_id, - requested_peer = requested_peer, + requested_peers = requested_peers, }); /// Represents a list of emoji categories, to be used when selecting custom emojis. See [bots: ✓] @@ -3960,14 +3975,6 @@ namespace TL { }); - /// Get changelog of current app.
Typically, an will be returned, containing one or more updates with app-specific changelogs. See
- /// Previous app version - public static Task Help_GetAppChangelog(this Client client, string prev_app_version) - => client.Invoke(new Help_GetAppChangelog - { - prev_app_version = prev_app_version, - }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] /// Number of pending updates /// Error message, if present @@ -4743,16 +4750,18 @@ namespace TL /// Channel whose accent color should be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info). /// Custom emoji ID used in the accent color pattern. - public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, int color, long? background_emoji_id = null) + public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, long? background_emoji_id = null, int? color = null, bool for_profile = false) => client.Invoke(new Channels_UpdateColor { - flags = (Channels_UpdateColor.Flags)(background_emoji_id != null ? 0x1 : 0), + flags = (Channels_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), channel = channel, - color = color, + color = color.GetValueOrDefault(), background_emoji_id = background_emoji_id.GetValueOrDefault(), }); - /// See Possible codes: 400 (details) + /// Users may also choose to display messages from all topics of a forum as if they were sent to a normal group, using a "View as messages" setting in the local client: this setting only affects the current account, and is synced to other logged in sessions using this method. See Possible codes: 400 (details) + /// The forum + /// The new value of the view_forum_as_messages flag. public static Task Channels_ToggleViewForumAsMessages(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleViewForumAsMessages { @@ -4768,6 +4777,14 @@ namespace TL channel = channel, }); + /// See + public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) + => client.Invoke(new Channels_UpdateEmojiStatus + { + channel = channel, + emoji_status = emoji_status, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5045,6 +5062,7 @@ namespace TL }); /// 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) => client.Invoke(new Payments_GetPremiumGiftCodeOptions { @@ -5660,18 +5678,13 @@ namespace TL /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of messages with peer_id equal to the public channel to which this message was forwarded. See
Possible codes: 400 (details)
/// Source channel /// Source message ID - /// Initially 0, then set to the next_rate parameter of - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) + public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, string offset, int limit = int.MaxValue) => client.Invoke(new Stats_GetMessagePublicForwards { channel = channel, msg_id = msg_id, - offset_rate = offset_rate, - offset_peer = offset_peer, - offset_id = offset_id, + offset = offset, limit = limit, }); @@ -5982,10 +5995,10 @@ namespace TL /// Story ID /// Offset for pagination, obtained from .next_offset /// Maximum number of results to return, see pagination - public static Task Stories_GetStoryViewsList(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false) + public static Task Stories_GetStoryViewsList(this Client client, InputPeer peer, int id, string offset, int limit = int.MaxValue, string q = null, bool just_contacts = false, bool reactions_first = false, bool forwards_first = false) => client.Invoke(new Stories_GetStoryViewsList { - flags = (Stories_GetStoryViewsList.Flags)((q != null ? 0x2 : 0) | (just_contacts ? 0x1 : 0) | (reactions_first ? 0x4 : 0)), + flags = (Stories_GetStoryViewsList.Flags)((q != null ? 0x2 : 0) | (just_contacts ? 0x1 : 0) | (reactions_first ? 0x4 : 0) | (forwards_first ? 0x8 : 0)), peer = peer, q = q, id = id, @@ -6064,7 +6077,8 @@ namespace TL { }); - /// See + /// Get the IDs of the maximum read stories for a set of peers. See + /// Peers public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) => client.Invoke(new Stories_GetPeerMaxIDs { @@ -6087,6 +6101,18 @@ namespace TL hidden = hidden, }); + /// See + public static Task Stories_GetStoryReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null, bool forwards_first = false) + => client.Invoke(new Stories_GetStoryReactionsList + { + flags = (Stories_GetStoryReactionsList.Flags)((reaction != null ? 0x1 : 0) | (offset != null ? 0x2 : 0) | (forwards_first ? 0x4 : 0)), + peer = peer, + id = id, + reaction = reaction, + offset = offset, + limit = limit, + }); + /// Obtains info about the boosts that were applied to a certain channel (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel » /// The channel @@ -6118,7 +6144,7 @@ namespace TL peer = peer, }); - /// Gets the current boost status of a peer. See Possible codes: 400 (details) + /// Gets the current number of boosts of a channel. See Possible codes: 400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus @@ -7039,6 +7065,18 @@ namespace TL.Methods public long hash; } + [TLDef(0x7727A7D5)] + public class Account_GetChannelDefaultEmojiStatuses : IMethod + { + public long hash; + } + + [TLDef(0x35A9E0D5)] + public class Account_GetChannelRestrictedStatusEmojis : IMethod + { + public long hash; + } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -9092,13 +9130,13 @@ namespace TL.Methods [TLDef(0x658B7188)] public class Messages_GetDefaultHistoryTTL : IMethod { } - [TLDef(0xFE38D01B)] + [TLDef(0x91B2D060)] public class Messages_SendBotRequestedPeer : IMethod { public InputPeer peer; public int msg_id; public int button_id; - public InputPeer requested_peer; + public InputPeer[] requested_peers; } [TLDef(0x7488CE5B)] @@ -9390,12 +9428,6 @@ namespace TL.Methods [TLDef(0x9CDF08CD)] public class Help_GetSupport : IMethod { } - [TLDef(0x9010EF6F)] - public class Help_GetAppChangelog : IMethod - { - public string prev_app_version; - } - [TLDef(0xEC22CFCD)] public class Help_SetBotUpdatesStatus : IMethod { @@ -9970,17 +10002,19 @@ namespace TL.Methods public byte[] random_id; } - [TLDef(0x621A201F)] + [TLDef(0xD8AA3671)] public class Channels_UpdateColor : IMethod { public Flags flags; public InputChannelBase channel; - public int color; + [IfFlag(2)] public int color; [IfFlag(0)] public long background_emoji_id; [Flags] public enum Flags : uint { has_background_emoji_id = 0x1, + for_profile = 0x2, + has_color = 0x4, } } @@ -9997,6 +10031,13 @@ namespace TL.Methods public InputChannelBase channel; } + [TLDef(0xF0D3E6A8)] + public class Channels_UpdateEmojiStatus : IMethod + { + public InputChannelBase channel; + public EmojiStatus emoji_status; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { @@ -10736,14 +10777,12 @@ namespace TL.Methods } } - [TLDef(0x5630281B)] - public class Stats_GetMessagePublicForwards : IMethod + [TLDef(0x5F150144)] + public class Stats_GetMessagePublicForwards : IMethod { public InputChannelBase channel; public int msg_id; - public int offset_rate; - public InputPeer offset_peer; - public int offset_id; + public string offset; public int limit; } @@ -11006,6 +11045,7 @@ namespace TL.Methods just_contacts = 0x1, has_q = 0x2, reactions_first = 0x4, + forwards_first = 0x8, } } @@ -11083,6 +11123,24 @@ namespace TL.Methods public bool hidden; } + [TLDef(0xB9B2881F)] + public class Stories_GetStoryReactionsList : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public Reaction reaction; + [IfFlag(1)] public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + has_reaction = 0x1, + has_offset = 0x2, + forwards_first = 0x4, + } + } + [TLDef(0x60F67660)] public class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3142dd1..b85f99a 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 = 167; // fetched 30/11/2023 15:07:08 + public const int Version = 169; // fetched 23/12/2023 19:20:07 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -133,10 +133,10 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x8E87CCD8] = typeof(Channel), + [0x0AADFC8F] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), - [0x723027BD] = typeof(ChannelFull), + [0x0F2BCB6F] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -161,7 +161,8 @@ namespace TL [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), [0x68CB6283] = typeof(MessageMediaStory), - [0x58260664] = typeof(MessageMediaGiveaway), + [0xDAAD85B0] = typeof(MessageMediaGiveaway), + [0xC6991068] = typeof(MessageMediaGiveawayResults), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -198,9 +199,9 @@ namespace TL [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), - [0xFE77345D] = typeof(MessageActionRequestedPeer), + [0x31518E9B] = typeof(MessageActionRequestedPeer), [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), - [0xD2CFDB0E] = typeof(MessageActionGiftCode), + [0x678C2E09] = typeof(MessageActionGiftCode), [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), [0x2A9FADC5] = typeof(MessageActionGiveawayResults), [0xD58A08C6] = typeof(Dialog), @@ -387,6 +388,8 @@ namespace TL [0x904DD49C] = typeof(UpdateBotChatBoost), [0x07B68920] = typeof(UpdateChannelViewForumAsMessages), [0xAE3F101D] = typeof(UpdatePeerWallpaper), + [0xAC21D3CE] = typeof(UpdateBotMessageReaction), + [0x09CB7759] = typeof(UpdateBotMessageReactions), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -517,6 +520,7 @@ namespace TL [0x04C4D4CE] = typeof(InputStickerSetEmojiGenericAnimations), [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), [0x44C1F8E9] = typeof(InputStickerSetEmojiDefaultTopicIcons), + [0x49748553] = typeof(InputStickerSetEmojiChannelDefaultStatuses), [0x2DD14EDC] = typeof(StickerSet), [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified @@ -537,7 +541,7 @@ namespace TL [0x308660C1] = typeof(KeyboardButtonUserProfile), [0x13767230] = typeof(KeyboardButtonWebView), [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), - [0x0D0B468C] = typeof(KeyboardButtonRequestPeer), + [0x53D7BFD8] = typeof(KeyboardButtonRequestPeer), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -794,8 +798,10 @@ namespace TL [0xAE168909] = typeof(ChannelAdminLogEventActionDeleteTopic), [0x5D8D353B] = typeof(ChannelAdminLogEventActionPinTopic), [0x64F36DFC] = typeof(ChannelAdminLogEventActionToggleAntiSpam), - [0x3C2B247B] = typeof(ChannelAdminLogEventActionChangeColor), - [0x445FC434] = typeof(ChannelAdminLogEventActionChangeBackgroundEmoji), + [0x5796E780] = typeof(ChannelAdminLogEventActionChangePeerColor), + [0x5E477B25] = typeof(ChannelAdminLogEventActionChangeProfilePeerColor), + [0x31BB5D52] = typeof(ChannelAdminLogEventActionChangeWallpaper), + [0x3EA9FEB1] = typeof(ChannelAdminLogEventActionChangeEmojiStatus), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -897,7 +903,7 @@ namespace TL [0x1C199183] = null,//Account_WallPapersNotModified [0xCDC3858C] = typeof(Account_WallPapers), [0xAD253D78] = typeof(CodeSettings), - [0x1DC1BCA4] = typeof(WallPaperSettings), + [0x372EFCD0] = typeof(WallPaperSettings), [0xBAA57628] = typeof(AutoDownloadSettings), [0x63CACF26] = typeof(Account_AutoDownloadSettings), [0xD5B3B9F9] = typeof(EmojiKeyword), @@ -1049,7 +1055,7 @@ namespace TL [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0xA3805F3F] = typeof(InputStorePaymentPremiumGiftCode), - [0x7C9375E6] = typeof(InputStorePaymentPremiumGiveaway), + [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty @@ -1127,7 +1133,9 @@ namespace TL [0x6EFC5E81] = typeof(Stories_AllStories), [0x5DD8C3C8] = typeof(Stories_Stories), [0xB0BDEAC5] = typeof(StoryView), - [0x46E9B9EC] = typeof(Stories_StoryViewsList), + [0x9083670B] = typeof(StoryViewPublicForward), + [0xBD74CF49] = typeof(StoryViewPublicRepost), + [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), [0x22C0F6D5] = typeof(InputReplyToMessage), [0x15B0F283] = typeof(InputReplyToStory), @@ -1138,11 +1146,13 @@ namespace TL [0xB282217F] = typeof(InputMediaAreaVenue), [0xDF8B3B22] = typeof(MediaAreaGeoPoint), [0x14455871] = typeof(MediaAreaSuggestedReaction), + [0x770416AF] = typeof(MediaAreaChannelPost), + [0x2271F2BF] = typeof(InputMediaAreaChannelPost), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), [0x257E962B] = typeof(PremiumGiftCodeOption), - [0xB722F158] = typeof(Payments_CheckedGiftCode), + [0x284A1096] = typeof(Payments_CheckedGiftCode), [0x4367DAA0] = typeof(Payments_GiveawayInfo), [0x00CD5570] = typeof(Payments_GiveawayInfoResults), [0xB2539D54] = typeof(PrepaidGiveaway), @@ -1161,9 +1171,13 @@ namespace TL [0xB54B5ACF] = typeof(PeerColor), [0x26219A58] = typeof(Help_PeerColorSet), [0x767D61EB] = typeof(Help_PeerColorProfileSet), - [0x135BD42F] = typeof(Help_PeerColorOption), + [0xEF8430AB] = typeof(Help_PeerColorOption), [0x2BA1F5CE] = null,//Help_PeerColorsNotModified [0x00F8ED08] = typeof(Help_PeerColors), + [0x6090D6D5] = typeof(StoryReaction), + [0xBBAB2643] = typeof(StoryReactionPublicForward), + [0xCFCD0F13] = typeof(StoryReactionPublicRepost), + [0xAA5F789C] = typeof(Stories_StoryReactionsList), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index a0081dd..afcf7bb 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: 167 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 169 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From a17f13475dd478d24bf506570c81480a18fd4b34 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 31 Dec 2023 18:29:36 +0100 Subject: [PATCH 152/336] API Layer 170: access to saved dialogs/history/peer (no idea what that means) --- .github/dev.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 100 ++++++++++++++++++- src/TL.SchemaFuncs.cs | 191 +++++++++++++++++++++++++++++++++---- src/TL.Table.cs | 12 ++- src/WTelegramClient.csproj | 2 +- 6 files changed, 283 insertions(+), 26 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 4624127..261f68e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.2-dev.$(Rev:r) +name: 3.6.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 749db94..148c38b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-169-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-170-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 3ffc471..b0255e7 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1632,7 +1632,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x38116EE0)] + [TLDef(0x76BEC211)] public partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1643,6 +1643,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Peer ID, the chat where this message was sent public Peer peer_id; + [IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message @@ -1732,6 +1733,8 @@ namespace TL noforwards = 0x4000000, /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x8000000, + /// Field has a value + has_saved_peer_id = 0x10000000, } /// ID of the message @@ -1878,6 +1881,9 @@ namespace TL spoiler = 0x10, /// Field has a value has_alt_document = 0x20, + video = 0x40, + round = 0x80, + voice = 0x100, } } /// Preview of webpage See @@ -5024,6 +5030,30 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } + /// See + [TLDef(0xAEAF9E74)] + public class UpdateSavedDialogPinned : Update + { + public Flags flags; + public DialogPeerBase peer; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + /// See + [TLDef(0x686C85A6)] + public class UpdatePinnedSavedDialogs : Update + { + public Flags flags; + [IfFlag(0)] public DialogPeerBase[] order; + + [Flags] public enum Flags : uint + { + has_order = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8483,7 +8513,7 @@ namespace TL } /// Info about a forwarded message See - [TLDef(0x5F777DCE)] + [TLDef(0x4E4DF4BB)] public class MessageFwdHeader : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -8502,6 +8532,9 @@ namespace TL [IfFlag(4)] public Peer saved_from_peer; /// Only for messages forwarded to the current user (inputPeerSelf), ID of the message that was forwarded from the original user/channel [IfFlag(4)] public int saved_from_msg_id; + [IfFlag(8)] public Peer saved_from_id; + [IfFlag(9)] public string saved_from_name; + [IfFlag(10)] public DateTime saved_date; /// PSA type [IfFlag(6)] public string psa_type; @@ -8521,6 +8554,13 @@ namespace TL has_psa_type = 0x40, /// Whether this message was imported from a foreign chat service, click here for more info » imported = 0x80, + /// Field has a value + has_saved_from_id = 0x100, + /// Field has a value + has_saved_from_name = 0x200, + /// Field has a value + has_saved_date = 0x400, + saved_out = 0x800, } } @@ -12371,7 +12411,9 @@ namespace TL public long file_size_max; /// Maximum suggested bitrate for uploading videos public int video_upload_maxbitrate; + /// A limit, specifying the maximum number of files that should be downloaded in parallel from the same DC, for files smaller than 20MB. public int small_queue_active_operations_max; + /// A limit, specifying the maximum number of files that should be downloaded in parallel from the same DC, for files bigger than 20MB. public int large_queue_active_operations_max; [Flags] public enum Flags : uint @@ -15433,6 +15475,7 @@ namespace TL inactive = 0x1, /// The bot is asking permission to send messages to the user: if the user agrees, set the write_allowed flag when invoking Messages_RequestAppWebView. request_write_access = 0x2, + /// Deprecated flag, can be ignored. has_settings = 0x4, } } @@ -15987,7 +16030,7 @@ namespace TL [IfFlag(0)] public int top_msg_id; /// Used to reply to messages sent to another chat (specified here), can only be used for non-protected chats and messages. [IfFlag(1)] public InputPeer reply_to_peer_id; - /// Used to quote-reply to only a certain section (specified here) of the original message. + /// Used to quote-reply to only a certain section (specified here) of the original message. The maximum UTF-8 length for quotes is specified in the quote_length_max config key. [IfFlag(2)] public string quote_text; /// Message entities for styled text from the quote_text field. [IfFlag(3)] public MessageEntity[] quote_entities; @@ -16703,4 +16746,55 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0xBD87CB6C)] + public class SavedDialog : IObject + { + public Flags flags; + public Peer peer; + public int top_message; + + [Flags] public enum Flags : uint + { + pinned = 0x4, + } + } + + /// See + public abstract class Messages_SavedDialogsBase : IObject + { + public virtual SavedDialog[] Dialogs { get; } + public virtual MessageBase[] Messages { get; } + public virtual Dictionary Chats { get; } + public virtual Dictionary Users { get; } + } + /// See + [TLDef(0xF83AE221)] + public class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver + { + public SavedDialog[] dialogs; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + + public override SavedDialog[] Dialogs => dialogs; + public override MessageBase[] Messages => messages; + public override Dictionary Chats => chats; + public override Dictionary Users => users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + /// See + [TLDef(0x44BA9DD9)] + public class Messages_SavedDialogsSlice : Messages_SavedDialogs + { + public int count; + } + /// See + [TLDef(0xC01F6FE8)] + public class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase + { + public int count; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index be261bb..86d591e 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -378,7 +378,7 @@ namespace TL { }); - /// Updates user profile. See Possible codes: 400,403 (details) + /// Updates user profile. See Possible codes: 400 (details) /// New user first name /// New user last name /// New bio @@ -391,7 +391,7 @@ namespace TL about = about, }); - /// Updates online user status. See Possible codes: 403 (details) + /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1217,7 +1217,7 @@ namespace TL errors = errors, }); - /// Get contact by telegram IDs See + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) => client.Invoke(new Contacts_GetContactIDs @@ -1225,7 +1225,7 @@ namespace TL hash = hash, }); - /// Returns the list of contact statuses. See + /// Use this method to obtain the online statuses of all contacts with an accessible associated Telegram account. See public static Task Contacts_GetStatuses(this Client client) => client.Invoke(new Contacts_GetStatuses { @@ -1520,13 +1520,14 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null) + public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_Search { - flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0)), + flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0) | (saved_peer_id != null ? 0x4 : 0)), peer = peer, q = q, from_id = from_id, + saved_peer_id = saved_peer_id, top_msg_id = top_msg_id.GetValueOrDefault(), filter = filter, min_date = min_date, @@ -2776,11 +2777,12 @@ namespace TL /// Peer where to search /// If set, consider only messages within the specified forum topic /// Search filters - public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null) + public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchCounters { - flags = (Messages_GetSearchCounters.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_GetSearchCounters.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x4 : 0)), peer = peer, + saved_peer_id = saved_peer_id, top_msg_id = top_msg_id.GetValueOrDefault(), filters = filters, }); @@ -3195,10 +3197,12 @@ namespace TL /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, DateTime offset_date = default) + public static Task Messages_GetSearchResultsCalendar(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, DateTime offset_date = default, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchResultsCalendar { + flags = (Messages_GetSearchResultsCalendar.Flags)(saved_peer_id != null ? 0x4 : 0), peer = peer, + saved_peer_id = saved_peer_id, filter = filter, offset_id = offset_id, offset_date = offset_date, @@ -3209,10 +3213,12 @@ namespace TL /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, int limit = int.MaxValue) + public static Task Messages_GetSearchResultsPositions(this Client client, InputPeer peer, MessagesFilter filter = null, int offset_id = default, int limit = int.MaxValue, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetSearchResultsPositions { + flags = (Messages_GetSearchResultsPositions.Flags)(saved_peer_id != null ? 0x4 : 0), peer = peer, + saved_peer_id = saved_peer_id, filter = filter, offset_id = offset_id, limit = limit, @@ -3252,7 +3258,7 @@ namespace TL enabled = enabled, }); - /// Change the default peer that should be used when sending messages to a specific group See Possible codes: 400 (details) + /// Change the default peer that should be used when sending messages, reactions, poll votes to a specific group See Possible codes: 400 (details) /// Group /// The default peer that should be used when sending messages to the group public static Task Messages_SaveDefaultSendAs(this Client client, InputPeer peer, InputPeer send_as) @@ -3419,7 +3425,7 @@ namespace TL enabled = enabled, }); - /// Open a bot mini app, sending over user information after user confirmation. See + /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400 (details) /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). @@ -3737,6 +3743,65 @@ namespace TL hash = hash, }); + /// See + public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) + => client.Invoke(new Messages_GetSavedDialogs + { + flags = (Messages_GetSavedDialogs.Flags)(exclude_pinned ? 0x1 : 0), + offset_date = offset_date, + offset_id = offset_id, + offset_peer = offset_peer, + limit = limit, + hash = hash, + }); + + /// See + public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) + => client.Invoke(new Messages_GetSavedHistory + { + peer = peer, + offset_id = offset_id, + offset_date = offset_date, + add_offset = add_offset, + limit = limit, + max_id = max_id, + min_id = min_id, + hash = hash, + }); + + /// See + public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) + => client.Invoke(new Messages_DeleteSavedHistory + { + flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + peer = peer, + max_id = max_id, + min_date = min_date.GetValueOrDefault(), + max_date = max_date.GetValueOrDefault(), + }); + + /// See + public static Task Messages_GetPinnedSavedDialogs(this Client client) + => client.Invoke(new Messages_GetPinnedSavedDialogs + { + }); + + /// See + public static Task Messages_ToggleSavedDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) + => client.Invoke(new Messages_ToggleSavedDialogPin + { + flags = (Messages_ToggleSavedDialogPin.Flags)(pinned ? 0x1 : 0), + peer = peer, + }); + + /// See + public static Task Messages_ReorderPinnedSavedDialogs(this Client client, InputDialogPeerBase[] order, bool force = false) + => client.Invoke(new Messages_ReorderPinnedSavedDialogs + { + flags = (Messages_ReorderPinnedSavedDialogs.Flags)(force ? 0x1 : 0), + order = order, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -3745,9 +3810,11 @@ namespace TL /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) /// PTS, see updates. + /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 /// date, see updates. /// QTS, see updates. + /// QTS limit public static Task Updates_GetDifference(this Client client, int pts, DateTime date, int qts, int? pts_total_limit = null, int? pts_limit = null, int? qts_limit = null) => client.Invoke(new Updates_GetDifference { @@ -4295,7 +4362,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406,500 (details) + /// Join a channel/supergroup See Possible codes: 400,406 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -7339,13 +7406,14 @@ namespace TL.Methods public long hash; } - [TLDef(0xA0FDA762)] + [TLDef(0xA7B4E929)] public class Messages_Search : IMethod { public Flags flags; public InputPeer peer; public string q; [IfFlag(0)] public InputPeer from_id; + [IfFlag(2)] public InputPeer saved_peer_id; [IfFlag(1)] public int top_msg_id; public MessagesFilter filter; public DateTime min_date; @@ -7361,6 +7429,7 @@ namespace TL.Methods { has_from_id = 0x1, has_top_msg_id = 0x2, + has_saved_peer_id = 0x4, } } @@ -8433,17 +8502,19 @@ namespace TL.Methods public string lang_code; } - [TLDef(0x00AE7CC1)] + [TLDef(0x1BBCF300)] public class Messages_GetSearchCounters : IMethod { public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; [IfFlag(0)] public int top_msg_id; public MessagesFilter[] filters; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x4, } } @@ -8778,22 +8849,36 @@ namespace TL.Methods public int msg_id; } - [TLDef(0x49F0BDE9)] + [TLDef(0x6AA3F6BD)] public class Messages_GetSearchResultsCalendar : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; public MessagesFilter filter; public int offset_id; public DateTime offset_date; + + [Flags] public enum Flags : uint + { + has_saved_peer_id = 0x4, + } } - [TLDef(0x6E9583A3)] + [TLDef(0x9C7F2F10)] public class Messages_GetSearchResultsPositions : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(2)] public InputPeer saved_peer_id; public MessagesFilter filter; public int offset_id; public int limit; + + [Flags] public enum Flags : uint + { + has_saved_peer_id = 0x4, + } } [TLDef(0x7FE7E815)] @@ -9233,6 +9318,78 @@ namespace TL.Methods } } + [TLDef(0x5381D21A)] + public class Messages_GetSavedDialogs : IMethod + { + public Flags flags; + public DateTime offset_date; + public int offset_id; + public InputPeer offset_peer; + public int limit; + public long hash; + + [Flags] public enum Flags : uint + { + exclude_pinned = 0x1, + } + } + + [TLDef(0x3D9A414D)] + public class Messages_GetSavedHistory : IMethod + { + public InputPeer peer; + public int offset_id; + public DateTime offset_date; + public int add_offset; + public int limit; + public int max_id; + public int min_id; + public long hash; + } + + [TLDef(0x6E98102B)] + public class Messages_DeleteSavedHistory : IMethod + { + public Flags flags; + public InputPeer peer; + public int max_id; + [IfFlag(2)] public DateTime min_date; + [IfFlag(3)] public DateTime max_date; + + [Flags] public enum Flags : uint + { + has_min_date = 0x4, + has_max_date = 0x8, + } + } + + [TLDef(0xD63D94E0)] + public class Messages_GetPinnedSavedDialogs : IMethod { } + + [TLDef(0xAC81BBDE)] + public class Messages_ToggleSavedDialogPin : IMethod + { + public Flags flags; + public InputDialogPeerBase peer; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + + [TLDef(0x8B716587)] + public class Messages_ReorderPinnedSavedDialogs : IMethod + { + public Flags flags; + public InputDialogPeerBase[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b85f99a..3e8388d 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 = 169; // fetched 23/12/2023 19:20:07 + public const int Version = 170; // fetched 31/12/2023 17:22:50 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,7 +145,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x38116EE0] = typeof(Message), + [0x76BEC211] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -390,6 +390,8 @@ namespace TL [0xAE3F101D] = typeof(UpdatePeerWallpaper), [0xAC21D3CE] = typeof(UpdateBotMessageReaction), [0x09CB7759] = typeof(UpdateBotMessageReactions), + [0xAEAF9E74] = typeof(UpdateSavedDialogPinned), + [0x686C85A6] = typeof(UpdatePinnedSavedDialogs), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -621,7 +623,7 @@ namespace TL [0x17DB940B] = typeof(BotInlineMediaResult), [0xE021F2F6] = typeof(Messages_BotResults), [0x5DAB1AF4] = typeof(ExportedMessageLink), - [0x5F777DCE] = typeof(MessageFwdHeader), + [0x4E4DF4BB] = typeof(MessageFwdHeader), [0x3DBB5986] = typeof(Auth_SentCodeTypeApp), [0xC000BBA2] = typeof(Auth_SentCodeTypeSms), [0x5353E5A7] = typeof(Auth_SentCodeTypeCall), @@ -1178,6 +1180,10 @@ namespace TL [0xBBAB2643] = typeof(StoryReactionPublicForward), [0xCFCD0F13] = typeof(StoryReactionPublicRepost), [0xAA5F789C] = typeof(Stories_StoryReactionsList), + [0xBD87CB6C] = typeof(SavedDialog), + [0xF83AE221] = typeof(Messages_SavedDialogs), + [0x44BA9DD9] = typeof(Messages_SavedDialogsSlice), + [0xC01F6FE8] = typeof(Messages_SavedDialogsNotModified), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index afcf7bb..0010f5c 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: 169 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 170 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 48a132245231d93cc08800875abb7afe5e5ee8c8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 15 Jan 2024 14:45:58 +0100 Subject: [PATCH 153/336] Fix #225: RpcError INPUT_METHOD_INVALID_3105996036 when using client.DisableUpdates() --- .github/dev.yml | 2 +- src/Client.cs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 261f68e..1d237e5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.3-dev.$(Rev:r) +name: 3.6.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 325cfeb..af22c38 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1355,7 +1355,7 @@ namespace WTelegram /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied public async Task Invoke(IMethod query) { - if (_dcSession.WithoutUpdates && query is not IMethod) + if (_dcSession.WithoutUpdates && query is not IMethod and not IMethod) query = new TL.Methods.InvokeWithoutUpdates { query = query }; bool got503 = false; retry: From 91a8eab86a615efdc157806e1f957ea7380e9b4f Mon Sep 17 00:00:00 2001 From: Ali <36738510+MrAliSalehi@users.noreply.github.com> Date: Tue, 16 Jan 2024 17:25:51 +0330 Subject: [PATCH 154/336] add implicit conversion for `Peer` (#229) --- src/TL.Helpers.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 6f0021d..8f187a0 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -128,6 +128,7 @@ namespace TL { public abstract long ID { get; } protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); + public static implicit operator long(Peer peer) => peer.ID; } partial class PeerUser { From 7dc578f91d2ef18ab5bc3604c8adb82fbacd0e86 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 16 Jan 2024 18:09:45 +0100 Subject: [PATCH 155/336] api doc --- src/TL.Schema.cs | 27 +++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 32 ++++++++++++++++++++++---------- 2 files changed, 41 insertions(+), 18 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index b0255e7..be2abc6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1807,7 +1807,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2063,6 +2063,7 @@ namespace TL [TLDef(0xC6991068)] public class MessageMediaGiveawayResults : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long channel_id; [IfFlag(3)] public int additional_peers_count; @@ -2077,8 +2078,10 @@ namespace TL [Flags] public enum Flags : uint { only_new_subscribers = 0x1, + /// Field has a value has_prize_description = 0x2, refunded = 0x4, + /// Field has a value has_additional_peers_count = 0x8, } } @@ -3543,7 +3546,7 @@ namespace TL [TLDef(0x1BB00451)] public class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -5034,6 +5037,7 @@ namespace TL [TLDef(0xAEAF9E74)] public class UpdateSavedDialogPinned : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DialogPeerBase peer; @@ -5046,11 +5050,13 @@ namespace TL [TLDef(0x686C85A6)] public class UpdatePinnedSavedDialogs : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public DialogPeerBase[] order; [Flags] public enum Flags : uint { + /// Field has a value has_order = 0x1, } } @@ -6927,7 +6933,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -10603,7 +10609,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -15924,7 +15930,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Story view date and reaction information See Derived classes: + /// Story view date and reaction information See Derived classes: , , public abstract class StoryViewBase : IObject { } /// Story view date and reaction information See [TLDef(0xB0BDEAC5)] @@ -15953,6 +15959,7 @@ namespace TL [TLDef(0x9083670B)] public class StoryViewPublicForward : StoryViewBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public MessageBase message; @@ -15966,6 +15973,7 @@ namespace TL [TLDef(0xBD74CF49)] public class StoryViewPublicRepost : StoryViewBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer_id; public StoryItemBase story; @@ -16105,7 +16113,7 @@ namespace TL public double rotation; } - /// Represents a story media area » See Derived classes: , , , + /// Represents a story media area » See Derived classes: , , , , , public abstract class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] @@ -16704,7 +16712,7 @@ namespace TL public Help_PeerColorOption[] colors; } - /// See + /// See Derived classes: , , public abstract class StoryReactionBase : IObject { } /// See [TLDef(0x6090D6D5)] @@ -16732,6 +16740,7 @@ namespace TL [TLDef(0xAA5F789C)] public class Stories_StoryReactionsList : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public StoryReactionBase[] reactions; @@ -16741,6 +16750,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } /// returns a or for the given Peer @@ -16751,6 +16761,7 @@ namespace TL [TLDef(0xBD87CB6C)] public class SavedDialog : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int top_message; @@ -16761,7 +16772,7 @@ namespace TL } } - /// See + /// See Derived classes: , , public abstract class Messages_SavedDialogsBase : IObject { public virtual SavedDialog[] Dialogs { get; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 86d591e..ef09a2b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1175,7 +1175,8 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] + /// Hash for pagination, for more info click here /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetChannelDefaultEmojiStatuses @@ -1183,7 +1184,8 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] + /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetChannelRestrictedStatusEmojis @@ -3743,7 +3745,11 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination + /// Hash for pagination, for more info click here public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs { @@ -3755,7 +3761,12 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination + /// Hash for pagination, for more info click here public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetSavedHistory { @@ -3769,7 +3780,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) => client.Invoke(new Messages_DeleteSavedHistory { @@ -3780,13 +3791,13 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// See + /// See [bots: ✓] public static Task Messages_GetPinnedSavedDialogs(this Client client) => client.Invoke(new Messages_GetPinnedSavedDialogs { }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleSavedDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.Invoke(new Messages_ToggleSavedDialogPin { @@ -3794,7 +3805,7 @@ namespace TL peer = peer, }); - /// See + /// See [bots: ✓] public static Task Messages_ReorderPinnedSavedDialogs(this Client client, InputDialogPeerBase[] order, bool force = false) => client.Invoke(new Messages_ReorderPinnedSavedDialogs { @@ -4844,7 +4855,7 @@ namespace TL channel = channel, }); - /// See + /// See [bots: ✓] public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) => client.Invoke(new Channels_UpdateEmojiStatus { @@ -6168,7 +6179,8 @@ namespace TL hidden = hidden, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Stories_GetStoryReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null, bool forwards_first = false) => client.Invoke(new Stories_GetStoryReactionsList { From a0841fee4c416b86c552c6bd5071e4fe3bf5e262 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 16 Jan 2024 18:13:08 +0100 Subject: [PATCH 156/336] API Layer 171: Saved reactions/tags --- src/TL.Schema.cs | 28 ++++++++++++++++++ src/TL.SchemaFuncs.cs | 59 ++++++++++++++++++++++++++++++++++++-- src/TL.Table.cs | 7 ++++- src/WTelegramClient.csproj | 2 +- 4 files changed, 91 insertions(+), 5 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index be2abc6..5e52a37 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5060,6 +5060,9 @@ namespace TL has_order = 0x1, } } + /// See + [TLDef(0x39C67432)] + public class UpdateSavedReactionTags : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -14328,6 +14331,7 @@ namespace TL has_recent_reactions = 0x2, /// Whether Messages_GetMessageReactionsList can be used to see how each specific peer reacted to the message can_see_list = 0x4, + reactions_as_tags = 0x8, } } @@ -16808,4 +16812,28 @@ namespace TL { public int count; } + + /// See + [TLDef(0xCB6FF828)] + public class SavedReactionTag : IObject + { + public Flags flags; + public Reaction reaction; + [IfFlag(0)] public string title; + public int count; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + } + } + + /// See + /// a value means messages.savedReactionTagsNotModified + [TLDef(0x3259950A)] + public class Messages_SavedReactionTags : IObject + { + public SavedReactionTag[] tags; + public long hash; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ef09a2b..972078c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1522,14 +1522,15 @@ namespace TL /// Maximum message ID to return /// Minimum message ID to return /// Hash - public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null, InputPeer saved_peer_id = null) + public static Task Messages_Search(this Client client, InputPeer peer, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer from_id = null, int? top_msg_id = null, InputPeer saved_peer_id = null, Reaction[] saved_reaction = null) => client.Invoke(new Messages_Search { - flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0) | (saved_peer_id != null ? 0x4 : 0)), + flags = (Messages_Search.Flags)((from_id != null ? 0x1 : 0) | (top_msg_id != null ? 0x2 : 0) | (saved_peer_id != null ? 0x4 : 0) | (saved_reaction != null ? 0x8 : 0)), peer = peer, q = q, from_id = from_id, saved_peer_id = saved_peer_id, + saved_reaction = saved_reaction, top_msg_id = top_msg_id.GetValueOrDefault(), filter = filter, min_date = min_date, @@ -3813,6 +3814,31 @@ namespace TL order = order, }); + /// See + /// a null value means messages.savedReactionTagsNotModified + public static Task Messages_GetSavedReactionTags(this Client client, long hash = default) + => client.Invoke(new Messages_GetSavedReactionTags + { + hash = hash, + }); + + /// See + public static Task Messages_UpdateSavedReactionTag(this Client client, Reaction reaction, string title = null) + => client.Invoke(new Messages_UpdateSavedReactionTag + { + flags = (Messages_UpdateSavedReactionTag.Flags)(title != null ? 0x1 : 0), + reaction = reaction, + title = title, + }); + + /// See + /// a null value means messages.reactionsNotModified + public static Task Messages_GetDefaultTagReactions(this Client client, long hash = default) + => client.Invoke(new Messages_GetDefaultTagReactions + { + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -7418,7 +7444,7 @@ namespace TL.Methods public long hash; } - [TLDef(0xA7B4E929)] + [TLDef(0x29EE847A)] public class Messages_Search : IMethod { public Flags flags; @@ -7426,6 +7452,7 @@ namespace TL.Methods public string q; [IfFlag(0)] public InputPeer from_id; [IfFlag(2)] public InputPeer saved_peer_id; + [IfFlag(3)] public Reaction[] saved_reaction; [IfFlag(1)] public int top_msg_id; public MessagesFilter filter; public DateTime min_date; @@ -7442,6 +7469,7 @@ namespace TL.Methods has_from_id = 0x1, has_top_msg_id = 0x2, has_saved_peer_id = 0x4, + has_saved_reaction = 0x8, } } @@ -9402,6 +9430,31 @@ namespace TL.Methods } } + [TLDef(0x761DDACF)] + public class Messages_GetSavedReactionTags : IMethod + { + public long hash; + } + + [TLDef(0x60297DEC)] + public class Messages_UpdateSavedReactionTag : IMethod + { + public Flags flags; + public Reaction reaction; + [IfFlag(0)] public string title; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + } + } + + [TLDef(0xBDF93428)] + public class Messages_GetDefaultTagReactions : IMethod + { + public long hash; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3e8388d..d776f61 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 = 170; // fetched 31/12/2023 17:22:50 + public const int Version = 171; // fetched 16/01/2024 17:09:52 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -392,6 +392,7 @@ namespace TL [0x09CB7759] = typeof(UpdateBotMessageReactions), [0xAEAF9E74] = typeof(UpdateSavedDialogPinned), [0x686C85A6] = typeof(UpdatePinnedSavedDialogs), + [0x39C67432] = typeof(UpdateSavedReactionTags), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1184,6 +1185,9 @@ namespace TL [0xF83AE221] = typeof(Messages_SavedDialogs), [0x44BA9DD9] = typeof(Messages_SavedDialogsSlice), [0xC01F6FE8] = typeof(Messages_SavedDialogsNotModified), + [0xCB6FF828] = typeof(SavedReactionTag), + [0x889B59EF] = null,//Messages_SavedReactionTagsNotModified + [0x3259950A] = typeof(Messages_SavedReactionTags), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1307,6 +1311,7 @@ namespace TL [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified [typeof(BotApp)] = 0x5DA674B7, //botAppNotModified [typeof(Help_PeerColors)] = 0x2BA1F5CE, //help.peerColorsNotModified + [typeof(Messages_SavedReactionTags)] = 0x889B59EF, //messages.savedReactionTagsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 0010f5c..a4f45ff 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: 170 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 171 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2023 MIT https://github.com/wiz0u/WTelegramClient From 6f3c8732ec2fc1ca1c8a0c948b848446748ff36f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 18 Jan 2024 15:53:17 +0100 Subject: [PATCH 157/336] API Layer 172: Premium last-seen, read-dates, contacts --- .github/dev.yml | 2 +- LICENSE.txt | 2 +- README.md | 2 +- src/TL.Schema.cs | 169 ++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 59 ++++++++++--- src/TL.Table.cs | 9 +- src/WTelegramClient.csproj | 4 +- 7 files changed, 198 insertions(+), 49 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1d237e5..924fdae 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.4-dev.$(Rev:r) +name: 3.6.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/LICENSE.txt b/LICENSE.txt index 08900bc..3265a97 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2021 Olivier Marcoux +Copyright (c) 2021-2024 Olivier Marcoux Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/README.md b/README.md index 148c38b..16ed2af 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-170-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-172-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5e52a37..e6c7549 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -864,6 +864,7 @@ namespace TL has_color = 0x100, /// Field has a value has_profile_color = 0x200, + contact_require_premium = 0x400, } } @@ -910,14 +911,38 @@ namespace TL public int was_online; } /// Online status: last seen recently See - [TLDef(0xE26F42F1)] - public partial class UserStatusRecently : UserStatus { } + [TLDef(0x7B197DC8)] + public partial class UserStatusRecently : UserStatus + { + public Flags flags; + + [Flags] public enum Flags : uint + { + by_me = 0x1, + } + } /// Online status: last seen last week See - [TLDef(0x07BF09FC)] - public partial class UserStatusLastWeek : UserStatus { } + [TLDef(0x541A1D1A)] + public partial class UserStatusLastWeek : UserStatus + { + public Flags flags; + + [Flags] public enum Flags : uint + { + by_me = 0x1, + } + } /// Online status: last seen last month See - [TLDef(0x77EBC742)] - public partial class UserStatusLastMonth : UserStatus { } + [TLDef(0x65899777)] + public partial class UserStatusLastMonth : UserStatus + { + public Flags flags; + + [Flags] public enum Flags : uint + { + by_me = 0x1, + } + } /// Object defines a group. See Derived classes: , , , , public abstract partial class ChatBase : IObject @@ -1039,8 +1064,11 @@ namespace TL [IfFlag(36)] public int stories_max_id; /// The channel's accent color. [IfFlag(39)] public PeerColor color; + /// The channel's profile color. [IfFlag(40)] public PeerColor profile_color; + /// Emoji status [IfFlag(41)] public EmojiStatus emoji_status; + /// Boost level [IfFlag(42)] public int level; [Flags] public enum Flags : uint @@ -1373,6 +1401,7 @@ namespace TL [IfFlag(30)] public ChatReactions available_reactions; /// Channel stories [IfFlag(36)] public PeerStories stories; + /// Wallpaper [IfFlag(39)] public WallPaperBase wallpaper; [Flags] public enum Flags : uint @@ -2040,6 +2069,7 @@ namespace TL public long[] channels; /// If set, only users residing in these countries can participate in the giveaway, (specified as a list of two-letter ISO 3166-1 alpha-2 country codes); otherwise there are no country-based limitations. [IfFlag(1)] public string[] countries_iso2; + /// Can contain a textual description of additional giveaway prizes. [IfFlag(3)] public string prize_description; /// Number of Telegram Premium subscriptions given away. public int quantity; @@ -2054,32 +2084,44 @@ namespace TL only_new_subscribers = 0x1, /// Field has a value has_countries_iso2 = 0x2, + /// If set, giveaway winners are public and will be listed in a message that will be automatically sent to the channel once the giveaway ends. winners_are_visible = 0x4, /// Field has a value has_prize_description = 0x8, } } - /// See + /// A giveaway with public winners has finished, this constructor contains info about the winners. See [TLDef(0xC6991068)] public class MessageMediaGiveawayResults : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the channel that was automatically boosted by the winners of the giveaway for duration of the Premium subscription. public long channel_id; + /// Number of other channels that participated in the giveaway. [IfFlag(3)] public int additional_peers_count; + /// Identifier of the message with the giveaway in channel_id. public int launch_msg_id; + /// Total number of winners in the giveaway. public int winners_count; + /// Number of not-yet-claimed prizes. public int unclaimed_count; + /// Up to 100 user identifiers of the winners of the giveaway. public long[] winners; + /// Duration in months of each Telegram Premium subscription in the giveaway. public int months; + /// Can contain a textual description of additional giveaway prizes. [IfFlag(1)] public string prize_description; + /// Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in initial parameters of the giveaway. public DateTime until_date; [Flags] public enum Flags : uint { + /// If set, only new subscribers starting from the giveaway creation date participated in the giveaway. only_new_subscribers = 0x1, /// Field has a value has_prize_description = 0x2, + /// If set, the giveaway was canceled and was fully refunded. refunded = 0x4, /// Field has a value has_additional_peers_count = 0x8, @@ -2466,12 +2508,13 @@ namespace TL /// The photo that the user suggested we set as profile picture. public PhotoBase photo; } - /// Contains info about a peer that the user shared with the bot after clicking on a button. See + /// Contains info about one or more peers that the user shared with the bot after clicking on a button. See [TLDef(0x31518E9B)] public class MessageActionRequestedPeer : MessageAction { /// button_id contained in the public int button_id; + /// The shared peers public Peer[] peers; } /// The wallpaper » of the current chat was changed. See @@ -2503,9 +2546,13 @@ namespace TL public int months; /// Slug of the Telegram Premium giftcode link public string slug; + /// Three-letter ISO 4217 currency code [IfFlag(2)] public string currency; + /// Total price 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). [IfFlag(2)] public long amount; + /// If set, the gift was made using the specified cryptocurrency. [IfFlag(3)] public string crypto_currency; + /// If crypto_currency is set, contains the paid amount, in the smallest units of the cryptocurrency. [IfFlag(3)] public long crypto_amount; [Flags] public enum Flags : uint @@ -3222,8 +3269,10 @@ namespace TL stories_pinned_available = 0x4000000, /// Whether we've blocked this user, preventing them from seeing our stories ». blocked_my_stories_from = 0x8000000, - /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, + contact_require_premium = 0x20000000, + read_dates_private = 0x40000000, } } @@ -5003,32 +5052,44 @@ namespace TL { /// Field has a value has_wallpaper = 0x1, - /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x2, } } - /// See + /// Bots only: a user has changed their reactions on a message with public reactions. See [TLDef(0xAC21D3CE)] public class UpdateBotMessageReaction : Update { + /// Peer of the reacted-to message. public Peer peer; + /// ID of the reacted-to message. public int msg_id; + /// Date of the change. public DateTime date; + /// The user that (un)reacted to the message. public Peer actor; + /// Old reactions public Reaction[] old_reactions; + /// New reactions public Reaction[] new_reactions; + /// QTS event sequence identifier public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// Bots only: the number of reactions on a message with anonymous reactions has changed. See [TLDef(0x09CB7759)] public class UpdateBotMessageReactions : Update { + /// Peer of the reacted-to message. public Peer peer; + /// ID of the reacted-to message. public int msg_id; + /// Date of the change. public DateTime date; + /// New reaction counters. public ReactionCount[] reactions; + /// QTS event sequence identifier public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); @@ -6980,7 +7041,7 @@ namespace TL /// Default custom emoji stickerset for forum topic icons See [TLDef(0x44C1F8E9)] public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } - /// See + /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } @@ -7035,6 +7096,7 @@ namespace TL has_thumb_document_id = 0x100, /// Whether the color of this TGS custom emoji stickerset should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. text_color = 0x200, + /// If set, this custom emoji stickerset can be used in channel emoji statuses. channel_emoji_status = 0x400, } } @@ -7283,14 +7345,15 @@ namespace TL public class KeyboardButtonSimpleWebView : KeyboardButtonWebView { } - /// Prompts the user to select and share a peer with the bot using Messages_SendBotRequestedPeer See + /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See [TLDef(0x53D7BFD8, inheritBefore = true)] public class KeyboardButtonRequestPeer : KeyboardButton { /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; - /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use a peer of the specified type, if needed.
+ /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; + /// Maximum number of peers that can be chosne. public int max_quantity; } @@ -10963,28 +11026,34 @@ namespace TL /// Whether antispam functionality was enabled or disabled. public bool new_value; } - ///
See + /// The message accent color was changed See [TLDef(0x5796E780)] public class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction { + /// Previous accent palette public PeerColor prev_value; + /// New accent palette public PeerColor new_value; } - /// See + /// The profile accent color was changed See [TLDef(0x5E477B25)] public class ChannelAdminLogEventActionChangeProfilePeerColor : ChannelAdminLogEventActionChangePeerColor { } - /// See + /// The wallpaper was changed See [TLDef(0x31BB5D52)] public class ChannelAdminLogEventActionChangeWallpaper : ChannelAdminLogEventAction { + /// Previous wallpaper public WallPaperBase prev_value; + /// New wallpaper public WallPaperBase new_value; } - /// See + /// The emoji status was changed See [TLDef(0x3EA9FEB1)] public class ChannelAdminLogEventActionChangeEmojiStatus : ChannelAdminLogEventAction { + /// Previous emoji status public EmojiStatus prev_value; + /// New emoji status public EmojiStatus new_value; } @@ -12383,6 +12452,7 @@ namespace TL [IfFlag(3)] public int intensity; /// Clockwise rotation angle of the gradient, in degrees; 0-359. Should be always divisible by 45. [IfFlag(4)] public int rotation; + /// If set, this wallpaper can be used as a channel wallpaper and is represented by the specified UTF-8 emoji. [IfFlag(7)] public string emoticon; [Flags] public enum Flags : uint @@ -13341,6 +13411,8 @@ namespace TL keep_archived_unmuted = 0x2, /// Whether unmuted chats that are always included or pinned in a folder, will be kept in the Archive chat list when they get a new message. Ignored if keep_archived_unmuted is set. keep_archived_folders = 0x4, + hide_read_marks = 0x8, + new_noncontact_peers_require_premium = 0x10, } } @@ -14800,6 +14872,7 @@ namespace TL [IfFlag(1)] public InputPeer[] additional_peers; /// The set of users that can participate to the giveaway can be restricted by passing here an explicit whitelist of up to giveaway_countries_max countries, specified as two-letter ISO 3166-1 alpha-2 country codes. [IfFlag(2)] public string[] countries_iso2; + /// Can contain a textual description of additional giveaway prizes. [IfFlag(4)] public string prize_description; /// Random ID to avoid resending the giveaway public long random_id; @@ -14818,6 +14891,7 @@ namespace TL has_additional_peers = 0x2, /// Field has a value has_countries_iso2 = 0x4, + /// If set, giveaway winners are public and will be listed in a message that will be automatically sent to the channel once the giveaway ends. winners_are_visible = 0x8, /// Field has a value has_prize_description = 0x10, @@ -15959,32 +16033,39 @@ namespace TL has_reaction = 0x4, } } - /// See + /// A certain peer has forwarded the story as a message to a public chat or channel. See [TLDef(0x9083670B)] public class StoryViewPublicForward : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The message with the forwarded story. public MessageBase message; [Flags] public enum Flags : uint { + /// Whether we have completely blocked this user, including from viewing more of our stories. blocked = 0x1, + /// Whether we have blocked this user from viewing more of our stories. blocked_my_stories_from = 0x2, } } - /// See + /// A certain peer has reposted the story. See [TLDef(0xBD74CF49)] public class StoryViewPublicRepost : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The peer that reposted the story. public Peer peer_id; + /// The reposted story. public StoryItemBase story; [Flags] public enum Flags : uint { + /// Whether we have completely blocked this user, including from viewing more of our stories. blocked = 0x1, + /// Whether we have blocked this user from viewing more of our stories. blocked_my_stories_from = 0x2, } } @@ -15997,12 +16078,15 @@ namespace TL public Flags flags; /// Total number of results that can be fetched public int count; + /// Total number of story views public int views_count; + /// Total number of story forwards/reposts public int forwards_count; /// Number of reactions that were added to the story public int reactions_count; /// Story view date and reaction information public StoryViewBase[] views; + /// Mentioned chats public Dictionary chats; /// Mentioned users public Dictionary users; @@ -16177,20 +16261,26 @@ namespace TL flipped = 0x2, } } - /// See + /// Represents a channel post. See [TLDef(0x770416AF)] public class MediaAreaChannelPost : MediaArea { + /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + /// The channel that posted the message public long channel_id; + /// ID of the channel message public int msg_id; } - /// See + /// Represents a channel post See [TLDef(0x2271F2BF)] public class InputMediaAreaChannelPost : MediaArea { + /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + /// The channel that posted the message public InputChannelBase channel; + /// ID of the channel message public int msg_id; } @@ -16643,9 +16733,9 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Color palette ID, see here » for more info. + /// Color palette ID, see here » for more info; if not set, the default palette should be used. [IfFlag(0)] public int color; - /// Custom emoji ID used to generate the pattern. + /// Optional custom emoji ID used to generate the pattern. [IfFlag(1)] public long background_emoji_id; [Flags] public enum Flags : uint @@ -16690,6 +16780,7 @@ namespace TL [IfFlag(1)] public Help_PeerColorSetBase colors; /// Dark mode palette. Optional, defaults to the palette in colors (or the autogenerated palette for IDs 0 to 6) if absent. [IfFlag(2)] public Help_PeerColorSetBase dark_colors; + /// Channels can use this palette only after reaching at least the boost level specified in this field. [IfFlag(3)] public int channel_min_level; [Flags] public enum Flags : uint @@ -16716,40 +16807,51 @@ namespace TL public Help_PeerColorOption[] colors; } - /// See Derived classes: , , + /// How a certain peer reacted to or interacted with a story See Derived classes: , , public abstract class StoryReactionBase : IObject { } - /// See + /// How a certain peer reacted to a story See [TLDef(0x6090D6D5)] public class StoryReaction : StoryReactionBase { + /// The peer public Peer peer_id; + /// Reaction date public DateTime date; + /// The reaction public Reaction reaction; } - /// See + /// A certain peer has forwarded the story as a message to a public chat or channel. See [TLDef(0xBBAB2643)] public class StoryReactionPublicForward : StoryReactionBase { + /// The message with the forwarded story. public MessageBase message; } - /// See + /// A certain peer has reposted the story. See [TLDef(0xCFCD0F13)] public class StoryReactionPublicRepost : StoryReactionBase { + /// The peer that reposted the story. public Peer peer_id; + /// The reposted story. public StoryItemBase story; } - /// See + /// List of peers that reacted to or intercated with a specific story See [TLDef(0xAA5F789C)] public class Stories_StoryReactionsList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of reactions matching query public int count; + /// List of peers that reacted to or interacted with a specific story public StoryReactionBase[] reactions; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; + /// If set, indicates the next offset to use to load more results by invoking Stories_GetStoryReactionsList. [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint @@ -16836,4 +16938,11 @@ namespace TL public SavedReactionTag[] tags; public long hash; } + + /// See + [TLDef(0x3BB842AC)] + public class OutboxReadDate : IObject + { + public DateTime date; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 972078c..97933cb 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -990,7 +990,7 @@ namespace TL { }); - /// Get all available chat themes See + /// Get all available chat themes ». See /// Hash for pagination, for more info click here /// a null value means account.themesNotModified public static Task Account_GetChatThemes(this Client client, long hash = default) @@ -1175,7 +1175,7 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Get a list of default suggested channel emoji statuses. See [bots: ✓] /// Hash for pagination, for more info click here /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) @@ -1184,7 +1184,7 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See [bots: ✓] /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) @@ -1219,6 +1219,13 @@ namespace TL errors = errors, }); + /// See + public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id) + => client.Invoke(new Users_GetIsPremiumRequiredToContact + { + id = id, + }); + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash for pagination, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -1348,7 +1355,7 @@ namespace TL peer = peer, }); - /// Delete saved contacts See + /// Removes all contacts without an associated Telegram account. See public static Task Contacts_ResetSaved(this Client client) => client.Invoke(new Contacts_ResetSaved { @@ -3299,8 +3306,8 @@ namespace TL /// Get message reaction list, along with the sender of each reaction. See Possible codes: 400,403 (details) /// Peer /// Message ID - /// Get only reactions of this type (UTF8 emoji) - /// Offset (typically taken from the next_offset field of the returned ) + /// Get only reactions of this type + /// Offset for pagination (taken from the next_offset field of the returned ); empty in the first request. /// Maximum number of results to return, see pagination public static Task Messages_GetMessageReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null) => client.Invoke(new Messages_GetMessageReactionsList @@ -3627,10 +3634,11 @@ namespace TL { }); - /// Send a chosen peer, as requested by a button. See [bots: ✓] + /// Send one or more chosen peers, as requested by a button. See [bots: ✓] /// The bot that sent the button. /// ID of the message that contained the reply keyboard with the button. /// The button_id field from the . + /// The chosen peers. public static Task Messages_SendBotRequestedPeer(this Client client, InputPeer peer, int msg_id, int button_id, params InputPeer[] requested_peers) => client.Invoke(new Messages_SendBotRequestedPeer { @@ -3839,6 +3847,14 @@ namespace TL hash = hash, }); + /// See + public static Task Messages_GetOutboxReadDate(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_GetOutboxReadDate + { + peer = peer, + msg_id = msg_id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4851,6 +4867,7 @@ namespace TL }); /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) + /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// Channel whose accent color should be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info). /// Custom emoji ID used in the accent color pattern. @@ -4881,7 +4898,9 @@ namespace TL channel = channel, }); - /// See [bots: ✓] + /// Set an emoji status for a channel. See [bots: ✓] + /// The channel, must have at least channel_emoji_status_level_min boosts. + /// Emoji status to set public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) => client.Invoke(new Channels_UpdateEmojiStatus { @@ -5782,6 +5801,7 @@ namespace TL /// Obtains a list of messages, indicating to which other public channels was a channel message forwarded.
Will return a list of messages with peer_id equal to the public channel to which this message was forwarded. See Possible codes: 400 (details)
/// Source channel /// Source message ID + /// Offset for pagination, empty string on first call, then use the next_offset field of the returned constructor (if present, otherwise no more results are available). /// Maximum number of results to return, see pagination public static Task Stats_GetMessagePublicForwards(this Client client, InputChannelBase channel, int msg_id, string offset, int limit = int.MaxValue) => client.Invoke(new Stats_GetMessagePublicForwards @@ -6093,7 +6113,8 @@ namespace TL /// Obtain the list of users that have viewed a specific story we posted See Possible codes: 400 (details) /// Whether to only fetch view reaction/views made by our contacts - /// Whether to return info about users that reacted to the story (i.e. if set, the server will first sort results by view date as usual, and then also additionally sort the list by putting s with an associated reaction first in the list). + /// Whether to return info about users that reacted to the story (i.e. if set, the server will first sort results by view date as usual, and then also additionally sort the list by putting s with an associated reaction first in the list). Ignored if forwards_first is set. + /// If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date. /// Peer where the story was posted /// Search for specific peers /// Story ID @@ -6205,7 +6226,12 @@ namespace TL hidden = hidden, }); - /// See [bots: ✓] + /// Get the reaction and interaction list of a story posted to a channel, along with the sender of each reaction. See [bots: ✓] + /// If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date. + /// Channel + /// Story ID + /// Get only reactions of this type + /// Offset for pagination (taken from the next_offset field of the returned ); empty in the first request. /// Maximum number of results to return, see pagination public static Task Stories_GetStoryReactionsList(this Client client, InputPeer peer, int id, int limit = int.MaxValue, Reaction reaction = null, string offset = null, bool forwards_first = false) => client.Invoke(new Stories_GetStoryReactionsList @@ -7201,6 +7227,12 @@ namespace TL.Methods public SecureValueErrorBase[] errors; } + [TLDef(0xA622AA10)] + public class Users_GetIsPremiumRequiredToContact : IMethod + { + public InputUserBase[] id; + } + [TLDef(0x7ADC669D)] public class Contacts_GetContactIDs : IMethod { @@ -9455,6 +9487,13 @@ namespace TL.Methods public long hash; } + [TLDef(0x8C4BFE5D)] + public class Messages_GetOutboxReadDate : IMethod + { + public InputPeer peer; + public int msg_id; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d776f61..d807a6a 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 = 171; // fetched 16/01/2024 17:09:52 + public const int Version = 172; // fetched 18/01/2024 14:49:18 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -127,9 +127,9 @@ namespace TL [0x09D05049] = null,//UserStatusEmpty [0xEDB93949] = typeof(UserStatusOnline), [0x008C703F] = typeof(UserStatusOffline), - [0xE26F42F1] = typeof(UserStatusRecently), - [0x07BF09FC] = typeof(UserStatusLastWeek), - [0x77EBC742] = typeof(UserStatusLastMonth), + [0x7B197DC8] = typeof(UserStatusRecently), + [0x541A1D1A] = typeof(UserStatusLastWeek), + [0x65899777] = typeof(UserStatusLastMonth), [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), @@ -1188,6 +1188,7 @@ namespace TL [0xCB6FF828] = typeof(SavedReactionTag), [0x889B59EF] = null,//Messages_SavedReactionTagsNotModified [0x3259950A] = typeof(Messages_SavedReactionTags), + [0x3BB842AC] = typeof(OutboxReadDate), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index a4f45ff..3f5365f 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 171 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - Copyright © Olivier Marcoux 2021-2023 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 172 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient logo.png From 0ad7d696a5a87a85668ff62bedd2e80d7093cb92 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:24:49 +0100 Subject: [PATCH 158/336] DownloadFileAsync: don't use stream.Position if !CanSeek --- .github/dev.yml | 2 +- FAQ.md | 2 +- src/Client.Helpers.cs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 924fdae..eb3a62f 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.5-dev.$(Rev:r) +name: 3.6.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 2a56bdd..84d0df4 100644 --- a/FAQ.md +++ b/FAQ.md @@ -235,7 +235,7 @@ In particular, it will detect and handle automatically and properly the various * 2FA password required (your Config needs to provide "password") * Email registration procedure required (your Config needs to provide "email", "email_verification_code") * Account registration/sign-up required (your Config needs to provide "first_name", "last_name") -* Request to resend the verification code through alternate ways like SMS (if your Config answer an empty "verification_code" initially) +* Request to resend the verification code through alternate ways (if your Config answer an empty "verification_code" initially) * Transient failures, slowness to respond, wrong code/password, checks for encryption key safety, etc.. Contrary to TLSharp, WTelegramClient supports MTProto v2.0 (more secured), transport obfuscation, protocol security checks, MTProto [Proxy](EXAMPLES.md#proxy), real-time updates, multiple DC connections, API documentation in Intellisense... diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 4bed1ae..c0ac2f1 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -317,7 +317,7 @@ namespace WTelegram var client = dc_id == 0 ? this : await GetClientForDC(dc_id, true); using var writeSem = new SemaphoreSlim(1); bool canSeek = outputStream.CanSeek; - long streamStartPos = outputStream.Position; + long streamStartPos = canSeek ? outputStream.Position : 0; long fileOffset = 0, maxOffsetSeen = 0; long transmitted = 0; var tasks = new Dictionary(); @@ -373,7 +373,7 @@ namespace WTelegram await writeSem.WaitAsync(); try { - if (streamStartPos + offset != outputStream.Position) // if we're about to write out of order + if (canSeek && streamStartPos + offset != outputStream.Position) // if we're about to write out of order { await outputStream.FlushAsync(); // async flush, otherwise Seek would do a sync flush outputStream.Seek(streamStartPos + offset, SeekOrigin.Begin); From a424219cb674e7398d1c44cec0568784fa50507e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 1 Feb 2024 21:29:24 +0100 Subject: [PATCH 159/336] API Layer 173: no_joined_notifications, SavedReactionTags in peers --- README.md | 2 +- src/TL.Schema.cs | 48 +++++++++++++++----- src/TL.SchemaFuncs.cs | 91 ++++++++++++++++++++++++++------------ src/TL.Table.cs | 2 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 103 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 16ed2af..f987c28 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-172-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-173-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e6c7549..4705bc2 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1672,6 +1672,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Peer ID, the chat where this message was sent public Peer peer_id; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
[IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; @@ -1910,8 +1911,11 @@ namespace TL spoiler = 0x10, /// Field has a value has_alt_document = 0x20, + /// Whether this is a video. video = 0x40, + /// Whether this is a round video. round = 0x80, + /// Whether this is a voice message. voice = 0x100, } } @@ -3269,7 +3273,7 @@ namespace TL stories_pinned_available = 0x4000000, /// Whether we've blocked this user, preventing them from seeing our stories ». blocked_my_stories_from = 0x8000000, - /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. + /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, contact_require_premium = 0x20000000, read_dates_private = 0x40000000, @@ -5094,25 +5098,28 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// A saved message dialog was pinned/unpinned See [TLDef(0xAEAF9E74)] public class UpdateSavedDialogPinned : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The dialog public DialogPeerBase peer; [Flags] public enum Flags : uint { + /// Whether the dialog was pinned pinned = 0x1, } } - /// See + /// Pinned saved dialogs » were updated See [TLDef(0x686C85A6)] public class UpdatePinnedSavedDialogs : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// New order of pinned saved dialogs [IfFlag(0)] public DialogPeerBase[] order; [Flags] public enum Flags : uint @@ -8600,12 +8607,15 @@ namespace TL [IfFlag(2)] public int channel_post; /// For channels and if signatures are enabled, author of the channel message [IfFlag(3)] public string post_author; - /// Only for messages forwarded to the current user (inputPeerSelf), full info about the user/channel that originally sent the message + /// Only for messages forwarded to saved messages », contains the dialog where the message was originally sent. [IfFlag(4)] public Peer saved_from_peer; - /// Only for messages forwarded to the current user (inputPeerSelf), ID of the message that was forwarded from the original user/channel + /// Only for messages forwarded to saved messages », contains the original ID of the message in saved_from_peer. [IfFlag(4)] public int saved_from_msg_id; + /// Only for forwarded messages reforwarded to saved messages », contains the sender of the original message (i.e. if user A sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the ID of user A and from_id will contain the ID of user B). [IfFlag(8)] public Peer saved_from_id; + /// Only for forwarded messages from users with forward privacy enabled reforwarded to saved messages », contains the sender of the original message (i.e. if user A (fwd privacy enabled) sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the name of user A and from_id will contain the ID of user B). [IfFlag(9)] public string saved_from_name; + /// Only for forwarded messages reforwarded to saved messages », indicates when was the original message sent (i.e. if user A sends a message @ unixtime 1, then user B forwards it somewhere @ unixtime 2, then user C saves it to saved messages @ unixtime 3, this field will contain 1, date will contain 2 and the date of the containing will contain 3). [IfFlag(10)] public DateTime saved_date; /// PSA type [IfFlag(6)] public string psa_type; @@ -8632,6 +8642,7 @@ namespace TL has_saved_from_name = 0x200, /// Field has a value has_saved_date = 0x400, + /// Only for messages forwarded to saved messages », set if the original message was outgoing (though the message may have been originally outgoing even if this flag is not set, if from_id points to the current user). saved_out = 0x800, } } @@ -16863,55 +16874,72 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a saved dialog ». See [TLDef(0xBD87CB6C)] public class SavedDialog : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The dialog public Peer peer; + /// The latest message ID public int top_message; [Flags] public enum Flags : uint { + /// Is the dialog pinned pinned = 0x4, } } - /// See Derived classes: , , + /// Represents some saved message dialogs ». See Derived classes: , , public abstract class Messages_SavedDialogsBase : IObject { + /// Saved message dialogs ». public virtual SavedDialog[] Dialogs { get; } + /// List of last messages from each saved dialog public virtual MessageBase[] Messages { get; } + /// Mentioned chats public virtual Dictionary Chats { get; } + /// Mentioned users public virtual Dictionary Users { get; } } - /// See + /// Represents some saved message dialogs ». See [TLDef(0xF83AE221)] public class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver { + /// Saved message dialogs ». public SavedDialog[] dialogs; + /// List of last messages from each saved dialog public MessageBase[] messages; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; + /// Saved message dialogs ». public override SavedDialog[] Dialogs => dialogs; + /// List of last messages from each saved dialog public override MessageBase[] Messages => messages; + /// Mentioned chats public override Dictionary Chats => chats; + /// Mentioned users public override Dictionary Users => users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Incomplete list of saved message dialogs » with messages and auxiliary data. See [TLDef(0x44BA9DD9)] public class Messages_SavedDialogsSlice : Messages_SavedDialogs { + /// Total number of saved message dialogs public int count; } - /// See + /// The saved dialogs haven't changed See [TLDef(0xC01F6FE8)] public class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase { + /// Number of saved dialogs found server-side by the query public int count; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 97933cb..9dd8160 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -113,9 +113,10 @@ namespace TL /// New user first name /// New user last name [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] - public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name) + public static Task Auth_SignUp(this Client client, string phone_number, string phone_code_hash, string first_name, string last_name, bool no_joined_notifications = false) => client.Invoke(new Auth_SignUp { + flags = (Auth_SignUp.Flags)(no_joined_notifications ? 0x1 : 0), phone_number = phone_number, phone_code_hash = phone_code_hash, first_name = first_name, @@ -263,7 +264,7 @@ namespace TL except_ids = except_ids, }); - /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400,500 (details) + /// Login using a redirected login token, generated in case of DC mismatch during QR code login. See Possible codes: 400 (details) /// Login token public static Task Auth_ImportLoginToken(this Client client, byte[] token) => client.Invoke(new Auth_ImportLoginToken @@ -1175,7 +1176,7 @@ namespace TL hash = hash, }); - /// Get a list of default suggested channel emoji statuses. See [bots: ✓] + /// Get a list of default suggested channel emoji statuses. See /// Hash for pagination, for more info click here /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) @@ -1184,7 +1185,7 @@ namespace TL hash = hash, }); - /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See [bots: ✓] + /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See /// Hash for pagination, for more info click here /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) @@ -1411,7 +1412,7 @@ namespace TL self_expires = self_expires.GetValueOrDefault(), }); - /// Stop getting notifications about discussion replies of a certain user in @replies See + /// Stop getting notifications about discussion replies of a certain user in @replies See Possible codes: 400 (details) /// Whether to delete the specified message as well /// Whether to delete all @replies messages from this user as well /// Whether to also report this user for spam @@ -1519,6 +1520,7 @@ namespace TL /// User or chat, histories with which are searched, or to search in all private chats and normal groups (not channels) ». Use Messages_SearchGlobal to search globally in all chats, groups, supergroups and channels. /// Text search request /// Only return messages sent by the specified user ID + /// Search within the saved message dialog » with this ID. /// Thread ID /// Filter to return only specified message types /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned @@ -2785,6 +2787,7 @@ namespace TL /// Get the number of results that would be found by a Messages_Search call with the same parameters See Possible codes: 400 (details) /// Peer where to search + /// Search within the saved message dialog » with this ID. /// If set, consider only messages within the specified forum topic /// Search filters public static Task Messages_GetSearchCounters(this Client client, InputPeer peer, MessagesFilter[] filters, int? top_msg_id = null, InputPeer saved_peer_id = null) @@ -2868,7 +2871,7 @@ namespace TL id = id, }); - /// Delete scheduled messages See + /// Delete scheduled messages See Possible codes: 400 (details) /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, params int[] id) @@ -3204,6 +3207,7 @@ namespace TL /// Returns information about the next messages of the specified type in the chat split by days. See Possible codes: 400 (details) /// Peer where to search + /// Search within the saved message dialog » with this ID. /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -3220,6 +3224,7 @@ namespace TL /// Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. See /// Peer where to search + /// Search within the saved message dialog » with this ID. /// Message filter, , filters are not supported by this method. /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3634,7 +3639,7 @@ namespace TL { }); - /// Send one or more chosen peers, as requested by a button. See [bots: ✓] + /// Send one or more chosen peers, as requested by a button. See /// The bot that sent the button. /// ID of the message that contained the reply keyboard with the button. /// The button_id field from the . @@ -3706,7 +3711,7 @@ namespace TL hash = hash, }); - /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See + /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) /// Set this flag if the bot is asking permission to send messages to the user as specified in the named Mini App deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. /// The app obtained by invoking Messages_GetBotApp as specified in the named Mini App deep link docs. @@ -3754,10 +3759,12 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Returns the current saved dialog list, see here » for more info. See + /// Exclude pinned dialogs /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination + /// Offsets for pagination, for more info click here (top_message ID used for pagination) + /// Offset peer for pagination + /// Number of list elements to be returned /// Hash for pagination, for more info click here public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs @@ -3770,12 +3777,15 @@ namespace TL hash = hash, }); - /// See [bots: ✓] - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Offsets for pagination, for more info click here - /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Returns saved messages » forwarded from a specific peer See Possible codes: 400 (details) + /// Target peer + /// Only return messages starting from the specified message ID + /// Only return messages sent before the specified date + /// Number of list elements to be skipped, negative values are also accepted. + /// Number of results to return + /// If a positive value was transferred, the method will return only messages with IDs less than max_id + /// If a positive value was transferred, the method will return only messages with IDs more than min_id + /// Result hash public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetSavedHistory { @@ -3789,7 +3799,11 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) + /// Peer, whose messages will be deleted from saved messages » + /// Maximum ID of message to delete + /// Delete all messages newer than this UNIX timestamp + /// Delete all messages older than this UNIX timestamp public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) => client.Invoke(new Messages_DeleteSavedHistory { @@ -3800,13 +3814,15 @@ namespace TL max_date = max_date.GetValueOrDefault(), }); - /// See [bots: ✓] + /// Get pinned saved dialogs, see here » for more info. See public static Task Messages_GetPinnedSavedDialogs(this Client client) => client.Invoke(new Messages_GetPinnedSavedDialogs { }); - /// See [bots: ✓] + /// Pin or unpin a saved message dialog ». See Possible codes: 400 (details) + /// Whether to pin or unpin the dialog + /// The dialog to pin public static Task Messages_ToggleSavedDialogPin(this Client client, InputDialogPeerBase peer, bool pinned = false) => client.Invoke(new Messages_ToggleSavedDialogPin { @@ -3814,7 +3830,9 @@ namespace TL peer = peer, }); - /// See [bots: ✓] + /// Reorder pinned saved message dialogs ». See + /// If set, dialogs pinned server-side but not present in the order field will be unpinned. + /// New dialog order public static Task Messages_ReorderPinnedSavedDialogs(this Client client, InputDialogPeerBase[] order, bool force = false) => client.Invoke(new Messages_ReorderPinnedSavedDialogs { @@ -3824,9 +3842,11 @@ namespace TL /// See /// a null value means messages.savedReactionTagsNotModified - public static Task Messages_GetSavedReactionTags(this Client client, long hash = default) + public static Task Messages_GetSavedReactionTags(this Client client, long hash = default, InputPeer peer = null) => client.Invoke(new Messages_GetSavedReactionTags { + flags = (Messages_GetSavedReactionTags.Flags)(peer != null ? 0x1 : 0), + peer = peer, hash = hash, }); @@ -4869,7 +4889,7 @@ namespace TL /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// Channel whose accent color should be changed. - /// ID of the accent color palette » to use (not RGB24, see here » for more info). + /// ID of the accent color palette » to use (not RGB24, see here » for more info); if not set, the default palette is used. /// Custom emoji ID used in the accent color pattern. public static Task Channels_UpdateColor(this Client client, InputChannelBase channel, long? background_emoji_id = null, int? color = null, bool for_profile = false) => client.Invoke(new Channels_UpdateColor @@ -4898,7 +4918,7 @@ namespace TL channel = channel, }); - /// Set an emoji status for a channel. See [bots: ✓] + /// Set an emoji status for a channel. See Possible codes: 400 (details) /// The channel, must have at least channel_emoji_status_level_min boosts. /// Emoji status to set public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) @@ -5201,7 +5221,7 @@ namespace TL slug = slug, }); - /// Apply a Telegram Premium giftcode » See Possible codes: 406 (details) + /// Apply a Telegram Premium giftcode » See Possible codes: 400,420 (details) /// The code to apply public static Task Payments_ApplyGiftCode(this Client client, string slug) => client.Invoke(new Payments_ApplyGiftCode @@ -5474,7 +5494,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), }); - /// Join a group call See Possible codes: 400,403,500 (details) + /// Join a group call See Possible codes: 400,403 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call @@ -6226,7 +6246,7 @@ namespace TL hidden = hidden, }); - /// Get the reaction and interaction list of a story posted to a channel, along with the sender of each reaction. See [bots: ✓] + /// Get the reaction and interaction list of a story posted to a channel, along with the sender of each reaction. See Possible codes: 400 (details) /// If set, returns forwards and reposts first, then reactions, then other views; otherwise returns interactions sorted just by interaction date. /// Channel /// Story ID @@ -6370,13 +6390,19 @@ namespace TL.Methods public CodeSettings settings; } - [TLDef(0x80EEE427)] + [TLDef(0xAAC7B717)] public class Auth_SignUp : IMethod { + public Flags flags; public string phone_number; public string phone_code_hash; public string first_name; public string last_name; + + [Flags] public enum Flags : uint + { + no_joined_notifications = 0x1, + } } [TLDef(0x8D52A951)] @@ -9462,10 +9488,17 @@ namespace TL.Methods } } - [TLDef(0x761DDACF)] + [TLDef(0x3637E05B)] public class Messages_GetSavedReactionTags : IMethod { + public Flags flags; + [IfFlag(0)] public InputPeer peer; public long hash; + + [Flags] public enum Flags : uint + { + has_peer = 0x1, + } } [TLDef(0x60297DEC)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index d807a6a..29cd3e4 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 = 172; // fetched 18/01/2024 14:49:18 + public const int Version = 173; // fetched 01/02/2024 20:25:01 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3f5365f..22c7c65 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: 172 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 173 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient From 288bf7ccf71bf4f1cfbbc6d2239083496f956ff9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 18 Feb 2024 17:00:49 +0100 Subject: [PATCH 160/336] API Layer 174: Group boosts & emoji set --- .github/dev.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 71 ++++++++++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 56 +++++++++++++++++++++++------- src/TL.Table.cs | 16 +++++---- src/WTelegramClient.csproj | 4 +-- 6 files changed, 104 insertions(+), 47 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index eb3a62f..1884efe 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.6-dev.$(Rev:r) +name: 3.6.7-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index f987c28..453c103 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-173-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-174-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 4705bc2..045905a 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1322,7 +1322,7 @@ namespace TL public override ChatReactions AvailableReactions => available_reactions; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x0F2BCB6F)] + [TLDef(0x44C054A7)] public partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1403,6 +1403,9 @@ namespace TL [IfFlag(36)] public PeerStories stories; /// Wallpaper [IfFlag(39)] public WallPaperBase wallpaper; + [IfFlag(40)] public int boosts_applied; + [IfFlag(41)] public int boosts_unrestrict; + [IfFlag(42)] public StickerSet emojiset; [Flags] public enum Flags : uint { @@ -1488,6 +1491,12 @@ namespace TL view_forum_as_messages = 0x40, /// Field has a value has_wallpaper = 0x80, + /// Field has a value + has_boosts_applied = 0x100, + /// Field has a value + has_boosts_unrestrict = 0x200, + /// Field has a value + has_emojiset = 0x400, } /// ID of the channel @@ -1661,7 +1670,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x76BEC211)] + [TLDef(0x1E4C8A69)] public partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1670,6 +1679,7 @@ namespace TL public int id; /// ID of the sender of the message [IfFlag(8)] public Peer from_id; + [IfFlag(29)] public int from_boosts_applied; /// Peer ID, the chat where this message was sent public Peer peer_id; /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
@@ -1765,6 +1775,8 @@ namespace TL invert_media = 0x8000000, /// Field has a value has_saved_peer_id = 0x10000000, + /// Field has a value + has_from_boosts_applied = 0x20000000, } /// ID of the message @@ -2583,6 +2595,12 @@ namespace TL /// Number of undistributed prizes public int unclaimed_count; } + /// See + [TLDef(0xCC02AA6D)] + public class MessageActionBoostApply : MessageAction + { + public int boosts; + } /// Chat info. See Derived classes: , public abstract class DialogBase : IObject @@ -8611,11 +8629,11 @@ namespace TL [IfFlag(4)] public Peer saved_from_peer; /// Only for messages forwarded to saved messages », contains the original ID of the message in saved_from_peer. [IfFlag(4)] public int saved_from_msg_id; - /// Only for forwarded messages reforwarded to saved messages », contains the sender of the original message (i.e. if user A sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the ID of user A and from_id will contain the ID of user B). + /// Only for forwarded messages reforwarded to saved messages », contains the sender of the original message (i.e. if user A sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the ID of user B and from_id will contain the ID of user A). [IfFlag(8)] public Peer saved_from_id; - /// Only for forwarded messages from users with forward privacy enabled reforwarded to saved messages », contains the sender of the original message (i.e. if user A (fwd privacy enabled) sends a message, then user B forwards it somewhere, then user C saves it to saved messages, this field will contain the name of user A and from_id will contain the ID of user B). + /// Only for forwarded messages from users with forward privacy enabled, sent by users with forward privacy enabled, reforwarded to saved messages », contains the sender of the original message (i.e. if user A (fwd privacy enabled) sends a message, then user B (fwd privacy enabled) forwards it somewhere, then user C saves it to saved messages, this field will contain the name of user B and from_name will contain the name of user A). [IfFlag(9)] public string saved_from_name; - /// Only for forwarded messages reforwarded to saved messages », indicates when was the original message sent (i.e. if user A sends a message @ unixtime 1, then user B forwards it somewhere @ unixtime 2, then user C saves it to saved messages @ unixtime 3, this field will contain 1, date will contain 2 and the date of the containing will contain 3). + /// Only for forwarded messages reforwarded to saved messages », indicates when was the original message sent (i.e. if user A sends a message @ unixtime 1, then user B forwards it somewhere @ unixtime 2, then user C saves it to saved messages @ unixtime 3, this field will contain 2, date will contain 1 and the date of the containing will contain 3). [IfFlag(10)] public DateTime saved_date; /// PSA type [IfFlag(6)] public string psa_type; @@ -11067,6 +11085,9 @@ namespace TL /// New emoji status public EmojiStatus new_value; } + /// See + [TLDef(0x46D840AB)] + public class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -13608,11 +13629,10 @@ namespace TL } } /// Represents a reply to a story See - [TLDef(0x9C98BFC1)] + [TLDef(0x0E5AF939)] public class MessageReplyStoryHeader : MessageReplyHeaderBase { - /// ID of the user that posted a story - public long user_id; + public Peer peer; /// Story ID public int story_id; } @@ -15503,28 +15523,28 @@ namespace TL public JsonObject config; } - /// Used to fetch information about a named Mini App See Derived classes: , + /// Used to fetch information about a direct link Mini App See Derived classes: , public abstract class InputBotApp : IObject { } - /// Used to fetch information about a named Mini App by its ID See + /// Used to fetch information about a direct link Mini App by its ID See [TLDef(0xA920BD7A)] public class InputBotAppID : InputBotApp { - /// named Mini App ID. + /// direct link Mini App ID. public long id; /// REQUIRED FIELD. See how to obtain it
Access hash, obtained from the .
public long access_hash; } - /// Used to fetch information about a named Mini App by its short name See + /// Used to fetch information about a direct link Mini App by its short name See [TLDef(0x908C0407)] public class InputBotAppShortName : InputBotApp { /// ID of the bot that owns the bot mini app public InputUserBase bot_id; - /// Short name, obtained from a named Mini App deep link + /// Short name, obtained from a Direct Mini App deep link public string short_name; } - /// Contains information about a named Mini App. See + /// Contains information about a direct link Mini App. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] public class BotApp : IObject @@ -15535,7 +15555,7 @@ namespace TL public long id; /// bot mini app access hash public long access_hash; - /// bot mini app short name, used to generate named Mini App deep links. + /// bot mini app short name, used to generate Direct Mini App deep links. public string short_name; /// bot mini app title. public string title; @@ -15555,7 +15575,7 @@ namespace TL } } - /// Contains information about a named Mini App See + /// Contains information about a direct link Mini App See [TLDef(0xEB50ADF5)] public class Messages_BotApp : IObject { @@ -15575,9 +15595,9 @@ namespace TL } } - /// Contains the link that must be used to open a named Mini App. See Derived classes: + /// Contains the link that must be used to open a direct link Mini App. See Derived classes: public abstract class AppWebViewResult : IObject { } - /// Contains the link that must be used to open a named Mini App. See + /// Contains the link that must be used to open a direct link Mini App. See [TLDef(0x3C1B4F0D)] public class AppWebViewResultUrl : AppWebViewResult { @@ -15890,7 +15910,7 @@ namespace TL public override int ID => id; } /// Represents a story. See - [TLDef(0xAF6365A1)] + [TLDef(0x79B26A24)] public class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15899,6 +15919,7 @@ namespace TL public int id; /// When was the story posted. public DateTime date; + [IfFlag(18)] public Peer from_id; /// For reposted stories », contains info about the original story. [IfFlag(17)] public StoryFwdHeader fwd_from; /// When does the story expire. @@ -15952,6 +15973,8 @@ namespace TL out_ = 0x10000, /// Field has a value has_fwd_from = 0x20000, + /// Field has a value + has_from_id = 0x40000, } /// ID of the story. @@ -16159,11 +16182,10 @@ namespace TL } } /// Reply to a story. See - [TLDef(0x15B0F283)] + [TLDef(0x5881323A)] public class InputReplyToStory : InputReplyTo { - /// ID of the user that posted the story. - public InputUserBase user_id; + public InputPeer peer; /// ID of the story to reply to. public int story_id; } @@ -16780,7 +16802,7 @@ namespace TL } /// Contains info about a color palette ». See - [TLDef(0xEF8430AB)] + [TLDef(0xADEC6EBE)] public class Help_PeerColorOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -16793,6 +16815,7 @@ namespace TL [IfFlag(2)] public Help_PeerColorSetBase dark_colors; /// Channels can use this palette only after reaching at least the boost level specified in this field. [IfFlag(3)] public int channel_min_level; + [IfFlag(4)] public int group_min_level; [Flags] public enum Flags : uint { @@ -16804,6 +16827,8 @@ namespace TL has_dark_colors = 0x4, /// Field has a value has_channel_min_level = 0x8, + /// Field has a value + has_group_min_level = 0x10, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9dd8160..dbbc531 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -642,7 +642,7 @@ namespace TL public_key = public_key, }); - /// Sends a Telegram Passport authorization form, effectively sharing data with the service See + /// Sends a Telegram Passport authorization form, effectively sharing data with the service See Possible codes: 400 (details) /// Bot ID /// Telegram Passport element types requested by the service /// Service's public key @@ -1235,7 +1235,7 @@ namespace TL hash = hash, }); - /// Use this method to obtain the online statuses of all contacts with an accessible associated Telegram account. See + /// Use this method to obtain the online statuses of all contacts with an accessible Telegram account. See public static Task Contacts_GetStatuses(this Client client) => client.Invoke(new Contacts_GetStatuses { @@ -3625,7 +3625,7 @@ namespace TL id = id, }); - /// Changes the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] + /// Changes the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] Possible codes: 400 (details) /// The new default Time-To-Live of all messages sent in new chats. public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL @@ -3701,8 +3701,8 @@ namespace TL peer = peer, }); - /// Obtain information about a named Mini App See Possible codes: 400 (details) - /// Bot app information obtained from a named Mini App deep link ». + /// Obtain information about a direct link Mini App See Possible codes: 400 (details) + /// Bot app information obtained from a Direct Mini App deep link ». /// Hash for pagination, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp @@ -3711,11 +3711,11 @@ namespace TL hash = hash, }); - /// Open a bot mini app from a named Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) - /// Set this flag if the bot is asking permission to send messages to the user as specified in the named Mini App deep link docs, and the user agreed. + /// Open a bot mini app from a direct Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) + /// Set this flag if the bot is asking permission to send messages to the user as specified in the direct Mini App deep link docs, and the user agreed. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. - /// The app obtained by invoking Messages_GetBotApp as specified in the named Mini App deep link docs. - /// If the startapp query string parameter is present in the named Mini App deep link, pass it to start_param. + /// The app obtained by invoking Messages_GetBotApp as specified in the direct Mini App deep link docs. + /// If the startapp query string parameter is present in the direct Mini App deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) @@ -4812,7 +4812,7 @@ namespace TL hidden = hidden.GetValueOrDefault(), }); - /// Pin or unpin forum topics See [bots: ✓] + /// Pin or unpin forum topics See [bots: ✓] Possible codes: 400 (details) /// Supergroup ID /// Forum topic ID /// Whether to pin or unpin the topic @@ -4928,6 +4928,22 @@ namespace TL emoji_status = emoji_status, }); + /// See + public static Task Channels_SetBoostsToUnblockRestrictions(this Client client, InputChannelBase channel, int boosts) + => client.Invoke(new Channels_SetBoostsToUnblockRestrictions + { + channel = channel, + boosts = boosts, + }); + + /// See + public static Task Channels_SetEmojiStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) + => client.Invoke(new Channels_SetEmojiStickers + { + channel = channel, + stickerset = stickerset, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5941,7 +5957,7 @@ namespace TL chatlist = chatlist, }); - /// Join channels and supergroups recently added to a chat folder deep link ». See [bots: ✓] + /// Join channels and supergroups recently added to a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) /// The folder /// List of new chats to join, fetched using Chatlists_GetChatlistUpdates and filtered as specified in the documentation ». public static Task Chatlists_JoinChatlistUpdates(this Client client, InputChatlist chatlist, params InputPeer[] peers) @@ -5951,7 +5967,7 @@ namespace TL peers = peers, }); - /// Dismiss new pending peers recently added to a chat folder deep link ». See [bots: ✓] + /// Dismiss new pending peers recently added to a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) /// The folder public static Task Chatlists_HideChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_HideChatlistUpdates @@ -5959,7 +5975,7 @@ namespace TL chatlist = chatlist, }); - /// Returns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted. See [bots: ✓] + /// Returns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted. See [bots: ✓] Possible codes: 400 (details) /// Folder ID public static Task Chatlists_GetLeaveChatlistSuggestions(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetLeaveChatlistSuggestions @@ -10332,6 +10348,20 @@ namespace TL.Methods public EmojiStatus emoji_status; } + [TLDef(0xAD399CEE)] + public class Channels_SetBoostsToUnblockRestrictions : IMethod + { + public InputChannelBase channel; + public int boosts; + } + + [TLDef(0x3CD930B7)] + public class Channels_SetEmojiStickers : IMethod + { + public InputChannelBase channel; + public InputStickerSet stickerset; + } + [TLDef(0xAA2769ED)] public class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 29cd3e4..6f7bf7b 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 = 173; // fetched 01/02/2024 20:25:01 + public const int Version = 174; // fetched 18/02/2024 15:53:49 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -136,7 +136,7 @@ namespace TL [0x0AADFC8F] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0xC9D31138] = typeof(ChatFull), - [0x0F2BCB6F] = typeof(ChannelFull), + [0x44C054A7] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -145,7 +145,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x76BEC211] = typeof(Message), + [0x1E4C8A69] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -204,6 +204,7 @@ namespace TL [0x678C2E09] = typeof(MessageActionGiftCode), [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), [0x2A9FADC5] = typeof(MessageActionGiveawayResults), + [0xCC02AA6D] = typeof(MessageActionBoostApply), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -805,6 +806,7 @@ namespace TL [0x5E477B25] = typeof(ChannelAdminLogEventActionChangeProfilePeerColor), [0x31BB5D52] = typeof(ChannelAdminLogEventActionChangeWallpaper), [0x3EA9FEB1] = typeof(ChannelAdminLogEventActionChangeEmojiStatus), + [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -972,7 +974,7 @@ namespace TL [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), [0xAFBC09DB] = typeof(MessageReplyHeader), - [0x9C98BFC1] = typeof(MessageReplyStoryHeader), + [0x0E5AF939] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), @@ -1131,7 +1133,7 @@ namespace TL [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), - [0xAF6365A1] = typeof(StoryItem), + [0x79B26A24] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), [0x5DD8C3C8] = typeof(Stories_Stories), @@ -1141,7 +1143,7 @@ namespace TL [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), [0x22C0F6D5] = typeof(InputReplyToMessage), - [0x15B0F283] = typeof(InputReplyToStory), + [0x5881323A] = typeof(InputReplyToStory), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), [0x03D1EA4E] = typeof(MediaAreaCoordinates), @@ -1174,7 +1176,7 @@ namespace TL [0xB54B5ACF] = typeof(PeerColor), [0x26219A58] = typeof(Help_PeerColorSet), [0x767D61EB] = typeof(Help_PeerColorProfileSet), - [0xEF8430AB] = typeof(Help_PeerColorOption), + [0xADEC6EBE] = typeof(Help_PeerColorOption), [0x2BA1F5CE] = null,//Help_PeerColorsNotModified [0x00F8ED08] = typeof(Help_PeerColors), [0x6090D6D5] = typeof(StoryReaction), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 22c7c65..bead803 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: 173 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 174 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient @@ -21,7 +21,7 @@ true https://github.com/wiz0u/WTelegramClient.git git - Telegram;MTProto;Client;Api;UserBot;TLSharp + Telegram;MTProto;Client;Api;UserBot README.md $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 From 125c1caeeb7ae42bcdfc642fa7de5cc8ddc0f170 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 18 Feb 2024 17:41:30 +0100 Subject: [PATCH 161/336] Alternate simpler byte[] callback session store --- src/Client.cs | 3 +++ src/Session.cs | 7 +++++++ 2 files changed, 10 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index af22c38..922925e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -94,6 +94,9 @@ namespace WTelegram }) { } + public Client(Func configProvider, byte[] startSession, Action saveSession) + : this(configProvider, new ActionStore(startSession, saveSession)) { } + /// Welcome to WTelegramClient! 🙂 /// Config callback, is queried for: api_id, api_hash, session_pathname /// if specified, must support initial Length & Read() of a session, then calls to Write() the updated session. Other calls can be ignored diff --git a/src/Session.cs b/src/Session.cs index b76ecbc..54c354c 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -192,4 +192,11 @@ namespace WTelegram base.Write(_header, 0, 8); } } + + // QWxp couldn't be bothered to write such a simple SessionStore, so here it is: + internal class ActionStore(byte[] startSession, Action saveSession) : MemoryStream(startSession ?? Array.Empty()) + { + public override void Write(byte[] buffer, int offset, int count) => saveSession(buffer[offset..(offset + count)]); + public override void SetLength(long value) { } + } } \ No newline at end of file From 0312821068200e7265b5e467b114c443f195842f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 18 Feb 2024 18:02:51 +0100 Subject: [PATCH 162/336] Alternate simpler byte[] callback session store --- src/Session.cs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Session.cs b/src/Session.cs index 54c354c..caaee08 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -7,9 +7,7 @@ using System.Net; using System.Security.Cryptography; using System.Text.Json; -//( Fuck you Andrei, you don't know what you're doing! You're lowering the security, contrary to Telegram recommended practices. -//( Read the official API documentation. And if you want to mess around, at least don't publish a lame copy of my lib on nuget. -//( Also you're apparently a noob in C#, so don't judge my experienced code where every line is carefully written on purpose. +//( Don't change this code to lower the security. That's contrary to Telegram recommended practices. Read the official API documentation. namespace WTelegram { @@ -194,9 +192,11 @@ namespace WTelegram } // QWxp couldn't be bothered to write such a simple SessionStore, so here it is: - internal class ActionStore(byte[] startSession, Action saveSession) : MemoryStream(startSession ?? Array.Empty()) + internal class ActionStore : MemoryStream { - public override void Write(byte[] buffer, int offset, int count) => saveSession(buffer[offset..(offset + count)]); + private readonly Action _save; + public ActionStore(byte[] initial, Action save) : base(initial ?? Array.Empty()) => _save = save; + public override void Write(byte[] buffer, int offset, int count) => _save(buffer[offset..(offset + count)]); public override void SetLength(long value) { } } } \ No newline at end of file From 6a1114ccd5903f0a64d2b60545664de599af40d8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 18 Feb 2024 22:50:42 +0100 Subject: [PATCH 163/336] ConnectAsync can be used for quickResume of sessions (experimental) --- src/Client.cs | 61 ++++++++++++++++++++++++++++---------------------- src/Session.cs | 1 + 2 files changed, 35 insertions(+), 27 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 922925e..f408fea 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -773,16 +773,17 @@ namespace WTelegram } /// Establish connection to Telegram servers without negociating a user session + /// Attempt to resume session immediately without issuing Layer/InitConnection/GetConfig (not recommended by default) /// Usually you shouldn't need to call this method: Use LoginUserIfNeeded instead.
Config callback is queried for: server_address
/// Most methods of this class are async (Task), so please use - public async Task ConnectAsync() + public async Task ConnectAsync(bool quickResume = false) { lock (this) - _connecting ??= DoConnectAsync(); + _connecting ??= DoConnectAsync(quickResume); await _connecting; } - private async Task DoConnectAsync() + private async Task DoConnectAsync(bool quickResume) { _cts = new(); IPEndPoint endpoint = null; @@ -893,32 +894,38 @@ namespace WTelegram await CreateAuthorizationKey(this, _dcSession); var keepAliveTask = KeepAlive(_cts.Token); - var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonSerializer.Deserialize(Config("init_params"))); - TLConfig = await this.InvokeWithLayer(Layer.Version, - new TL.Methods.InitConnection - { - flags = TL.Methods.InitConnection.Flags.has_params, - api_id = _session.ApiId, - device_model = Config("device_model"), - system_version = Config("system_version"), - app_version = Config("app_version"), - system_lang_code = Config("system_lang_code"), - lang_pack = Config("lang_pack"), - lang_code = Config("lang_code"), - params_ = initParams, - query = new TL.Methods.Help_GetConfig() - }); - _session.DcOptions = TLConfig.dc_options; - if (_dcSession.DataCenter == null) + if (quickResume && _dcSession.Layer == Layer.Version && _dcSession.DataCenter != null && _session.MainDC != 0) + TLConfig = new Config { this_dc = _session.MainDC, dc_options = _session.DcOptions }; + else { - _dcSession.DataCenter = _session.DcOptions.Where(dc => dc.id == TLConfig.this_dc) - .OrderByDescending(dc => dc.ip_address == endpoint?.Address.ToString()) - .ThenByDescending(dc => dc.port == endpoint?.Port) - .ThenByDescending(dc => dc.flags == (endpoint?.AddressFamily == AddressFamily.InterNetworkV6 ? DcOption.Flags.ipv6 : 0)) - .First(); - _session.DCSessions[TLConfig.this_dc] = _dcSession; + var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonSerializer.Deserialize(Config("init_params"))); + TLConfig = await this.InvokeWithLayer(Layer.Version, + new TL.Methods.InitConnection + { + flags = TL.Methods.InitConnection.Flags.has_params, + api_id = _session.ApiId, + device_model = Config("device_model"), + system_version = Config("system_version"), + app_version = Config("app_version"), + system_lang_code = Config("system_lang_code"), + lang_pack = Config("lang_pack"), + lang_code = Config("lang_code"), + params_ = initParams, + query = new TL.Methods.Help_GetConfig() + }); + _dcSession.Layer = Layer.Version; + _session.DcOptions = TLConfig.dc_options; + if (_dcSession.DataCenter == null) + { + _dcSession.DataCenter = _session.DcOptions.Where(dc => dc.id == TLConfig.this_dc) + .OrderByDescending(dc => dc.ip_address == endpoint?.Address.ToString()) + .ThenByDescending(dc => dc.port == endpoint?.Port) + .ThenByDescending(dc => dc.flags == (endpoint?.AddressFamily == AddressFamily.InterNetworkV6 ? DcOption.Flags.ipv6 : 0)) + .First(); + _session.DCSessions[TLConfig.this_dc] = _dcSession; + } + if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc; } - if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc; } finally { diff --git a/src/Session.cs b/src/Session.cs index caaee08..7211e84 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -33,6 +33,7 @@ namespace WTelegram public long LastSentMsgId; public TL.DcOption DataCenter; public bool WithoutUpdates; + public int Layer; internal Client Client; internal int DcID => DataCenter?.id ?? 0; From 1c298bfa83724620e95e1ae97cd7f15f8bdf0a72 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 19 Feb 2024 17:08:26 +0100 Subject: [PATCH 164/336] Fix #233: "server_address" can hint the dcId in order to reuse existing AuthKey on last-ditch reconnection --- src/Client.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index f408fea..6843b76 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -136,9 +136,9 @@ namespace WTelegram Path.GetDirectoryName(Path.GetDirectoryName(AppDomain.CurrentDomain.BaseDirectory.TrimEnd(Path.DirectorySeparatorChar))) ?? AppDomain.CurrentDomain.BaseDirectory, "WTelegram.session"), #if DEBUG - "server_address" => "149.154.167.40:443", // Test DC 2 + "server_address" => "2>149.154.167.40:443", // Test DC 2 #else - "server_address" => "149.154.167.50:443", // DC 2 + "server_address" => "2>149.154.167.50:443", // DC 2 #endif "device_model" => Environment.Is64BitOperatingSystem ? "PC 64bit" : "PC 32bit", "system_version" => Helpers.GetSystemVersion(), @@ -772,6 +772,13 @@ namespace WTelegram return tcpClient; } + private IPEndPoint GetDefaultEndpoint(out int dcId) + { + string addr = Config("server_address"); + dcId = addr.Length > 2 && addr[1] == '>' && addr[0] is > '0' and <= '9' ? addr[0] - '0' : 0; + return Compat.IPEndPoint_Parse(dcId == 0 ? addr : addr[2..]); + } + /// Establish connection to Telegram servers without negociating a user session /// Attempt to resume session immediately without issuing Layer/InitConnection/GetConfig (not recommended by default) /// Usually you shouldn't need to call this method: Use LoginUserIfNeeded instead.
Config callback is queried for: server_address
@@ -819,7 +826,7 @@ namespace WTelegram } else { - endpoint = _dcSession?.EndPoint ?? Compat.IPEndPoint_Parse(Config("server_address")); + endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out int defaultDc); Helpers.Log(2, $"Connecting to {endpoint}..."); TcpClient tcpClient = null; try @@ -855,11 +862,13 @@ namespace WTelegram } if (tcpClient == null) { - endpoint = Compat.IPEndPoint_Parse(Config("server_address")); // re-ask callback for an address + endpoint = GetDefaultEndpoint(out defaultDc); // re-ask callback for an address if (!triedEndpoints.Add(endpoint)) throw; _dcSession.Client = null; // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); + if (_dcSession == null && defaultDc != 0 && _session.DCSessions.TryGetValue(defaultDc, out _dcSession)) + _dcSession.DataCenter = null; _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; Helpers.Log(2, $"Connecting to {endpoint}..."); From cf1c29e9ef2bd223b6fe7d5ee16999d6a2afc702 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 21 Feb 2024 02:11:16 +0100 Subject: [PATCH 165/336] Little better fix for #233 --- src/Client.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 6843b76..328396f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -867,12 +867,12 @@ namespace WTelegram _dcSession.Client = null; // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); - if (_dcSession == null && defaultDc != 0 && _session.DCSessions.TryGetValue(defaultDc, out _dcSession)) - _dcSession.DataCenter = null; + if (defaultDc != 0) _dcSession ??= _session.DCSessions.GetValueOrDefault(defaultDc); _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; Helpers.Log(2, $"Connecting to {endpoint}..."); tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); + _dcSession.DataCenter = null; } } } From b9aad47c8ebc83a0395ed1913814ce15687ed626 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 21 Feb 2024 14:51:26 +0100 Subject: [PATCH 166/336] Better log for wrong timestamps --- src/Client.cs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 328396f..b35b3b9 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -436,8 +436,9 @@ namespace WTelegram Helpers.Log(3, $"{_dcSession.DcID}>Ignoring duplicate or old msg_id {msgId}"); return null; } + var utcNow = DateTime.UtcNow; if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message - _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - DateTime.UtcNow.Ticks + 621355968000000000L; + _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - utcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.OldSalt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) @@ -452,9 +453,9 @@ namespace WTelegram if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); var ctorNb = reader.ReadUInt32(); - if (ctorNb != Layer.BadMsgCtor && (msgStamp - DateTime.UtcNow).Ticks / TimeSpan.TicksPerSecond is > 30 or < -300) + if (ctorNb != Layer.BadMsgCtor && (msgStamp - utcNow).Ticks / TimeSpan.TicksPerSecond is > 30 or < -300) { // msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored. - Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} (svc)"); + Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.ServerTicksOffset):c}"); return null; } if (ctorNb == Layer.MsgContainerCtor) From 33f239fc8eb8aa959adac69b3f57f7a704380f1e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 25 Feb 2024 03:09:49 +0100 Subject: [PATCH 167/336] Improved GetMessageByLink (topics, cache) --- EXAMPLES.md | 1 + src/Client.Helpers.cs | 25 ++++++++++++++++++------- src/Client.cs | 4 ++-- src/Session.cs | 11 +++++------ src/TL.Extensions.cs | 5 +++++ src/TL.cs | 10 +++++----- 6 files changed, 36 insertions(+), 20 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 55d5768..5e7ca9d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -238,6 +238,7 @@ var inputMedias = new List photoFromTelegram, // PhotoBase has implicit conversion to InputMediaPhoto new InputMediaUploadedPhoto { file = uploadedFile }, new InputMediaPhotoExternal { url = photoUrl }, + //or Document, InputMediaDocument, InputMediaUploadedDocument, InputMediaDocumentExternal... }; await client.SendAlbumAsync(InputPeer.Self, inputMedias, "My first album"); ``` diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c0ac2f1..db7a17d 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -769,7 +769,7 @@ namespace WTelegram } /// Return chat and message details based on a Message Link (URL) - /// Message Link, like https://t.me/c/1234567890/1234 or https://t.me/channelname/1234 + /// Message Link, like https://t.me/c/1234567890/1234 or t.me/channelname/1234 /// previously collected chats, to prevent unnecessary ResolveUsername /// Structure containing the message, chat and user details /// If link is for private group (t.me/c/..), user must have joined that group @@ -778,17 +778,28 @@ namespace WTelegram int start = url.IndexOf("//"); start = url.IndexOf('/', start + 2) + 1; int slash = url.IndexOf('/', start + 2); - if (start == 0 || slash == -1) throw new ArgumentException("Invalid URL"); - int end = url.IndexOfAny(UrlSeparator, slash + 1); + int msgStart = slash + 1; + int end = url.IndexOfAny(UrlSeparator, msgStart); if (end == -1) end = url.Length; - int msgId = int.Parse(url[(slash + 1)..end]); + else if (url[end] == '/' && char.IsDigit(url[msgStart]) && url.Length > end + 1 && char.IsDigit(url[end + 1])) + { + end = url.IndexOfAny(UrlSeparator, msgStart = end + 1); + if (end == -1) end = url.Length; + } + if (start == 0 || slash == -1 || end <= slash + 1 || !char.IsDigit(url[msgStart])) throw new ArgumentException("Invalid URL"); + int msgId = int.Parse(url[msgStart..end]); ChatBase chat; if (url[start] is 'c' or 'C' && url[start + 1] == '/') { long chatId = long.Parse(url[(start + 2)..slash]); - var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0)); - if (!mc.chats.TryGetValue(chatId, out chat)) - throw new WTException($"Channel {chatId} not found"); + if (chats?.TryGetValue(chatId, out chat) != true) + { + var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0)); + if (!mc.chats.TryGetValue(chatId, out chat)) + throw new WTException($"Channel {chatId} not found"); + else if (chats != null) + chats[chatId] = chat; + } } else chat = await CachedOrResolveUsername(url[start..slash], chats); diff --git a/src/Client.cs b/src/Client.cs index b35b3b9..2b3447c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -522,7 +522,7 @@ namespace WTelegram for (int i = 0; i < count; i++) { var msg = array[i] = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() }; - if ((msg.seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); + if ((msg.seq_no & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); var pos = reader.BaseStream.Position; try { @@ -535,7 +535,7 @@ namespace WTelegram else { var obj = msg.body = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) diff --git a/src/Session.cs b/src/Session.cs index 7211e84..d5d0b82 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -7,7 +7,7 @@ using System.Net; using System.Security.Cryptography; using System.Text.Json; -//( Don't change this code to lower the security. That's contrary to Telegram recommended practices. Read the official API documentation. +// Don't change this code to lower the security. It's following Telegram security recommendations https://corefork.telegram.org/mtproto/description namespace WTelegram { @@ -81,7 +81,7 @@ namespace WTelegram public DateTime SessionStart => _sessionStart; private readonly DateTime _sessionStart = DateTime.UtcNow; - private readonly SHA256 _sha256 = SHA256.Create(); // put + private readonly SHA256 _sha256 = SHA256.Create(); private Stream _store; private byte[] _reuseKey; // used only if AES Encryptor.CanReuseTransform = false (Mono) private byte[] _encrypted = new byte[16]; @@ -95,7 +95,7 @@ namespace WTelegram _store.Dispose(); _encryptor.Dispose(); _jsonWriter.Dispose(); - _jsonStream.Dispose(); // this + _jsonStream.Dispose(); } internal static Session LoadOrCreate(Stream store, byte[] rgbKey) @@ -107,7 +107,7 @@ namespace WTelegram var length = (int)store.Length; if (length > 0) { - var input = new byte[length]; // code + var input = new byte[length]; if (store.Read(input, 0, length) != length) throw new WTException($"Can't read session block ({store.Position}, {length})"); using var sha256 = SHA256.Create(); @@ -141,7 +141,7 @@ namespace WTelegram int encryptedLen = 64 + (utf8JsonLen & ~15); lock (_store) // while updating _encrypted buffer and writing to store { - if (encryptedLen > _encrypted.Length) // back + if (encryptedLen > _encrypted.Length) Array.Copy(_encrypted, _encrypted = new byte[encryptedLen + 256], 16); _encryptor.TransformBlock(_sha256.ComputeHash(utf8Json, 0, utf8JsonLen), 0, 32, _encrypted, 16); _encryptor.TransformBlock(utf8Json, 0, encryptedLen - 64, _encrypted, 48); @@ -192,7 +192,6 @@ namespace WTelegram } } - // QWxp couldn't be bothered to write such a simple SessionStore, so here it is: internal class ActionStore : MemoryStream { private readonly Action _save; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index aef2c56..96fb1af 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.Linq; using System.Text; using System.Threading.Tasks; @@ -39,9 +40,13 @@ namespace TL public static void CollectUsersChats(this IPeerResolver structure, IDictionary users, IDictionary chats) => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + [EditorBrowsable(EditorBrowsableState.Never)] public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); + [EditorBrowsable(EditorBrowsableState.Never)] public static Task Channels_GetChannels(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); + [EditorBrowsable(EditorBrowsableState.Never)] public static Task Users_GetUsers(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllDialogs"); + [EditorBrowsable(EditorBrowsableState.Never)] public static Task Messages_GetMessages(this Client _) => throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory"); } diff --git a/src/TL.cs b/src/TL.cs index 60d84ba..77e8087 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -198,10 +198,10 @@ namespace TL foreach (var msg in messages) { writer.Write(msg.msg_id); - writer.Write(msg.seqno); + writer.Write(msg.seq_no); var patchPos = writer.BaseStream.Position; writer.Write(0); // patched below - if ((msg.seqno & 1) != 0) + if ((msg.seq_no & 1) != 0) WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); @@ -372,11 +372,11 @@ namespace TL } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public class _Message + public class _Message : IObject { - public _Message(long msgId, int seqNo, IObject obj) { msg_id = msgId; seqno = seqNo; body = obj; } + public _Message(long msgId, int seqNo, IObject obj) { msg_id = msgId; seq_no = seqNo; body = obj; } public long msg_id; - public int seqno; + public int seq_no; public int bytes; public IObject body; } From b9f3b2ebb4c3e823ba60e9e788824964f4ca3354 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 25 Feb 2024 12:46:20 +0100 Subject: [PATCH 168/336] text Escape methods accept null --- src/TL.Extensions.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 96fb1af..26986a0 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -254,6 +254,7 @@ namespace TL /// The escaped text, ready to be used in MarkdownToEntities without problems public static string Escape(string text) { + if (text == null) return null; StringBuilder sb = null; for (int index = 0, added = 0; index < text.Length; index++) { @@ -445,6 +446,6 @@ namespace TL /// The text to make HTML-safe /// The HTML-safe text, ready to be used in HtmlToEntities without problems public static string Escape(string text) - => text.Replace("&", "&").Replace("<", "<").Replace(">", ">"); + => text?.Replace("&", "&").Replace("<", "<").Replace(">", ">"); } } From f958b4081dfaa5391cadfd123293ec248aaa31ed Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 4 Mar 2024 23:54:58 +0100 Subject: [PATCH 169/336] Fix properties base implementation --- EXAMPLES.md | 1 + src/TL.MTProto.cs | 6 +- src/TL.Schema.cs | 224 ++++++++++++++++++++++------------------------ src/TL.Secret.cs | 30 +++---- 4 files changed, 126 insertions(+), 135 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 5e7ca9d..57b461d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -463,6 +463,7 @@ into either a `User` or `ChatBase` (`Chat`,`Channel`...) description structure * You can also use the `CollectUsersChats` helper method to collect these 2 fields into 2 aggregate dictionaries to remember details *(including access hashes)* about all the users/chats you've encountered so far. +This method also helps dealing with [incomplete `min` structures](https://core.telegram.org/api/min). Example of usage: ```csharp diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index d6313b1..fa8754c 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -160,9 +160,9 @@ namespace TL public abstract class MsgDetailedInfoBase : IObject { - public virtual long AnswerMsgId { get; } - public virtual int Bytes { get; } - public virtual int Status { get; } + public virtual long AnswerMsgId => default; + public virtual int Bytes => default; + public virtual int Status => default; } [TLDef(0x276D3EC6)] //msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo public class MsgDetailedInfo : MsgDetailedInfoBase diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 045905a..7e7e52a 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -133,11 +133,11 @@ namespace TL public abstract partial class InputFileBase : IObject { /// Random file identifier created by the client - public virtual long ID { get; set; } + public abstract long ID { get; set; } /// Number of parts saved - public virtual int Parts { get; set; } + public abstract int Parts { get; set; } /// Full name of the file - public virtual string Name { get; set; } + public abstract string Name { get; set; } } /// Defines a file saved in parts using the method Upload_SaveFilePart. See [TLDef(0xF52FF27F)] @@ -948,9 +948,9 @@ namespace TL public abstract partial class ChatBase : IObject { /// ID of the group - public virtual long ID { get; } + public virtual long ID => default; /// Title - public virtual string Title { get; } + public virtual string Title => default; } /// Empty constructor, group doesn't exist See [TLDef(0x29562865)] @@ -1189,35 +1189,35 @@ namespace TL public abstract partial class ChatFullBase : IObject { /// ID of the chat - public virtual long ID { get; } + public virtual long ID => default; /// About string for this chat - public virtual string About { get; } + public virtual string About => default; /// Chat photo - public virtual PhotoBase ChatPhoto { get; } + public virtual PhotoBase ChatPhoto => default; /// Notification settings - public virtual PeerNotifySettings NotifySettings { get; } + public virtual PeerNotifySettings NotifySettings => default; /// Chat invite - public virtual ExportedChatInvite ExportedInvite { get; } + public virtual ExportedChatInvite ExportedInvite => default; /// Info about bots that are in this chat - public virtual BotInfo[] BotInfo { get; } + public virtual BotInfo[] BotInfo => default; /// Message ID of the last pinned message - public virtual int PinnedMsg { get; } + public virtual int PinnedMsg => default; /// Peer folder ID, for more info click here - public virtual int Folder { get; } + public virtual int Folder => default; /// Group call information - public virtual InputGroupCall Call { get; } + public virtual InputGroupCall Call => default; /// Time-To-Live of messages sent by the current user to this chat - public virtual int TtlPeriod { get; } + public virtual int TtlPeriod => default; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. - public virtual Peer GroupcallDefaultJoinAs { get; } + public virtual Peer GroupcallDefaultJoinAs => default; /// Emoji representing a specific chat theme - public virtual string ThemeEmoticon { get; } + public virtual string ThemeEmoticon => default; /// Pending join requests » - public virtual int RequestsPending { get; } + public virtual int RequestsPending => default; /// IDs of users who requested to join recently - public virtual long[] RecentRequesters { get; } + public virtual long[] RecentRequesters => default; /// Allowed message reactions » - public virtual ChatReactions AvailableReactions { get; } + public virtual ChatReactions AvailableReactions => default; } /// Full info about a basic group. See [TLDef(0xC9D31138)] @@ -1535,7 +1535,7 @@ namespace TL public abstract partial class ChatParticipantBase : IObject { /// Member user ID - public virtual long UserId { get; } + public virtual long UserId => default; } /// Group member. See [TLDef(0xC02D4007)] @@ -1571,7 +1571,7 @@ namespace TL public abstract partial class ChatParticipantsBase : IObject { /// Group ID - public virtual long ChatId { get; } + public virtual long ChatId => default; } /// Info on members is unavailable See [TLDef(0x8763D3E1)] @@ -1635,17 +1635,17 @@ namespace TL public abstract class MessageBase : IObject { /// ID of the message - public virtual int ID { get; } + public virtual int ID => default; /// ID of the sender of the message - public virtual Peer From { get; } + public virtual Peer From => default; /// Peer ID, the chat where this message was sent - public virtual Peer Peer { get; } + public virtual Peer Peer => default; /// Reply information - public virtual MessageReplyHeaderBase ReplyTo { get; } + public virtual MessageReplyHeaderBase ReplyTo => default; /// Date of the message - public virtual DateTime Date { get; } + public virtual DateTime Date => default; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. - public virtual int TtlPeriod { get; } + public virtual int TtlPeriod => default; } /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] @@ -2606,9 +2606,9 @@ namespace TL public abstract class DialogBase : IObject { /// The chat - public virtual Peer Peer { get; } + public virtual Peer Peer => default; /// The latest message ID - public virtual int TopMessage { get; } + public virtual int TopMessage => default; } /// Chat See [TLDef(0xD58A08C6)] @@ -2740,7 +2740,7 @@ namespace TL public abstract partial class PhotoSizeBase : IObject { /// Thumbnail type » - public virtual string Type { get; } + public virtual string Type => default; } /// Empty constructor. Image with this thumbnail is unavailable. See [TLDef(0x0E17E23C)] @@ -3102,9 +3102,9 @@ namespace TL public abstract partial class WallPaperBase : IObject { /// Identifier - public virtual long ID { get; } + public virtual long ID => default; /// Info on how to generate the wallpaper, according to these instructions ». - public virtual WallPaperSettings Settings { get; } + public virtual WallPaperSettings Settings => default; } /// Represents a wallpaper based on an image. See [TLDef(0xA437C3ED)] @@ -3380,9 +3380,9 @@ namespace TL public abstract partial class Messages_DialogsBase : IObject, IPeerResolver { /// List of chats - public virtual DialogBase[] Dialogs { get; } + public virtual DialogBase[] Dialogs => default; /// List of last messages from each chat - public virtual MessageBase[] Messages { get; } + public virtual MessageBase[] Messages => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -3427,7 +3427,7 @@ namespace TL public abstract partial class Messages_MessagesBase : IObject, IPeerResolver { /// List of messages - public virtual MessageBase[] Messages { get; } + public virtual MessageBase[] Messages => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -3544,13 +3544,9 @@ namespace TL } /// Affected part of communication history with the user or in a chat. See - [TLDef(0xB45C69D1)] - public class Messages_AffectedHistory : IObject + [TLDef(0xB45C69D1, inheritBefore = true)] + public class Messages_AffectedHistory : Messages_AffectedMessages { - /// Number of events occurred in a text box - public int pts; - /// Number of affected events - public int pts_count; /// If a parameter contains positive value, it is necessary to repeat the method call using the given value; during the proceeding of all the history the value itself shall gradually decrease public int offset; } @@ -5170,11 +5166,11 @@ namespace TL public abstract partial class Updates_DifferenceBase : IObject, IPeerResolver { /// List of new messages - public virtual MessageBase[] NewMessages { get; } + public virtual MessageBase[] NewMessages => default; /// List of new encrypted secret chat messages - public virtual EncryptedMessageBase[] NewEncryptedMessages { get; } + public virtual EncryptedMessageBase[] NewEncryptedMessages => default; /// List of updates - public virtual Update[] OtherUpdates { get; } + public virtual Update[] OtherUpdates => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -5259,7 +5255,7 @@ namespace TL public abstract partial class UpdatesBase : IObject, IPeerResolver { /// date - public virtual DateTime Date { get; } + public virtual DateTime Date => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } @@ -5752,15 +5748,15 @@ namespace TL public abstract class EncryptedChatBase : IObject { /// Chat ID - public virtual int ID { get; } + public virtual int ID => default; /// Checking sum depending on user ID - public virtual long AccessHash { get; } + public virtual long AccessHash => default; /// Date of chat creation - public virtual DateTime Date { get; } + public virtual DateTime Date => default; /// Chat creator ID - public virtual long AdminId { get; } + public virtual long AdminId => default; /// ID of second chat participant - public virtual long ParticipantId { get; } + public virtual long ParticipantId => default; } /// Empty constructor. See [TLDef(0xAB7EC0A0)] @@ -5917,7 +5913,7 @@ namespace TL public abstract class InputEncryptedFileBase : IObject { /// Random file ID created by client - public virtual long ID { get; set; } + public abstract long ID { get; set; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] @@ -5966,13 +5962,13 @@ namespace TL public abstract class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message - public virtual long RandomId { get; } + public virtual long RandomId => default; /// ID of encrypted chat - public virtual int ChatId { get; } + public virtual int ChatId => default; /// Date of sending - public virtual DateTime Date { get; } + public virtual DateTime Date => default; /// TL-serialization of type, encrypted with the key created at chat initialization - public virtual byte[] Bytes { get; } + public virtual byte[] Bytes => default; } /// Encrypted message. See [TLDef(0xED18C118)] @@ -6593,9 +6589,9 @@ namespace TL public abstract class WebPageBase : IObject { /// Preview ID - public virtual long ID { get; } + public virtual long ID => default; /// URL of the webpage. - public virtual string Url { get; } + public virtual string Url => default; } /// No preview is available for the webpage See [TLDef(0x211A1788)] @@ -7191,7 +7187,7 @@ namespace TL public abstract class KeyboardButtonBase : IObject { /// Button text - public virtual string Text { get; } + public virtual string Text => default; } /// Bot keyboard button See [TLDef(0xA2FA4880)] @@ -7554,7 +7550,7 @@ namespace TL public abstract class InputChannelBase : IObject { /// Channel ID - public virtual long ChannelId { get; set; } + public abstract long ChannelId { get; set; } } /// Represents a channel See [TLDef(0xF35AEC28)] @@ -8151,9 +8147,9 @@ namespace TL public abstract class InputBotInlineResultBase : IObject { /// ID of result - public virtual string ID { get; set; } + public abstract string ID { get; set; } /// Message to send when the result is selected - public virtual InputBotInlineMessage SendMessage { get; set; } + public abstract InputBotInlineMessage SendMessage { get; set; } } /// An inline bot result See [TLDef(0x88BF9319)] @@ -8462,15 +8458,15 @@ namespace TL public abstract class BotInlineResultBase : IObject { /// Result ID - public virtual string ID { get; } + public virtual string ID => default; /// Result type (see bot API docs) - public virtual string Type { get; } + public virtual string Type => default; /// Result title - public virtual string Title { get; } + public virtual string Title => default; /// Result description - public virtual string Description { get; } + public virtual string Description => default; /// Message to send - public virtual BotInlineMessage SendMessage { get; } + public virtual BotInlineMessage SendMessage => default; } /// Generic result See [TLDef(0x11965F3A)] @@ -8834,9 +8830,9 @@ namespace TL public abstract class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message - public virtual int DcId { get; set; } + public abstract int DcId { get; set; } /// Access hash of message - public virtual long AccessHash { get; set; } + public abstract long AccessHash { get; set; } } /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] @@ -9086,7 +9082,7 @@ namespace TL public abstract class StickerSetCoveredBase : IObject { /// Stickerset - public virtual StickerSet Set { get; } + public virtual StickerSet Set => default; } /// Stickerset with a single sticker as preview See [TLDef(0x6410A5D2)] @@ -9821,13 +9817,13 @@ namespace TL public abstract partial class WebDocumentBase : IObject { /// Document URL - public virtual string Url { get; } + public virtual string Url => default; /// File size - public virtual int Size { get; } + public virtual int Size => default; /// MIME type - public virtual string MimeType { get; } + public virtual string MimeType => default; /// Attributes for media types - public virtual DocumentAttribute[] Attributes { get; } + public virtual DocumentAttribute[] Attributes => default; } /// Remote document See [TLDef(0x1C570ED1)] @@ -10216,17 +10212,17 @@ namespace TL public abstract partial class PhoneCallBase : IObject { /// Call ID - public virtual long ID { get; } + public virtual long ID => default; /// Access hash - public virtual long AccessHash { get; } + public virtual long AccessHash => default; /// Date - public virtual DateTime Date { get; } + public virtual DateTime Date => default; /// Admin ID - public virtual long AdminId { get; } + public virtual long AdminId => default; /// Participant ID - public virtual long ParticipantId { get; } + public virtual long ParticipantId => default; /// Phone call protocol info - public virtual PhoneCallProtocol Protocol { get; } + public virtual PhoneCallProtocol Protocol => default; } /// Empty constructor See [TLDef(0x5366C915)] @@ -10443,13 +10439,13 @@ namespace TL public abstract class PhoneConnectionBase : IObject { /// Endpoint ID - public virtual long ID { get; } + public virtual long ID => default; /// IP address of endpoint - public virtual string Ip { get; } + public virtual string Ip => default; /// IPv6 address of endpoint - public virtual string Ipv6 { get; } + public virtual string Ipv6 => default; /// Port ID - public virtual int Port { get; } + public virtual int Port => default; } /// Identifies an endpoint that can be used to connect to the other user in a phone call See [TLDef(0x9CC123C7)] @@ -10591,7 +10587,7 @@ namespace TL public abstract class LangPackStringBase : IObject { /// Language key - public virtual string Key { get; } + public virtual string Key => default; } /// Translated localization string See [TLDef(0xCAD181F6)] @@ -11415,7 +11411,7 @@ namespace TL public abstract class InputSecureFileBase : IObject { /// Secure file ID - public virtual long ID { get; set; } + public abstract long ID { get; set; } } /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] @@ -11629,9 +11625,9 @@ namespace TL public abstract class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , - public virtual SecureValueType Type { get; } + public virtual SecureValueType Type => default; /// Error message - public virtual string Text { get; } + public virtual string Text => default; } /// Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. See [TLDef(0xE8A40BD9)] @@ -12704,7 +12700,7 @@ namespace TL public abstract class PeerLocatedBase : IObject { /// Validity period of current data - public virtual DateTime Expires { get; } + public virtual DateTime Expires => default; } /// Peer geolocated nearby See [TLDef(0xCA461B5D)] @@ -13042,15 +13038,15 @@ namespace TL public abstract class DialogFilterBase : IObject { /// Folder ID - public virtual int ID { get; } + public virtual int ID => default; /// Folder name - public virtual string Title { get; } + public virtual string Title => default; /// Emoji to use as icon for the folder. - public virtual string Emoticon { get; } + public virtual string Emoticon => default; /// Pinned chats, folders can have unlimited pinned chats - public virtual InputPeer[] PinnedPeers { get; } + public virtual InputPeer[] PinnedPeers => default; /// Include the following chats in this folder - public virtual InputPeer[] IncludePeers { get; } + public virtual InputPeer[] IncludePeers => default; } /// Dialog filter AKA folder See [TLDef(0x7438F7E8)] @@ -13693,9 +13689,9 @@ namespace TL public abstract partial class GroupCallBase : IObject { /// Group call ID - public virtual long ID { get; } + public virtual long ID => default; /// Group call access hash - public virtual long AccessHash { get; } + public virtual long AccessHash => default; } /// An ended group call See [TLDef(0x7780BCB4)] @@ -13932,15 +13928,9 @@ namespace TL } /// Messages found and affected by changes See - [TLDef(0xEF8D3E6C)] - public class Messages_AffectedFoundMessages : IObject + [TLDef(0xEF8D3E6C, inheritBefore = true)] + public class Messages_AffectedFoundMessages : Messages_AffectedHistory { - /// Event count after generation - public int pts; - /// Number of events that were generated - public int pts_count; - /// If bigger than zero, the request must be repeated to remove more messages - public int offset; /// Affected message IDs public int[] messages; } @@ -13989,9 +13979,9 @@ namespace TL public abstract class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite - public virtual ExportedChatInvite Invite { get; } + public virtual ExportedChatInvite Invite => default; /// Mentioned users - public virtual Dictionary Users { get; } + public virtual Dictionary Users => default; } /// Info about a chat invite See [TLDef(0x1871BE50)] @@ -15215,7 +15205,7 @@ namespace TL public abstract class ForumTopicBase : IObject { /// The ID of the deleted forum topic. - public virtual int ID { get; } + public virtual int ID => default; } /// Represents a deleted forum topic. See [TLDef(0x023F109B)] @@ -15681,9 +15671,9 @@ namespace TL public abstract class Chatlists_ChatlistInviteBase : IObject { /// Related chat information - public virtual Dictionary Chats { get; } + public virtual Dictionary Chats => default; /// Related user information - public virtual Dictionary Users { get; } + public virtual Dictionary Users => default; } /// Updated info about a chat folder deep link » we already imported. See [TLDef(0xFA87F659)] @@ -15768,9 +15758,9 @@ namespace TL public abstract class MessagePeerVoteBase : IObject { /// Peer ID - public virtual Peer Peer { get; } + public virtual Peer Peer => default; /// When did the peer cast the vote - public virtual DateTime Date { get; } + public virtual DateTime Date => default; } /// How a peer voted in a poll See [TLDef(0xB6CC2D5C)] @@ -15875,7 +15865,7 @@ namespace TL public abstract class StoryItemBase : IObject { /// Story ID - public virtual int ID { get; } + public virtual int ID => default; } /// Represents a previously active story, that was deleted See [TLDef(0x51E6EE4F)] @@ -16437,7 +16427,7 @@ namespace TL public abstract class Payments_GiveawayInfoBase : IObject { /// When was the giveaway started - public virtual DateTime StartDate { get; } + public virtual DateTime StartDate => default; } /// Contains info about an ongoing giveaway. See [TLDef(0x4367DAA0)] @@ -16921,13 +16911,13 @@ namespace TL public abstract class Messages_SavedDialogsBase : IObject { /// Saved message dialogs ». - public virtual SavedDialog[] Dialogs { get; } + public virtual SavedDialog[] Dialogs => default; /// List of last messages from each saved dialog - public virtual MessageBase[] Messages { get; } + public virtual MessageBase[] Messages => default; /// Mentioned chats - public virtual Dictionary Chats { get; } + public virtual Dictionary Chats => default; /// Mentioned users - public virtual Dictionary Users { get; } + public virtual Dictionary Users => default; } /// Represents some saved message dialogs ». See [TLDef(0xF83AE221)] diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 3e31293..6028014 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -7,32 +7,32 @@ namespace TL public abstract class DecryptedMessageBase : IObject { /// Flags, see TL conditional fields (added in layer 45) - public virtual uint FFlags { get; } + public virtual uint FFlags => default; /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
- public virtual long RandomId { get; } + public virtual long RandomId => default; /// Message lifetime. Has higher priority than .
Parameter added in Layer 17.
- public virtual int Ttl { get; } + public virtual int Ttl => default; /// Message text - public virtual string Message { get; } + public virtual string Message => default; /// Media content - public virtual DecryptedMessageMedia Media { get; } + public virtual DecryptedMessageMedia Media => default; /// Message entities for styled text (parameter added in layer 45) - public virtual MessageEntity[] Entities { get; } + public virtual MessageEntity[] Entities => default; /// Specifies the ID of the inline bot that generated the message (parameter added in layer 45) - public virtual string ViaBotName { get; } + public virtual string ViaBotName => default; /// Random message ID of the message this message replies to (parameter added in layer 45) - public virtual long ReplyToRandom { get; } + public virtual long ReplyToRandom => default; /// Random group ID, assigned by the author of message.
Multiple encrypted messages with a photo attached and with the same group ID indicate an album or grouped media (parameter added in layer 45)
- public virtual long Grouped { get; } - public virtual byte[] RandomBytes { get; } - public virtual DecryptedMessageAction Action { get; } + public virtual long Grouped => default; + public virtual byte[] RandomBytes => default; + public virtual DecryptedMessageAction Action => default; } /// Object describes media contents of an encrypted message. See /// a value means decryptedMessageMediaEmpty public abstract class DecryptedMessageMedia : IObject { - public virtual string MimeType { get; } + public virtual string MimeType => default; internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new WTelegram.WTException("Incompatible DecryptedMessageMedia"); } } @@ -43,11 +43,11 @@ namespace TL public abstract class FileLocationBase : IObject { /// Server volume - public virtual long VolumeId { get; } + public virtual long VolumeId => default; /// File ID - public virtual int LocalId { get; } + public virtual int LocalId => default; /// Checksum to access the file - public virtual long Secret { get; } + public virtual long Secret => default; } namespace Layer8 From 345f10971b92a6ba407434fd0a83a8f4076b2141 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:33:18 +0100 Subject: [PATCH 170/336] using [] syntax --- Examples/Program_Heroku.cs | 4 ++-- Examples/Program_ListenUpdates.cs | 4 ++-- Examples/Program_SecretChats.cs | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 23555ae..482b830 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -17,8 +17,8 @@ namespace WTelegramClientTest { static WTelegram.Client Client; static User My; - static readonly Dictionary Users = new(); - static readonly Dictionary Chats = new(); + static readonly Dictionary Users = []; + static readonly Dictionary Chats = []; // See steps at the end of this file to setup required Environment variables static async Task Main(string[] _) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index baf09ca..ff0f502 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -9,8 +9,8 @@ namespace WTelegramClientTest { static WTelegram.Client Client; static User My; - static readonly Dictionary Users = new(); - static readonly Dictionary Chats = new(); + static readonly Dictionary Users = []; + static readonly Dictionary Chats = []; // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 637ead7..2d02d0d 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -13,8 +13,8 @@ namespace WTelegramClientTest static Client Client; static SecretChats Secrets; static ISecretChat ActiveChat; // the secret chat currently selected - static readonly Dictionary Users = new(); - static readonly Dictionary Chats = new(); + static readonly Dictionary Users = []; + static readonly Dictionary Chats = []; // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main() From b5ca3fcc0e5e34ac083169eeddbf1eb19dacce08 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:52:30 +0100 Subject: [PATCH 171/336] Fix SendAlbumAsync videoUrlAsFile. using [] syntax --- src/Client.Helpers.cs | 14 +++++++------- src/Client.cs | 8 ++++---- src/Compat.cs | 2 +- src/Encryption.cs | 6 +++--- src/Helpers.cs | 8 ++++---- src/SecretChats.cs | 4 ++-- src/Session.cs | 4 ++-- src/TL.Helpers.cs | 24 ++++++++++++------------ src/TL.Schema.cs | 6 +++--- src/TlsStream.cs | 22 +++++++++++----------- 10 files changed, 49 insertions(+), 49 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index db7a17d..4775d48 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -218,10 +218,10 @@ namespace WTelegram case InputMediaDocumentExternal imde: string mimeType = null; var inputFile = await UploadFromUrl(imde.url); - if (mimeType?.StartsWith("video/") == true) - ism.media = new InputMediaUploadedDocument(inputFile, mimeType, new DocumentAttributeVideo { flags = DocumentAttributeVideo.Flags.supports_streaming }); - else + if (videoUrlAsFile || mimeType?.StartsWith("video/") != true) ism.media = new InputMediaUploadedDocument(inputFile, mimeType); + else + ism.media = new InputMediaUploadedDocument(inputFile, mimeType, new DocumentAttributeVideo { flags = DocumentAttributeVideo.Flags.supports_streaming }); goto retry; case InputMediaPhotoExternal impe: inputFile = await UploadFromUrl(impe.url); @@ -510,7 +510,7 @@ namespace WTelegram public async Task Channels_GetAllParticipants(InputChannelBase channel, bool includeKickBan = false, string alphabet1 = "АБCДЕЄЖФГHИІJКЛМНОПQРСТУВWХЦЧШЩЫЮЯЗ", string alphabet2 = "АCЕHИJЛМНОРСТУВWЫ", CancellationToken cancellationToken = default) { alphabet2 ??= alphabet1; - var result = new Channels_ChannelParticipants { chats = new(), users = new() }; + var result = new Channels_ChannelParticipants { chats = [], users = [] }; var user_ids = new HashSet(); var participants = new List(); @@ -616,7 +616,7 @@ namespace WTelegram { case InputPeerChat chat: await this.Messages_EditChatAdmin(chat.chat_id, user, is_admin); - return new Updates { date = DateTime.UtcNow, users = new(), updates = Array.Empty(), + return new Updates { date = DateTime.UtcNow, users = [], updates = [], chats = (await this.Messages_GetChats(chat.chat_id)).chats }; case InputPeerChannel channel: return await this.Channels_EditAdmin(channel, user, @@ -663,7 +663,7 @@ namespace WTelegram { case InputPeerChat chat: await this.Messages_DeleteChat(chat.chat_id); - return new Updates { date = DateTime.UtcNow, users = new(), updates = Array.Empty(), + return new Updates { date = DateTime.UtcNow, users = [], updates = [], chats = (await this.Messages_GetChats(chat.chat_id)).chats }; case InputPeerChannel channel: return await this.Channels_DeleteChannel(channel); @@ -695,7 +695,7 @@ namespace WTelegram public async Task ReadHistory(InputPeer peer, int max_id = default) => peer is InputPeerChannel channel ? await this.Channels_ReadHistory(channel, max_id) : (await this.Messages_ReadHistory(peer, max_id)) != null; - private static readonly char[] UrlSeparator = new[] { '?', '#', '/' }; + private static readonly char[] UrlSeparator = ['?', '#', '/']; /// Return information about a chat/channel based on Invite Link or Public Link /// Public link or Invite link, like https://t.me/+InviteHash, https://t.me/joinchat/InviteHash or https://t.me/channelname
Works also without https:// prefix diff --git a/src/Client.cs b/src/Client.cs index 2b3447c..c12482a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -64,12 +64,12 @@ namespace WTelegram private Stream _networkStream; private IObject _lastSentMsg; private long _lastRecvMsgId; - private readonly List _msgsToAck = new(); + private readonly List _msgsToAck = []; private readonly Random _random = new(); private int _saltChangeCounter; private Task _reactorTask; private Rpc _bareRpc; - private readonly Dictionary _pendingRpcs = new(); + private readonly Dictionary _pendingRpcs = []; private SemaphoreSlim _sendSemaphore = new(0); private readonly SemaphoreSlim _semaphore = new(1); private Task _connecting; @@ -489,7 +489,7 @@ namespace WTelegram { lock (_session) { - _dcSession.Salts ??= new(); + _dcSession.Salts ??= []; if (_dcSession.Salts.Count != 0) { var keys = _dcSession.Salts.Keys; @@ -1285,7 +1285,7 @@ namespace WTelegram if (isContent && CheckMsgsToAck() is MsgsAck msgsAck) { var (ackId, ackSeqno) = NewMsgId(false); - var container = new MsgContainer { messages = new _Message[] { new(msgId, seqno, msg), new(ackId, ackSeqno, msgsAck) } }; + var container = new MsgContainer { messages = [new(msgId, seqno, msg), new(ackId, ackSeqno, msgsAck)] }; await SendAsync(container, false); return; } diff --git a/src/Compat.cs b/src/Compat.cs index 9364fde..b83e832 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -87,7 +87,7 @@ namespace System.Runtime.CompilerServices { if (array == null) throw new ArgumentNullException(); var (offset, length) = range.GetOffsetAndLength(array.Length); - if (length == 0) return Array.Empty(); + if (length == 0) return []; var dest = typeof(T).IsValueType || typeof(T[]) == array.GetType() ? new T[length] : (T[])Array.CreateInstance(array.GetType().GetElementType()!, length); Array.Copy(array, offset, dest, 0, length); diff --git a/src/Encryption.cs b/src/Encryption.cs index 23ab8fc..a7ede50 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -15,7 +15,7 @@ namespace WTelegram { internal static class Encryption { - private static readonly Dictionary PublicKeys = new(); + private static readonly Dictionary PublicKeys = []; internal static readonly RNGCryptoServiceProvider RNG = new(); internal static readonly Aes AesECB = Aes.Create(); @@ -209,7 +209,7 @@ namespace WTelegram SafePrimes.Add(p); } - private static readonly HashSet SafePrimes = new() { new(new byte[] // C71CAEB9C6B1C904... + private static readonly HashSet SafePrimes = [ new(new byte[] // C71CAEB9C6B1C904... { 0x5B, 0xCC, 0x2F, 0xB9, 0xE3, 0xD8, 0x9C, 0x11, 0x03, 0x04, 0xB1, 0x34, 0xF0, 0xAD, 0x4F, 0x6F, 0xBF, 0x54, 0x24, 0x4B, 0xD0, 0x15, 0x4E, 0x2E, 0xEE, 0x05, 0xB1, 0x35, 0xF6, 0x15, 0x81, 0x0D, @@ -227,7 +227,7 @@ namespace WTelegram 0xDB, 0xF4, 0x30, 0x25, 0xD2, 0x93, 0x94, 0x22, 0x58, 0x40, 0xC1, 0xA7, 0x0A, 0x8A, 0x19, 0x48, 0x0F, 0x93, 0x3D, 0x56, 0x37, 0xD0, 0x34, 0x49, 0xC1, 0x21, 0x3E, 0x8E, 0x23, 0x40, 0x0D, 0x98, 0x73, 0x3F, 0xF1, 0x70, 0x2F, 0x52, 0x6C, 0x8E, 0x04, 0xC9, 0xB1, 0xC6, 0xB9, 0xAE, 0x1C, 0xC7, 0x00 - })}; + })]; internal static void CheckGoodGaAndGb(BigInteger g, BigInteger dh_prime) { diff --git a/src/Helpers.cs b/src/Helpers.cs index 50b445e..decf66c 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -18,8 +18,8 @@ namespace WTelegram public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }; - private static readonly ConsoleColor[] LogLevelToColor = new[] { ConsoleColor.DarkGray, ConsoleColor.DarkCyan, - ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue }; + private static readonly ConsoleColor[] LogLevelToColor = [ ConsoleColor.DarkGray, ConsoleColor.DarkCyan, + ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue ]; private static void DefaultLogger(int level, string message) { Console.ForegroundColor = LogLevelToColor[level]; @@ -186,7 +186,7 @@ namespace WTelegram } internal static readonly byte[] StrippedThumbJPG = // see https://core.telegram.org/api/files#stripped-thumbnails - { + [ 0xff, 0xd8, 0xff, 0xe0, 0x00, 0x10, 0x4a, 0x46, 0x49, 0x46, 0x00, 0x01, 0x01, 0x00, 0x00, 0x01, 0x00, 0x01, 0x00, 0x00, 0xff, 0xdb, 0x00, 0x43, 0x00, 0x28, 0x1c, 0x1e, 0x23, 0x1e, 0x19, 0x28, 0x23, 0x21, 0x23, 0x2d, 0x2b, 0x28, 0x30, 0x3c, 0x64, 0x41, 0x3c, 0x37, 0x37, @@ -223,7 +223,7 @@ namespace WTelegram 0xd5, 0xd6, 0xd7, 0xd8, 0xd9, 0xda, 0xe2, 0xe3, 0xe4, 0xe5, 0xe6, 0xe7, 0xe8, 0xe9, 0xea, 0xf2, 0xf3, 0xf4, 0xf5, 0xf6, 0xf7, 0xf8, 0xf9, 0xfa, 0xff, 0xda, 0x00, 0x0c, 0x03, 0x01, 0x00, 0x02, 0x11, 0x03, 0x11, 0x00, 0x3f, 0x00 - }; + ]; internal static string GetSystemVersion() { diff --git a/src/SecretChats.cs b/src/SecretChats.cs index cc64f91..9cc89cd 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -28,7 +28,7 @@ namespace WTelegram private readonly Client client; private readonly FileStream storage; - private readonly Dictionary chats = new(); + private readonly Dictionary chats = []; private Messages_DhConfig dh; private BigInteger dh_prime; private readonly SHA256 sha256 = SHA256.Create(); @@ -57,7 +57,7 @@ namespace WTelegram public int RemoteLayer => remoteLayer; internal long key_fingerprint; - internal SortedList pendingMsgs = new(); + internal SortedList pendingMsgs = []; internal void Discarded() // clear out fields for more security { Array.Clear(authKey, 0, authKey.Length); diff --git a/src/Session.cs b/src/Session.cs index d5d0b82..950cad0 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -16,7 +16,7 @@ namespace WTelegram public int ApiId; public long UserId; public int MainDC; - public Dictionary DCSessions = new(); + public Dictionary DCSessions = []; public TL.DcOption[] DcOptions; public class DCSession @@ -195,7 +195,7 @@ namespace WTelegram internal class ActionStore : MemoryStream { private readonly Action _save; - public ActionStore(byte[] initial, Action save) : base(initial ?? Array.Empty()) => _save = save; + public ActionStore(byte[] initial, Action save) : base(initial ?? []) => _save = save; public override void Write(byte[] buffer, int offset, int count) => _save(buffer[offset..(offset + count)]); public override void SetLength(long value) { } } diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 8f187a0..f74311b 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -285,7 +285,7 @@ namespace TL partial class ChatParticipantAdmin { public override bool IsAdmin => true; } partial class ChatParticipantsBase { public abstract ChatParticipantBase[] Participants { get; }} - partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => Array.Empty(); } + partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => []; } partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } partial class MessageEmpty { public override string ToString() => "(no message)"; } @@ -429,8 +429,8 @@ namespace TL public abstract Update[] UpdateList { get; } public virtual Dictionary Users => NoUsers; public virtual Dictionary Chats => NoChats; - private static readonly Dictionary NoUsers = new(); - private static readonly Dictionary NoChats = new(); + private static readonly Dictionary NoUsers = []; + private static readonly Dictionary NoChats = []; public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; } partial class UpdatesCombined @@ -447,10 +447,10 @@ namespace TL public override Dictionary Chats => chats; public override (long mbox_id, int pts, int pts_count) GetMBox() => (-2, seq, 1); } - partial class UpdatesTooLong { public override Update[] UpdateList => Array.Empty(); } - partial class UpdateShort { public override Update[] UpdateList => new[] { update }; } - partial class UpdateShortSentMessage { public override Update[] UpdateList => Array.Empty(); } - partial class UpdateShortMessage { public override Update[] UpdateList => new[] { new UpdateNewMessage + partial class UpdatesTooLong { public override Update[] UpdateList => []; } + partial class UpdateShort { public override Update[] UpdateList => [update]; } + partial class UpdateShortSentMessage { public override Update[] UpdateList => []; } + partial class UpdateShortMessage { public override Update[] UpdateList => [ new UpdateNewMessage { message = new Message { @@ -460,8 +460,8 @@ namespace TL peer_id = new PeerUser { user_id = user_id }, fwd_from = fwd_from, via_bot_id = via_bot_id, ttl_period = ttl_period }, pts = pts, pts_count = pts_count - } }; } - partial class UpdateShortChatMessage { public override Update[] UpdateList => new[] { new UpdateNewMessage + } ]; } + partial class UpdateShortChatMessage { public override Update[] UpdateList => [ new UpdateNewMessage { message = new Message { @@ -471,7 +471,7 @@ namespace TL peer_id = new PeerChat { chat_id = chat_id }, fwd_from = fwd_from, via_bot_id = via_bot_id, ttl_period = ttl_period }, pts = pts, pts_count = pts_count - } }; } + } ]; } partial class InputEncryptedChat { public static implicit operator int(InputEncryptedChat chat) => chat.chat_id; public static implicit operator InputEncryptedChat(EncryptedChatBase chat) => new() { chat_id = chat.ID, access_hash = chat.AccessHash }; } @@ -580,8 +580,8 @@ namespace TL } partial class Updates_ChannelDifferenceEmpty { - public override MessageBase[] NewMessages => Array.Empty(); - public override Update[] OtherUpdates => Array.Empty(); + public override MessageBase[] NewMessages => []; + public override Update[] OtherUpdates => []; public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 7e7e52a..855998b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5183,9 +5183,9 @@ namespace TL /// Number of sent updates public int seq; - public override MessageBase[] NewMessages => Array.Empty(); - public override EncryptedMessageBase[] NewEncryptedMessages => Array.Empty(); - public override Update[] OtherUpdates => Array.Empty(); + public override MessageBase[] NewMessages => []; + public override EncryptedMessageBase[] NewEncryptedMessages => []; + public override Update[] OtherUpdates => []; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 97ed1e5..5b7b7ac 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -15,10 +15,10 @@ namespace WTelegram { public TlsStream(Stream innerStream) : base(innerStream) { } private int _tlsFrameleft; - private readonly byte[] _tlsSendHeader = new byte[] { 0x17, 0x03, 0x03, 0, 0 }; + private readonly byte[] _tlsSendHeader = [0x17, 0x03, 0x03, 0, 0]; private readonly byte[] _tlsReadHeader = new byte[5]; - static readonly byte[] TlsServerHello3 = new byte[] { 0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x17, 0x03, 0x03 }; - static readonly byte[] TlsClientPrefix = new byte[] { 0x14, 0x03, 0x03, 0x00, 0x01, 0x01 }; + static readonly byte[] TlsServerHello3 = [0x14, 0x03, 0x03, 0x00, 0x01, 0x01, 0x17, 0x03, 0x03]; + static readonly byte[] TlsClientPrefix = [0x14, 0x03, 0x03, 0x00, 0x01, 0x01]; public override async Task ReadAsync(byte[] buffer, int offset, int count, CancellationToken ct) { @@ -85,20 +85,20 @@ namespace WTelegram throw new WTException("TLS Handshake failed"); } - static readonly byte[] TlsClientHello1 = new byte[11] { // https://tls13.xargs.org/#client-hello/annotated - 0x16, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03 }; + static readonly byte[] TlsClientHello1 = [ // https://tls13.xargs.org/#client-hello/annotated + 0x16, 0x03, 0x01, 0x02, 0x00, 0x01, 0x00, 0x01, 0xfc, 0x03, 0x03 ]; // digest[32] // 0x20 // random[32] // 0x00, 0x20 // grease(0) GREASE are two identical bytes ending with nibble 'A' - static readonly byte[] TlsClientHello2 = new byte[34] { + static readonly byte[] TlsClientHello2 = [ 0x13, 0x01, 0x13, 0x02, 0x13, 0x03, 0xc0, 0x2b, 0xc0, 0x2f, 0xc0, 0x2c, 0xc0, 0x30, 0xcc, 0xa9, 0xcc, 0xa8, 0xc0, 0x13, 0xc0, 0x14, 0x00, 0x9c, 0x00, 0x9d, 0x00, 0x2f, 0x00, 0x35, - 0x01, 0x00, 0x01, 0x93 }; + 0x01, 0x00, 0x01, 0x93 ]; // grease(2) // 0x00, 0x00 - static readonly byte[] TlsClientHello3 = new byte[134] { + static readonly byte[] TlsClientHello3 = [ // 0x00, 0x00, len { len { 0x00 len { domain } } } len is 16-bit big-endian length of the following block of data 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A,/*=grease(4)*/ 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, @@ -114,10 +114,10 @@ namespace WTelegram 0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A,/*=grease(4) */ 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */ 0x44, 0x69, 0x00, 0x05, 0x00, 0x03, 0x02, 0x68, 0x32, 0xff, 0x01, 0x00, 0x01, 0x00, - }; + ]; // grease(3) - static readonly byte[] TlsClientHello4 = new byte[5] { - 0x00, 0x01, 0x00, 0x00, 0x15 }; + static readonly byte[] TlsClientHello4 = [ + 0x00, 0x01, 0x00, 0x00, 0x15 ]; // len { padding } padding with NUL bytes to reach 517 bytes static byte[] TlsClientHello(byte[] key, byte[] domain) From d0460f296cdea01c0e31156a9ad7432019fc7f37 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:01:43 +0100 Subject: [PATCH 172/336] Compile using latest SDK --- .github/dev.yml | 2 +- .github/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1884efe..807cf43 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -19,7 +19,7 @@ stages: displayName: 'Use .NET Core sdk' inputs: packageType: 'sdk' - version: '6.0.x' + version: '9.x' includePreviewVersions: true - task: DotNetCoreCLI@2 diff --git a/.github/release.yml b/.github/release.yml index 14e7bdb..540de46 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -22,7 +22,7 @@ stages: displayName: 'Use .NET Core sdk' inputs: packageType: 'sdk' - version: '6.0.x' + version: '9.x' includePreviewVersions: true - task: DotNetCoreCLI@2 From 8eb5b29d9776e918e4b5e4459d6225dde90744e2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:07:37 +0100 Subject: [PATCH 173/336] using primary constructors, and more [] syntax --- src/Client.Helpers.cs | 12 ++++++------ src/Client.cs | 2 +- src/Encryption.cs | 15 ++++----------- src/SecretChats.cs | 2 +- src/Session.cs | 6 ++---- src/TL.Extensions.cs | 4 ++-- src/TL.Helpers.cs | 2 +- src/TlsStream.cs | 3 +-- 8 files changed, 18 insertions(+), 28 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 4775d48..6b3c762 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -83,7 +83,7 @@ namespace WTelegram } } Task[] remainingTasks; - lock (tasks) remainingTasks = tasks.Values.ToArray(); + lock (tasks) remainingTasks = [.. tasks.Values]; await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception return isBig ? new InputFileBig { id = file_id, parts = file_total_parts, name = filename } : new InputFile { id = file_id, parts = file_total_parts, name = filename }; @@ -398,7 +398,7 @@ namespace WTelegram } } Task[] remainingTasks; - lock (tasks) remainingTasks = tasks.Values.ToArray(); + lock (tasks) remainingTasks = [.. tasks.Values]; await Task.WhenAll(remainingTasks); // wait completion and eventually propagate any task exception await outputStream.FlushAsync(); if (canSeek) outputStream.Seek(streamStartPos + maxOffsetSeen, SeekOrigin.Begin); @@ -491,8 +491,8 @@ namespace WTelegram foreach (var (key, value) in md.chats) mds.chats[key] = value; foreach (var (key, value) in md.users) mds.users[key] = value; } - mds.dialogs = dialogList.ToArray(); - mds.messages = messageList.ToArray(); + mds.dialogs = [.. dialogList]; + mds.messages = [.. messageList]; return mds; case Messages_Dialogs md: return md; default: throw new WTException("Messages_GetDialogs returned unexpected " + dialogs?.GetType().Name); @@ -526,7 +526,7 @@ namespace WTelegram await GetWithFilter(new ChannelParticipantsKicked { q = "" }, (f, c) => new ChannelParticipantsKicked { q = f.q + c }, alphabet1); await GetWithFilter(new ChannelParticipantsBanned { q = "" }, (f, c) => new ChannelParticipantsBanned { q = f.q + c }, alphabet1); } - result.participants = participants.ToArray(); + result.participants = [.. participants]; return result; async Task GetWithFilter(T filter, Func recurse = null, string alphabet = null) where T : ChannelParticipantsFilter @@ -572,7 +572,7 @@ namespace WTelegram foreach (var kvp in result.chats) resultFull.chats[kvp.Key] = kvp.Value; foreach (var kvp in result.users) resultFull.users[kvp.Key] = kvp.Value; } - resultFull.events = events.ToArray(); + resultFull.events = [.. events]; return resultFull; } diff --git a/src/Client.cs b/src/Client.cs index c12482a..cd808eb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1254,7 +1254,7 @@ namespace WTelegram lock (_msgsToAck) { if (_msgsToAck.Count == 0) return null; - var msgsAck = new MsgsAck { msg_ids = _msgsToAck.ToArray() }; + var msgsAck = new MsgsAck { msg_ids = [.. _msgsToAck] }; _msgsToAck.Clear(); return msgsAck; } diff --git a/src/Encryption.cs b/src/Encryption.cs index a7ede50..2069ef2 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -319,19 +319,12 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB } #if OBFUSCATION - internal class AesCtr : IDisposable + internal class AesCtr(byte[] key, byte[] ivec) : IDisposable { - readonly ICryptoTransform _encryptor; - readonly byte[] _ivec; + readonly ICryptoTransform _encryptor = AesECB.CreateEncryptor(key, null); readonly byte[] _ecount = new byte[16]; int _num; - public AesCtr(byte[] key, byte[] iv) - { - _encryptor = AesECB.CreateEncryptor(key, null); - _ivec = iv; - } - public void Dispose() => _encryptor.Dispose(); public void EncryptDecrypt(byte[] buffer, int length) @@ -340,9 +333,9 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { if (_num == 0) { - _encryptor.TransformBlock(_ivec, 0, 16, _ecount, 0); + _encryptor.TransformBlock(ivec, 0, 16, _ecount, 0); for (int n = 15; n >= 0; n--) // increment big-endian counter - if (++_ivec[n] != 0) break; + if (++ivec[n] != 0) break; } buffer[i] ^= _ecount[_num]; _num = (_num + 1) % 16; diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 9cc89cd..b022bda 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -80,7 +80,7 @@ namespace WTelegram } public void Dispose() { OnChanged?.Invoke(); storage?.Dispose(); sha256.Dispose(); sha1.Dispose(); } - public List Chats => chats.Values.ToList(); + public List Chats => [.. chats.Values]; public bool IsChatActive(int chat_id) => !(chats.GetValueOrDefault(chat_id)?.flags.HasFlag(SecretChat.Flags.requestChat) ?? true); diff --git a/src/Session.cs b/src/Session.cs index 950cad0..70c88ac 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -192,11 +192,9 @@ namespace WTelegram } } - internal class ActionStore : MemoryStream + internal class ActionStore(byte[] initial, Action save) : MemoryStream(initial ?? []) { - private readonly Action _save; - public ActionStore(byte[] initial, Action save) : base(initial ?? []) => _save = save; - public override void Write(byte[] buffer, int offset, int count) => _save(buffer[offset..(offset + count)]); + public override void Write(byte[] buffer, int offset, int count) => save(buffer[offset..(offset + count)]); public override void SetLength(long value) { } } } \ No newline at end of file diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 26986a0..a4baf3a 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -165,7 +165,7 @@ namespace TL if (lastBlockQuote is { length: -1 }) lastBlockQuote.length = sb.Length - lastBlockQuote.offset; text = sb.ToString(); - return entities.Count == 0 ? null : entities.ToArray(); + return entities.Count == 0 ? null : [.. entities]; } /// Converts the (plain text + entities) format used by Telegram messages into a Markdown text @@ -362,7 +362,7 @@ namespace TL offset++; } text = sb.ToString(); - return entities.Count == 0 ? null : entities.ToArray(); + return entities.Count == 0 ? null : [.. entities]; } /// Converts the (plain text + entities) format used by Telegram messages into an HTML-formatted text diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index f74311b..d113743 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -112,7 +112,7 @@ namespace TL file = inputFile; mime_type = mimeType; if (inputFile.Name is string filename && !attribs.Any(a => a is DocumentAttributeFilename)) - attributes = attribs.Append(new DocumentAttributeFilename { file_name = filename }).ToArray(); + attributes = [.. attribs, new DocumentAttributeFilename { file_name = filename }]; else attributes = attribs; } diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 5b7b7ac..b7d4632 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -11,9 +11,8 @@ using System.Threading.Tasks; namespace WTelegram { - class TlsStream : Helpers.IndirectStream + class TlsStream(Stream innerStream) : Helpers.IndirectStream(innerStream) { - public TlsStream(Stream innerStream) : base(innerStream) { } private int _tlsFrameleft; private readonly byte[] _tlsSendHeader = [0x17, 0x03, 0x03, 0, 0]; private readonly byte[] _tlsReadHeader = new byte[5]; From fd3bb731ba4b0260c9a9da8efe2d6a3cda703a45 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:19:44 +0100 Subject: [PATCH 174/336] API Layer 176: new Business features --- README.md | 2 +- src/TL.Schema.cs | 339 +++++++++++++++++++++++++++++- src/TL.SchemaFuncs.cs | 413 +++++++++++++++++++++++++++++++++++-- src/TL.Table.cs | 44 +++- src/WTelegramClient.csproj | 2 +- 5 files changed, 768 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 453c103..155f37f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-174-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-176-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 855998b..60f58b6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1670,7 +1670,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x1E4C8A69)] + [TLDef(0xA66C7EFC)] public partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1718,6 +1718,7 @@ namespace TL [IfFlag(22)] public RestrictionReason[] restriction_reason; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; + [IfFlag(30)] public int quick_reply_shortcut_id; [Flags] public enum Flags : uint { @@ -1777,6 +1778,8 @@ namespace TL has_saved_peer_id = 0x10000000, /// Field has a value has_from_boosts_applied = 0x20000000, + /// Field has a value + has_quick_reply_shortcut_id = 0x40000000, } /// ID of the message @@ -3195,11 +3198,12 @@ namespace TL } /// Extended user info See - [TLDef(0xB9B12C6C)] + [TLDef(0x22FF3E85)] public class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + public Flags2 flags2; /// User ID public long id; /// Bio of the user @@ -3238,6 +3242,10 @@ namespace TL [IfFlag(24)] public WallPaperBase wallpaper; /// Active stories » [IfFlag(25)] public PeerStories stories; + [IfFlag(32)] public BusinessWorkHours business_work_hours; + [IfFlag(33)] public BusinessLocation business_location; + [IfFlag(34)] public BusinessGreetingMessage business_greeting_message; + [IfFlag(35)] public BusinessAwayMessage business_away_message; [Flags] public enum Flags : uint { @@ -3296,6 +3304,18 @@ namespace TL contact_require_premium = 0x20000000, read_dates_private = 0x40000000, } + + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_business_work_hours = 0x1, + /// Field has a value + has_business_location = 0x2, + /// Field has a value + has_business_greeting_message = 0x4, + /// Field has a value + has_business_away_message = 0x8, + } } /// A contact of the current user that is registered in the system. See @@ -5145,6 +5165,42 @@ namespace TL /// See [TLDef(0x39C67432)] public class UpdateSavedReactionTags : Update { } + /// See + [TLDef(0xF16269D4)] + public class UpdateSmsJob : Update + { + public string job_id; + } + /// See + [TLDef(0xF9470AB2)] + public class UpdateQuickReplies : Update + { + public QuickReply[] quick_replies; + } + /// See + [TLDef(0xF53DA717)] + public class UpdateNewQuickReply : Update + { + public QuickReply quick_reply; + } + /// See + [TLDef(0x53E6F1EC)] + public class UpdateDeleteQuickReply : Update + { + public int shortcut_id; + } + /// See + [TLDef(0x3E050D0F)] + public class UpdateQuickReplyMessage : Update + { + public MessageBase message; + } + /// See + [TLDef(0x566FE7CD, inheritBefore = true)] + public class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply + { + public int[] messages; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -13043,13 +13099,14 @@ namespace TL public virtual string Title => default; /// Emoji to use as icon for the folder. public virtual string Emoticon => default; + public virtual int Color => default; /// Pinned chats, folders can have unlimited pinned chats public virtual InputPeer[] PinnedPeers => default; /// Include the following chats in this folder public virtual InputPeer[] IncludePeers => default; } /// Dialog filter AKA folder See - [TLDef(0x7438F7E8)] + [TLDef(0x5FB5523B)] public class DialogFilter : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13060,6 +13117,7 @@ namespace TL public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; + [IfFlag(27)] public int color; /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; /// Include the following chats in this folder @@ -13087,6 +13145,8 @@ namespace TL exclude_archived = 0x2000, /// Field has a value has_emoticon = 0x2000000, + /// Field has a value + has_color = 0x8000000, } /// Folder ID @@ -13095,13 +13155,14 @@ namespace TL public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; + public override int Color => color; /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; /// Include the following chats in this folder public override InputPeer[] IncludePeers => include_peers; } /// A folder imported using a chat folder deep link ». See - [TLDef(0xD64A04A8)] + [TLDef(0x9FE28EA4)] public class DialogFilterChatlist : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13112,6 +13173,7 @@ namespace TL public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; + [IfFlag(27)] public int color; /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; /// Chats to include in the folder @@ -13123,6 +13185,8 @@ namespace TL has_emoticon = 0x2000000, /// Whether the current user has created some chat folder deep links » to share the folder as well. has_my_invites = 0x4000000, + /// Field has a value + has_color = 0x8000000, } /// ID of the folder @@ -13131,6 +13195,7 @@ namespace TL public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; + public override int Color => color; /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; /// Chats to include in the folder @@ -16988,4 +17053,270 @@ namespace TL { public DateTime date; } + + /// See + public abstract class Smsjobs_EligibilityToJoin : IObject { } + /// See + [TLDef(0xDC8B44CF)] + public class Smsjobs_EligibleToJoin : Smsjobs_EligibilityToJoin + { + public string terms_url; + public int monthly_sent_sms; + } + + /// See + [TLDef(0x2AEE9191)] + public class Smsjobs_Status : IObject + { + public Flags flags; + public int recent_sent; + public int recent_since; + public int recent_remains; + public int total_sent; + public int total_since; + [IfFlag(1)] public string last_gift_slug; + public string terms_url; + + [Flags] public enum Flags : uint + { + allow_international = 0x1, + has_last_gift_slug = 0x2, + } + } + + /// See + [TLDef(0xE6A1EEB8)] + public class SmsJob : IObject + { + public string job_id; + public string phone_number; + public string text; + } + + /// See + [TLDef(0x120B1AB9)] + public class BusinessWeeklyOpen : IObject + { + public int start_minute; + public int end_minute; + } + + /// See + [TLDef(0x8C92B098)] + public class BusinessWorkHours : IObject + { + public Flags flags; + public string timezone_id; + public BusinessWeeklyOpen[] weekly_open; + + [Flags] public enum Flags : uint + { + open_now = 0x1, + } + } + + /// See + [TLDef(0xAC5C1AF7)] + public class BusinessLocation : IObject + { + public Flags flags; + [IfFlag(0)] public GeoPoint geo_point; + public string address; + + [Flags] public enum Flags : uint + { + has_geo_point = 0x1, + } + } + + /// See + [TLDef(0x6F8B32AA)] + public class InputBusinessRecipients : IObject + { + public Flags flags; + [IfFlag(4)] public InputUserBase[] users; + + [Flags] public enum Flags : uint + { + existing_chats = 0x1, + new_chats = 0x2, + contacts = 0x4, + non_contacts = 0x8, + has_users = 0x10, + exclude_selected = 0x20, + } + } + + /// See + [TLDef(0x21108FF7)] + public class BusinessRecipients : IObject + { + public Flags flags; + [IfFlag(4)] public long[] users; + + [Flags] public enum Flags : uint + { + existing_chats = 0x1, + new_chats = 0x2, + contacts = 0x4, + non_contacts = 0x8, + has_users = 0x10, + exclude_selected = 0x20, + } + } + + /// See + public abstract class BusinessAwayMessageSchedule : IObject { } + /// See + [TLDef(0xC9B9E2B9)] + public class BusinessAwayMessageScheduleAlways : BusinessAwayMessageSchedule { } + /// See + [TLDef(0xC3F2F501)] + public class BusinessAwayMessageScheduleOutsideWorkHours : BusinessAwayMessageSchedule { } + /// See + [TLDef(0xCC4D9ECC)] + public class BusinessAwayMessageScheduleCustom : BusinessAwayMessageSchedule + { + public DateTime start_date; + public DateTime end_date; + } + + /// See + [TLDef(0x0194CB3B)] + public class InputBusinessGreetingMessage : IObject + { + public int shortcut_id; + public InputBusinessRecipients recipients; + public int no_activity_days; + } + + /// See + [TLDef(0xE519ABAB)] + public class BusinessGreetingMessage : IObject + { + public int shortcut_id; + public BusinessRecipients recipients; + public int no_activity_days; + } + + /// See + [TLDef(0x832175E0)] + public class InputBusinessAwayMessage : IObject + { + public Flags flags; + public int shortcut_id; + public BusinessAwayMessageSchedule schedule; + public InputBusinessRecipients recipients; + + [Flags] public enum Flags : uint + { + offline_only = 0x1, + } + } + + /// See + [TLDef(0xEF156A5C)] + public class BusinessAwayMessage : IObject + { + public Flags flags; + public int shortcut_id; + public BusinessAwayMessageSchedule schedule; + public BusinessRecipients recipients; + + [Flags] public enum Flags : uint + { + offline_only = 0x1, + } + } + + /// See + [TLDef(0xFF9289F5)] + public class Timezone : IObject + { + public string id; + public string name; + public int utc_offset; + } + + /// See + /// a value means help.timezonesListNotModified + [TLDef(0x7B74ED71)] + public class Help_TimezonesList : IObject + { + public Timezone[] timezones; + public int hash; + } + + /// See + [TLDef(0x0697102B)] + public class QuickReply : IObject + { + public int shortcut_id; + public string shortcut; + public int top_message; + public int count; + } + + /// See + public abstract class InputQuickReplyShortcutBase : IObject { } + /// See + [TLDef(0x24596D41)] + public class InputQuickReplyShortcut : InputQuickReplyShortcutBase + { + public string shortcut; + } + /// See + [TLDef(0x01190CF1)] + public class InputQuickReplyShortcutId : InputQuickReplyShortcutBase + { + public int shortcut_id; + } + + /// See + /// a value means messages.quickRepliesNotModified + [TLDef(0xC68D6695)] + public class Messages_QuickReplies : IObject, IPeerResolver + { + public QuickReply[] quick_replies; + public MessageBase[] messages; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xE7E999E7)] + public class ConnectedBot : IObject + { + public Flags flags; + public long bot_id; + public BusinessRecipients recipients; + + [Flags] public enum Flags : uint + { + can_reply = 0x1, + } + } + + /// See + [TLDef(0x17D7F87B)] + public class Account_ConnectedBots : IObject + { + public ConnectedBot[] connected_bots; + public Dictionary users; + } + + /// See + [TLDef(0x2AD93719)] + public class Messages_DialogFilters : IObject + { + public Flags flags; + public DialogFilterBase[] filters; + + [Flags] public enum Flags : uint + { + tags_enabled = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index dbbc531..ad0376d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1194,6 +1194,54 @@ namespace TL hash = hash, }); + /// See + public static Task Account_UpdateBusinessWorkHours(this Client client, BusinessWorkHours business_work_hours = null) + => client.Invoke(new Account_UpdateBusinessWorkHours + { + flags = (Account_UpdateBusinessWorkHours.Flags)(business_work_hours != null ? 0x1 : 0), + business_work_hours = business_work_hours, + }); + + /// See + public static Task Account_UpdateBusinessLocation(this Client client, string address = null, InputGeoPoint geo_point = null) + => client.Invoke(new Account_UpdateBusinessLocation + { + flags = (Account_UpdateBusinessLocation.Flags)((address != null ? 0x1 : 0) | (geo_point != null ? 0x2 : 0)), + geo_point = geo_point, + address = address, + }); + + /// See + public static Task Account_UpdateBusinessGreetingMessage(this Client client, InputBusinessGreetingMessage message = null) + => client.Invoke(new Account_UpdateBusinessGreetingMessage + { + flags = (Account_UpdateBusinessGreetingMessage.Flags)(message != null ? 0x1 : 0), + message = message, + }); + + /// See + public static Task Account_UpdateBusinessAwayMessage(this Client client, InputBusinessAwayMessage message = null) + => client.Invoke(new Account_UpdateBusinessAwayMessage + { + flags = (Account_UpdateBusinessAwayMessage.Flags)(message != null ? 0x1 : 0), + message = message, + }); + + /// See + public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessRecipients recipients, bool can_reply = false, bool deleted = false) + => client.Invoke(new Account_UpdateConnectedBot + { + flags = (Account_UpdateConnectedBot.Flags)((can_reply ? 0x1 : 0) | (deleted ? 0x2 : 0)), + bot = bot, + recipients = recipients, + }); + + /// See + public static Task Account_GetConnectedBots(this Client client) + => client.Invoke(new Account_GetConnectedBots + { + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1626,10 +1674,10 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1638,6 +1686,7 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, + quick_reply_shortcut = quick_reply_shortcut, }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1656,10 +1705,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1669,6 +1718,7 @@ namespace TL entities = entities, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, + quick_reply_shortcut = quick_reply_shortcut, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1685,10 +1735,10 @@ namespace TL /// Destination forum topic /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1696,6 +1746,7 @@ namespace TL top_msg_id = top_msg_id.GetValueOrDefault(), schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, + quick_reply_shortcut = quick_reply_shortcut, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) @@ -2188,10 +2239,10 @@ namespace TL /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), peer = peer, reply_to = reply_to, random_id = random_id, @@ -2199,6 +2250,7 @@ namespace TL id = id, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, + quick_reply_shortcut = quick_reply_shortcut, }); /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) @@ -2221,10 +2273,10 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages - public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditMessage { - flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (quick_reply_shortcut_id != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, id = id, message = message, @@ -2232,6 +2284,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date.GetValueOrDefault(), + quick_reply_shortcut_id = quick_reply_shortcut_id.GetValueOrDefault(), }); /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) @@ -2624,15 +2677,16 @@ namespace TL /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, + quick_reply_shortcut = quick_reply_shortcut, }); /// Upload encrypted file and associate it to a secret chat See @@ -2911,7 +2965,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 { }); @@ -3875,6 +3929,76 @@ namespace TL msg_id = msg_id, }); + /// See + /// a null value means messages.quickRepliesNotModified + public static Task Messages_GetQuickReplies(this Client client, long hash = default) + => client.Invoke(new Messages_GetQuickReplies + { + hash = hash, + }); + + /// See + public static Task Messages_ReorderQuickReplies(this Client client, params int[] order) + => client.Invoke(new Messages_ReorderQuickReplies + { + order = order, + }); + + /// See + public static Task Messages_CheckQuickReplyShortcut(this Client client, string shortcut) + => client.Invoke(new Messages_CheckQuickReplyShortcut + { + shortcut = shortcut, + }); + + /// See + public static Task Messages_EditQuickReplyShortcut(this Client client, int shortcut_id, string shortcut) + => client.Invoke(new Messages_EditQuickReplyShortcut + { + shortcut_id = shortcut_id, + shortcut = shortcut, + }); + + /// See + public static Task Messages_DeleteQuickReplyShortcut(this Client client, int shortcut_id) + => client.Invoke(new Messages_DeleteQuickReplyShortcut + { + shortcut_id = shortcut_id, + }); + + /// 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
See
+ public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) + => client.Invoke(new Messages_GetQuickReplyMessages + { + flags = (Messages_GetQuickReplyMessages.Flags)(id != null ? 0x1 : 0), + shortcut_id = shortcut_id, + id = id, + hash = hash, + }); + + /// See + public static Task Messages_SendQuickReplyMessages(this Client client, InputPeer peer, int shortcut_id) + => client.Invoke(new Messages_SendQuickReplyMessages + { + peer = peer, + shortcut_id = shortcut_id, + }); + + /// 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
See
+ public static Task Messages_DeleteQuickReplyMessages(this Client client, int shortcut_id, params int[] id) + => client.Invoke(new Messages_DeleteQuickReplyMessages + { + shortcut_id = shortcut_id, + id = id, + }); + + /// See + public static Task Messages_ToggleDialogFilterTags(this Client client, bool enabled) + => client.Invoke(new Messages_ToggleDialogFilterTags + { + enabled = enabled, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4275,6 +4399,14 @@ namespace TL hash = hash, }); + /// See + /// a null value means help.timezonesListNotModified + public static Task Help_GetTimezonesList(this Client client, int hash = default) + => client.Invoke(new Help_GetTimezonesList + { + hash = hash, + }); + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read @@ -6328,6 +6460,53 @@ namespace TL peer = peer, user_id = user_id, }); + + /// See + public static Task Smsjobs_IsEligibleToJoin(this Client client) + => client.Invoke(new Smsjobs_IsEligibleToJoin + { + }); + + /// See + public static Task Smsjobs_Join(this Client client) + => client.Invoke(new Smsjobs_Join + { + }); + + /// See + public static Task Smsjobs_Leave(this Client client) + => client.Invoke(new Smsjobs_Leave + { + }); + + /// See + public static Task Smsjobs_UpdateSettings(this Client client, bool allow_international = false) + => client.Invoke(new Smsjobs_UpdateSettings + { + flags = (Smsjobs_UpdateSettings.Flags)(allow_international ? 0x1 : 0), + }); + + /// See + public static Task Smsjobs_GetStatus(this Client client) + => client.Invoke(new Smsjobs_GetStatus + { + }); + + /// See + public static Task Smsjobs_GetSmsJob(this Client client, string job_id) + => client.Invoke(new Smsjobs_GetSmsJob + { + job_id = job_id, + }); + + /// See + public static Task Smsjobs_FinishJob(this Client client, string job_id, string error = null) + => client.Invoke(new Smsjobs_FinishJob + { + flags = (Smsjobs_FinishJob.Flags)(error != null ? 0x1 : 0), + job_id = job_id, + error = error, + }); } } @@ -7250,6 +7429,73 @@ namespace TL.Methods public long hash; } + [TLDef(0x4B00E066)] + public class Account_UpdateBusinessWorkHours : IMethod + { + public Flags flags; + [IfFlag(0)] public BusinessWorkHours business_work_hours; + + [Flags] public enum Flags : uint + { + has_business_work_hours = 0x1, + } + } + + [TLDef(0x9E6B131A)] + public class Account_UpdateBusinessLocation : IMethod + { + public Flags flags; + [IfFlag(1)] public InputGeoPoint geo_point; + [IfFlag(0)] public string address; + + [Flags] public enum Flags : uint + { + has_address = 0x1, + has_geo_point = 0x2, + } + } + + [TLDef(0x66CDAFC4)] + public class Account_UpdateBusinessGreetingMessage : IMethod + { + public Flags flags; + [IfFlag(0)] public InputBusinessGreetingMessage message; + + [Flags] public enum Flags : uint + { + has_message = 0x1, + } + } + + [TLDef(0xA26A7FA5)] + public class Account_UpdateBusinessAwayMessage : IMethod + { + public Flags flags; + [IfFlag(0)] public InputBusinessAwayMessage message; + + [Flags] public enum Flags : uint + { + has_message = 0x1, + } + } + + [TLDef(0x9C2D527D)] + public class Account_UpdateConnectedBot : IMethod + { + public Flags flags; + public InputUserBase bot; + public InputBusinessRecipients recipients; + + [Flags] public enum Flags : uint + { + can_reply = 0x1, + deleted = 0x2, + } + } + + [TLDef(0x4EA4C80F)] + public class Account_GetConnectedBots : IMethod { } + [TLDef(0x0D91A548)] public class Users_GetUsers : IMethod { @@ -7604,7 +7850,7 @@ namespace TL.Methods } } - [TLDef(0x280D096F)] + [TLDef(0xDFF8042C)] public class Messages_SendMessage : IMethod { public Flags flags; @@ -7616,6 +7862,7 @@ namespace TL.Methods [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; + [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [Flags] public enum Flags : uint { @@ -7631,10 +7878,11 @@ namespace TL.Methods noforwards = 0x4000, update_stickersets_order = 0x8000, invert_media = 0x10000, + has_quick_reply_shortcut = 0x20000, } } - [TLDef(0x72CCC23D)] + [TLDef(0x7BD66041)] public class Messages_SendMedia : IMethod { public Flags flags; @@ -7647,6 +7895,7 @@ namespace TL.Methods [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; + [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [Flags] public enum Flags : uint { @@ -7661,10 +7910,11 @@ namespace TL.Methods noforwards = 0x4000, update_stickersets_order = 0x8000, invert_media = 0x10000, + has_quick_reply_shortcut = 0x20000, } } - [TLDef(0xC661BBC4)] + [TLDef(0xD5039208)] public class Messages_ForwardMessages : IMethod { public Flags flags; @@ -7675,6 +7925,7 @@ namespace TL.Methods [IfFlag(9)] public int top_msg_id; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; + [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [Flags] public enum Flags : uint { @@ -7687,6 +7938,7 @@ namespace TL.Methods drop_media_captions = 0x1000, has_send_as = 0x2000, noforwards = 0x4000, + has_quick_reply_shortcut = 0x20000, } } @@ -8075,7 +8327,7 @@ namespace TL.Methods } } - [TLDef(0xF7BC68BA)] + [TLDef(0x3EBEE86A)] public class Messages_SendInlineBotResult : IMethod { public Flags flags; @@ -8086,6 +8338,7 @@ namespace TL.Methods public string id; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; + [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [Flags] public enum Flags : uint { @@ -8096,6 +8349,7 @@ namespace TL.Methods has_schedule_date = 0x400, hide_via = 0x800, has_send_as = 0x2000, + has_quick_reply_shortcut = 0x20000, } } @@ -8106,7 +8360,7 @@ namespace TL.Methods public int id; } - [TLDef(0x48F71778)] + [TLDef(0xDFD14005)] public class Messages_EditMessage : IMethod { public Flags flags; @@ -8117,6 +8371,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(15)] public DateTime schedule_date; + [IfFlag(17)] public int quick_reply_shortcut_id; [Flags] public enum Flags : uint { @@ -8127,6 +8382,7 @@ namespace TL.Methods has_media = 0x4000, has_schedule_date = 0x8000, invert_media = 0x10000, + has_quick_reply_shortcut_id = 0x20000, } } @@ -8476,7 +8732,7 @@ namespace TL.Methods public long hash; } - [TLDef(0x456E8987)] + [TLDef(0x0C964709)] public class Messages_SendMultiMedia : IMethod { public Flags flags; @@ -8485,6 +8741,7 @@ namespace TL.Methods public InputSingleMedia[] multi_media; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; + [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [Flags] public enum Flags : uint { @@ -8497,6 +8754,7 @@ namespace TL.Methods noforwards = 0x4000, update_stickersets_order = 0x8000, invert_media = 0x10000, + has_quick_reply_shortcut = 0x20000, } } @@ -8730,8 +8988,8 @@ namespace TL.Methods } } - [TLDef(0xF19ED96D)] - public class Messages_GetDialogFilters : IMethod { } + [TLDef(0xEFD48C89)] + public class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] public class Messages_GetSuggestedDialogFilters : IMethod { } @@ -9543,6 +9801,71 @@ namespace TL.Methods public int msg_id; } + [TLDef(0xD483F2A8)] + public class Messages_GetQuickReplies : IMethod + { + public long hash; + } + + [TLDef(0x60331907)] + public class Messages_ReorderQuickReplies : IMethod + { + public int[] order; + } + + [TLDef(0xF1D0FBD3)] + public class Messages_CheckQuickReplyShortcut : IMethod + { + public string shortcut; + } + + [TLDef(0x5C003CEF)] + public class Messages_EditQuickReplyShortcut : IMethod + { + public int shortcut_id; + public string shortcut; + } + + [TLDef(0x3CC04740)] + public class Messages_DeleteQuickReplyShortcut : IMethod + { + public int shortcut_id; + } + + [TLDef(0x94A495C3)] + public class Messages_GetQuickReplyMessages : IMethod + { + public Flags flags; + public int shortcut_id; + [IfFlag(0)] public int[] id; + public long hash; + + [Flags] public enum Flags : uint + { + has_id = 0x1, + } + } + + [TLDef(0x33153AD4)] + public class Messages_SendQuickReplyMessages : IMethod + { + public InputPeer peer; + public int shortcut_id; + } + + [TLDef(0xE105E910)] + public class Messages_DeleteQuickReplyMessages : IMethod + { + public int shortcut_id; + public int[] id; + } + + [TLDef(0xFD2DDA49)] + public class Messages_ToggleDialogFilterTags : IMethod + { + public bool enabled; + } + [TLDef(0xEDD4882A)] public class Updates_GetState : IMethod { } @@ -9842,6 +10165,12 @@ namespace TL.Methods public int hash; } + [TLDef(0x49B30240)] + public class Help_GetTimezonesList : IMethod + { + public int hash; + } + [TLDef(0xCC104937)] public class Channels_ReadHistory : IMethod { @@ -11507,4 +11836,46 @@ namespace TL.Methods public InputPeer peer; public InputUserBase user_id; } + + [TLDef(0x0EDC39D0)] + public class Smsjobs_IsEligibleToJoin : IMethod { } + + [TLDef(0xA74ECE2D)] + public class Smsjobs_Join : IMethod { } + + [TLDef(0x9898AD73)] + public class Smsjobs_Leave : IMethod { } + + [TLDef(0x093FA0BF)] + public class Smsjobs_UpdateSettings : IMethod + { + public Flags flags; + + [Flags] public enum Flags : uint + { + allow_international = 0x1, + } + } + + [TLDef(0x10A698E8)] + public class Smsjobs_GetStatus : IMethod { } + + [TLDef(0x778D902F)] + public class Smsjobs_GetSmsJob : IMethod + { + public string job_id; + } + + [TLDef(0x4F1EBF24)] + public class Smsjobs_FinishJob : IMethod + { + public Flags flags; + public string job_id; + [IfFlag(0)] public string error; + + [Flags] public enum Flags : uint + { + has_error = 0x1, + } + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6f7bf7b..ed185a2 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 = 174; // fetched 18/02/2024 15:53:49 + public const int Version = 176; // fetched 08/03/2024 11:12:00 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,7 +145,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x1E4C8A69] = typeof(Message), + [0xA66C7EFC] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -232,7 +232,7 @@ namespace TL [0xA518110D] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xB9B12C6C] = typeof(UserFull), + [0x22FF3E85] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -394,6 +394,12 @@ namespace TL [0xAEAF9E74] = typeof(UpdateSavedDialogPinned), [0x686C85A6] = typeof(UpdatePinnedSavedDialogs), [0x39C67432] = typeof(UpdateSavedReactionTags), + [0xF16269D4] = typeof(UpdateSmsJob), + [0xF9470AB2] = typeof(UpdateQuickReplies), + [0xF53DA717] = typeof(UpdateNewQuickReply), + [0x53E6F1EC] = typeof(UpdateDeleteQuickReply), + [0x3E050D0F] = typeof(UpdateQuickReplyMessage), + [0x566FE7CD] = typeof(UpdateDeleteQuickReplyMessages), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -945,9 +951,9 @@ namespace TL [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), - [0x7438F7E8] = typeof(DialogFilter), + [0x5FB5523B] = typeof(DialogFilter), [0x363293AE] = null,//DialogFilterDefault - [0xD64A04A8] = typeof(DialogFilterChatlist), + [0x9FE28EA4] = typeof(DialogFilterChatlist), [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -1191,6 +1197,32 @@ namespace TL [0x889B59EF] = null,//Messages_SavedReactionTagsNotModified [0x3259950A] = typeof(Messages_SavedReactionTags), [0x3BB842AC] = typeof(OutboxReadDate), + [0xDC8B44CF] = typeof(Smsjobs_EligibleToJoin), + [0x2AEE9191] = typeof(Smsjobs_Status), + [0xE6A1EEB8] = typeof(SmsJob), + [0x120B1AB9] = typeof(BusinessWeeklyOpen), + [0x8C92B098] = typeof(BusinessWorkHours), + [0xAC5C1AF7] = typeof(BusinessLocation), + [0x6F8B32AA] = typeof(InputBusinessRecipients), + [0x21108FF7] = typeof(BusinessRecipients), + [0xC9B9E2B9] = typeof(BusinessAwayMessageScheduleAlways), + [0xC3F2F501] = typeof(BusinessAwayMessageScheduleOutsideWorkHours), + [0xCC4D9ECC] = typeof(BusinessAwayMessageScheduleCustom), + [0x0194CB3B] = typeof(InputBusinessGreetingMessage), + [0xE519ABAB] = typeof(BusinessGreetingMessage), + [0x832175E0] = typeof(InputBusinessAwayMessage), + [0xEF156A5C] = typeof(BusinessAwayMessage), + [0xFF9289F5] = typeof(Timezone), + [0x970708CC] = null,//Help_TimezonesListNotModified + [0x7B74ED71] = typeof(Help_TimezonesList), + [0x0697102B] = typeof(QuickReply), + [0x24596D41] = typeof(InputQuickReplyShortcut), + [0x01190CF1] = typeof(InputQuickReplyShortcutId), + [0xC68D6695] = typeof(Messages_QuickReplies), + [0x5F91EB5B] = null,//Messages_QuickRepliesNotModified + [0xE7E999E7] = typeof(ConnectedBot), + [0x17D7F87B] = typeof(Account_ConnectedBots), + [0x2AD93719] = typeof(Messages_DialogFilters), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), @@ -1315,6 +1347,8 @@ namespace TL [typeof(BotApp)] = 0x5DA674B7, //botAppNotModified [typeof(Help_PeerColors)] = 0x2BA1F5CE, //help.peerColorsNotModified [typeof(Messages_SavedReactionTags)] = 0x889B59EF, //messages.savedReactionTagsNotModified + [typeof(Help_TimezonesList)] = 0x970708CC, //help.timezonesListNotModified + [typeof(Messages_QuickReplies)] = 0x5F91EB5B, //messages.quickRepliesNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index bead803..25acdfb 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: 174 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 176 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient From 0738adc3bfba0335f7c3a599b98396d04bf95374 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 8 Mar 2024 12:22:52 +0100 Subject: [PATCH 175/336] releasing 3.7.x --- .github/dev.yml | 2 +- .github/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 807cf43..7b6b9f6 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.6.7-dev.$(Rev:r) +name: 3.7.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 540de46..c9cfd5a 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.6.$(Rev:r) +name: 3.7.$(Rev:r) pool: vmImage: ubuntu-latest From d00725e234c038df5412540a690f6abfb5a2abe6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 12 Mar 2024 19:07:48 +0100 Subject: [PATCH 176/336] use primary constructors --- .github/dev.yml | 2 +- src/Client.cs | 2 +- src/Helpers.cs | 5 ++--- src/TL.Extensions.cs | 2 +- src/TL.cs | 26 +++++++++++--------------- 5 files changed, 16 insertions(+), 21 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7b6b9f6..7ca15b3 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.7.1-dev.$(Rev:r) +name: 3.7.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index cd808eb..3f568f4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -815,7 +815,7 @@ namespace WTelegram _paddedMode = true; secret = secret[1..17]; } - else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret", nameof(secret)); + else if (secret.Length != 16) throw new ArgumentException("Invalid/unsupported secret"); Helpers.Log(2, $"Connecting to DC {dcId} via MTProxy {server}:{port}..."); _tcpClient = await TcpHandler(server, port); _networkStream = _tcpClient.GetStream(); diff --git a/src/Helpers.cs b/src/Helpers.cs index decf66c..f1569c0 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -235,11 +235,10 @@ namespace WTelegram internal static string GetAppVersion() => (Assembly.GetEntryAssembly() ?? Array.Find(AppDomain.CurrentDomain.GetAssemblies(), a => a.EntryPoint != null))?.GetName().Version.ToString() ?? "0.0"; - public class IndirectStream : Stream + public class IndirectStream(Stream innerStream) : Stream { - public IndirectStream(Stream innerStream) => _innerStream = innerStream; public long? ContentLength; - protected readonly Stream _innerStream; + protected readonly Stream _innerStream = innerStream; public override bool CanRead => _innerStream.CanRead; public override bool CanSeek => ContentLength.HasValue || _innerStream.CanSeek; public override bool CanWrite => _innerStream.CanWrite; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index a4baf3a..15ce256 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -11,7 +11,7 @@ namespace TL { public static class Extensions { - private class CollectorPeer : Peer + internal class CollectorPeer : Peer { public override long ID => 0; internal IDictionary _users; diff --git a/src/TL.cs b/src/TL.cs index 77e8087..d3872a1 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -16,26 +16,23 @@ namespace TL public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } [AttributeUsage(AttributeTargets.Class)] - public class TLDefAttribute : Attribute + public class TLDefAttribute(uint ctorNb) : Attribute { - public readonly uint CtorNb; - public TLDefAttribute(uint ctorNb) => CtorNb = ctorNb; + public readonly uint CtorNb = ctorNb; public bool inheritBefore; } [AttributeUsage(AttributeTargets.Field)] - public class IfFlagAttribute : Attribute + public class IfFlagAttribute(int bit) : Attribute { - public readonly int Bit; - public IfFlagAttribute(int bit) => Bit = bit; + public readonly int Bit = bit; } - public class RpcException : WTelegram.WTException + public class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) { - public readonly int Code; + public readonly int Code = code; /// The value of X in the message, -1 if no variable X was found - public readonly int X; - public RpcException(int code, string message, int x = -1) : base(message) { Code = code; X = x; } + public readonly int X = x; public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } } @@ -372,13 +369,12 @@ namespace TL } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public class _Message : IObject + public class _Message(long msgId, int seqNo, IObject obj) : IObject { - public _Message(long msgId, int seqNo, IObject obj) { msg_id = msgId; seq_no = seqNo; body = obj; } - public long msg_id; - public int seq_no; + public long msg_id = msgId; + public int seq_no = seqNo; public int bytes; - public IObject body; + public IObject body = obj; } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer From 659906ce019e8a275a9af798bc30160349bb812a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 13 Mar 2024 05:03:15 +0100 Subject: [PATCH 177/336] CollectUsersChats update user/chat fields from min info --- src/Client.cs | 8 +++++--- src/TL.Extensions.cs | 40 +++++++++++++++++++++++++++++++++++++++- 2 files changed, 44 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 3f568f4..2f502d0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1079,6 +1079,7 @@ namespace WTelegram self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; + RaiseUpdate(self); return User = self; } var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number"; @@ -1242,11 +1243,12 @@ namespace WTelegram [EditorBrowsable(EditorBrowsableState.Never)] public User LoginAlreadyDone(Auth_AuthorizationBase authorization) { - if (authorization is not Auth_Authorization { user: User user }) + if (authorization is not Auth_Authorization { user: User self }) throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); - _session.UserId = _dcSession.UserId = user.id; + _session.UserId = _dcSession.UserId = self.id; lock (_session) _session.Save(); - return User = user; + RaiseUpdate(self); + return User = self; } private MsgsAck CheckMsgsToAck() diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 15ce256..f3d4685 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -24,13 +24,51 @@ namespace TL if (user != null) if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) _users[user.id] = user; + else + { + const User.Flags good_min_flags = (User.Flags)0x55A2201E; + const User.Flags2 good_min_flags2 = (User.Flags2)0x701; + prevUser.flags = (prevUser.flags & ~good_min_flags) | (user.flags & good_min_flags); + prevUser.flags2 = (prevUser.flags2 & ~good_min_flags2) | (user.flags2 & good_min_flags2); + prevUser.first_name = user.first_name; + prevUser.last_name = user.last_name; + prevUser.username = user.username; + prevUser.phone = user.phone; + if (prevUser.flags.HasFlag(User.Flags.apply_min_photo) && user.phone != null) + { + prevUser.photo = user.photo; + prevUser.flags |= User.Flags.has_photo; + } + prevUser.emoji_status = user.emoji_status; + prevUser.usernames = user.usernames; + prevUser.color = user.color; + prevUser.profile_color = user.profile_color; + _users[user.id] = prevUser; + } if (_chats != null) lock (_chats) foreach (var kvp in chats) if (kvp.Value is not Channel channel) _chats[kvp.Key] = kvp.Value; - else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) + else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(kvp.Key, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) _chats[kvp.Key] = channel; + else + { + const Channel.Flags good_min_flags = (Channel.Flags)0x7FDC09E0; + const Channel.Flags2 good_min_flags2 = (Channel.Flags2)0x781; + prevChannel.flags = (prevChannel.flags & ~good_min_flags) | (channel.flags & good_min_flags); + prevChannel.flags2 = (prevChannel.flags2 & ~good_min_flags2) | (channel.flags2 & good_min_flags2); + prevChannel.title = channel.title; + prevChannel.username = channel.username; + prevChannel.photo = channel.photo; + prevChannel.default_banned_rights = channel.default_banned_rights; + prevChannel.usernames = channel.usernames; + prevChannel.color = channel.color; + prevChannel.profile_color = channel.profile_color; + prevChannel.emoji_status = channel.emoji_status; + prevChannel.level = channel.level; + _chats[kvp.Key] = prevChannel; + } return null; } } From 1d00dc2f9b03058b2c329cbb561dddb5b62ccf0b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:48:45 +0100 Subject: [PATCH 178/336] minor change --- src/Client.Helpers.cs | 2 +- src/Client.cs | 2 +- src/Encryption.cs | 6 +++--- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 6b3c762..04be756 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -157,7 +157,6 @@ namespace WTelegram else updates = await this.Messages_SendMedia(peer, media, text, random_id, entities: entities, reply_to: reply_to_msg_id == 0 ? null : new InputReplyToMessage { reply_to_msg_id = reply_to_msg_id }, schedule_date: schedule_date == default ? null : schedule_date); - int msgId = -1; if (updates is UpdateShortSentMessage sent) return new Message { @@ -167,6 +166,7 @@ namespace WTelegram from_id = peer is InputPeerSelf ? null : new PeerUser { user_id = _session.UserId }, peer_id = InputToPeer(peer) }; + int msgId = -1; foreach (var update in updates.UpdateList) { switch (update) diff --git a/src/Client.cs b/src/Client.cs index 2f502d0..b838178 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -53,7 +53,7 @@ namespace WTelegram public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); /// ID of the current logged-in user or 0 public long UserId => _session.UserId; - /// Info about the current logged-in user. This is filled after a successful (re)login + /// Info about the current logged-in user. This is only filled after a successful (re)login, not updated later public User User { get; private set; } private Func _config; diff --git a/src/Encryption.cs b/src/Encryption.cs index 2069ef2..d88a260 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -209,8 +209,8 @@ namespace WTelegram SafePrimes.Add(p); } - private static readonly HashSet SafePrimes = [ new(new byte[] // C71CAEB9C6B1C904... - { + private static readonly HashSet SafePrimes = [ new( // C71CAEB9C6B1C904... + [ 0x5B, 0xCC, 0x2F, 0xB9, 0xE3, 0xD8, 0x9C, 0x11, 0x03, 0x04, 0xB1, 0x34, 0xF0, 0xAD, 0x4F, 0x6F, 0xBF, 0x54, 0x24, 0x4B, 0xD0, 0x15, 0x4E, 0x2E, 0xEE, 0x05, 0xB1, 0x35, 0xF6, 0x15, 0x81, 0x0D, 0x1F, 0x85, 0x29, 0xE9, 0x0C, 0x85, 0x56, 0xD9, 0x59, 0xF9, 0x7B, 0xF4, 0x49, 0x28, 0xED, 0x0D, @@ -227,7 +227,7 @@ namespace WTelegram 0xDB, 0xF4, 0x30, 0x25, 0xD2, 0x93, 0x94, 0x22, 0x58, 0x40, 0xC1, 0xA7, 0x0A, 0x8A, 0x19, 0x48, 0x0F, 0x93, 0x3D, 0x56, 0x37, 0xD0, 0x34, 0x49, 0xC1, 0x21, 0x3E, 0x8E, 0x23, 0x40, 0x0D, 0x98, 0x73, 0x3F, 0xF1, 0x70, 0x2F, 0x52, 0x6C, 0x8E, 0x04, 0xC9, 0xB1, 0xC6, 0xB9, 0xAE, 0x1C, 0xC7, 0x00 - })]; + ])]; internal static void CheckGoodGaAndGb(BigInteger g, BigInteger dh_prime) { From fa83787e7f56cf69e13751c69a1d9497ae5e4161 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 19 Mar 2024 11:50:58 +0100 Subject: [PATCH 179/336] CollectUsersChats update user/chat fields from min info (improved) --- src/Client.cs | 1 + src/TL.Extensions.cs | 75 +++++++++++++++++++++++++++----------------- 2 files changed, 47 insertions(+), 29 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index b838178..3fce710 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1041,6 +1041,7 @@ namespace WTelegram if (self.id == long.Parse(botToken.Split(':')[0])) { _session.UserId = _dcSession.UserId = self.id; + RaiseUpdate(self); return User = self; } Helpers.Log(3, $"Current logged user {self.id} mismatched bot_token. Logging out and in..."); diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index f3d4685..1cc5a95 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -25,24 +25,35 @@ namespace TL if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) _users[user.id] = user; else - { - const User.Flags good_min_flags = (User.Flags)0x55A2201E; - const User.Flags2 good_min_flags2 = (User.Flags2)0x701; - prevUser.flags = (prevUser.flags & ~good_min_flags) | (user.flags & good_min_flags); - prevUser.flags2 = (prevUser.flags2 & ~good_min_flags2) | (user.flags2 & good_min_flags2); - prevUser.first_name = user.first_name; - prevUser.last_name = user.last_name; - prevUser.username = user.username; - prevUser.phone = user.phone; - if (prevUser.flags.HasFlag(User.Flags.apply_min_photo) && user.phone != null) + { // update previously full user from min user: + const User.Flags updated_flags = (User.Flags)0x5DAFE000; + const User.Flags2 updated_flags2 = (User.Flags2)0x711; + // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo + // | support | scam | fake | bot_attach_menu | premium + // tdesktop non-updated flags: bot | bot_chat_history | bot_nochats | bot_attach_menu + // updated flags2: stories_unavailable (tdlib) | contact_require_premium (tdesktop) + prevUser.flags = (prevUser.flags & ~updated_flags) | (user.flags & updated_flags); + prevUser.flags2 = (prevUser.flags2 & ~updated_flags2) | (user.flags2 & updated_flags2); + prevUser.first_name ??= user.first_name; // tdlib: not updated ; tdesktop: updated only if unknown + prevUser.last_name ??= user.last_name; // tdlib: not updated ; tdesktop: updated only if unknown + //prevUser.username ??= user.username; // tdlib/tdesktop: not updated + prevUser.phone ??= user.phone; // tdlib: updated only if unknown ; tdesktop: not updated + if (prevUser.flags.HasFlag(User.Flags.apply_min_photo) && user.photo != null) { - prevUser.photo = user.photo; + prevUser.photo = user.photo; // tdlib/tdesktop: updated on apply_min_photo prevUser.flags |= User.Flags.has_photo; } - prevUser.emoji_status = user.emoji_status; - prevUser.usernames = user.usernames; - prevUser.color = user.color; - prevUser.profile_color = user.profile_color; + prevUser.bot_info_version = user.bot_info_version; // tdlib: updated ; tdesktop: not updated + prevUser.restriction_reason = user.restriction_reason; // tdlib: updated ; tdesktop: not updated + prevUser.bot_inline_placeholder = user.bot_inline_placeholder;// tdlib: updated ; tdesktop: ignored + if (user.lang_code != null) + prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored + prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated + prevUser.usernames = user.usernames; // tdlib: not updated ; tdesktop: updated + if (user.stories_max_id > 0) + prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated + prevUser.color = user.color; // tdlib/tdesktop: updated + prevUser.profile_color = user.profile_color; // tdlib/tdesktop: unimplemented yet _users[user.id] = prevUser; } if (_chats != null) @@ -53,20 +64,26 @@ namespace TL else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(kvp.Key, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) _chats[kvp.Key] = channel; else - { - const Channel.Flags good_min_flags = (Channel.Flags)0x7FDC09E0; - const Channel.Flags2 good_min_flags2 = (Channel.Flags2)0x781; - prevChannel.flags = (prevChannel.flags & ~good_min_flags) | (channel.flags & good_min_flags); - prevChannel.flags2 = (prevChannel.flags2 & ~good_min_flags2) | (channel.flags2 & good_min_flags2); - prevChannel.title = channel.title; - prevChannel.username = channel.username; - prevChannel.photo = channel.photo; - prevChannel.default_banned_rights = channel.default_banned_rights; - prevChannel.usernames = channel.usernames; - prevChannel.color = channel.color; - prevChannel.profile_color = channel.profile_color; - prevChannel.emoji_status = channel.emoji_status; - prevChannel.level = channel.level; + { // update previously full channel from min channel: + const Channel.Flags updated_flags = (Channel.Flags)0x7FDC0BE0; + const Channel.Flags2 updated_flags2 = (Channel.Flags2)0x781; + // tdesktop updated flags: broadcast | verified | megagroup | signatures | scam | has_link | slowmode_enabled + // | call_active | call_not_empty | fake | gigagroup | noforwards | join_to_send | join_request | forum + // tdlib nonupdated flags: broadcast | signatures | call_active | call_not_empty | noforwards + prevChannel.flags = (prevChannel.flags & ~updated_flags) | (channel.flags & updated_flags); + prevChannel.flags2 = (prevChannel.flags2 & ~updated_flags2) | (channel.flags2 & updated_flags2); + prevChannel.title = channel.title; // tdlib/tdesktop: updated + prevChannel.username = channel.username; // tdlib/tdesktop: updated + prevChannel.photo = channel.photo; // tdlib: updated if not banned ; tdesktop: updated + prevChannel.restriction_reason = channel.restriction_reason; // tdlib: updated ; tdesktop: not updated + prevChannel.default_banned_rights = channel.default_banned_rights; // tdlib/tdesktop: updated + if (channel.participants_count > 0) + prevChannel.participants_count = channel.participants_count; // tdlib/tdesktop: updated if present + prevChannel.usernames = channel.usernames; // tdlib/tdesktop: updated + prevChannel.color = channel.color; // tdlib: not updated ; tdesktop: updated + prevChannel.profile_color = channel.profile_color; // tdlib/tdesktop: ignored + prevChannel.emoji_status = channel.emoji_status; // tdlib: not updated ; tdesktop: updated + prevChannel.level = channel.level; // tdlib: not updated ; tdesktop: updated _chats[kvp.Key] = prevChannel; } return null; From 39760f9306d93d4b7b7ac6b11fe8fa100c2c2e74 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Mar 2024 17:43:28 +0100 Subject: [PATCH 180/336] using [] syntax --- src/SecretChats.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/SecretChats.cs b/src/SecretChats.cs index b022bda..3898b8c 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -383,7 +383,7 @@ namespace WTelegram if (((dml.out_seq_no ^ dml.in_seq_no) & 1) != 1 || ((dml.out_seq_no ^ chat.in_seq_no) & 1) != 0) throw new WTException("Invalid seq_no parities"); if (dml.layer > chat.remoteLayer) chat.remoteLayer = dml.layer; //Debug.WriteLine($"<\t{dml.in_seq_no}\t{dml.out_seq_no}\t\t\t\t\t\texpected:{chat.out_seq_no}/{chat.in_seq_no + 2}"); - if (dml.out_seq_no <= chat.in_seq_no) return Array.Empty(); // already received message + if (dml.out_seq_no <= chat.in_seq_no) return []; // already received message var pendingMsgSeqNo = chat.pendingMsgs.Keys; if (fillGaps && dml.out_seq_no > chat.in_seq_no + 2) { @@ -393,12 +393,12 @@ namespace WTelegram if (dml.out_seq_no > lastPending + 2) // send request to resend missing gap asynchronously _ = SendMessage(chat.ChatId, new TL.Layer23.DecryptedMessageService { random_id = Helpers.RandomLong(), action = new TL.Layer23.DecryptedMessageActionResend { start_seq_no = lastPending + 2, end_seq_no = dml.out_seq_no - 2 } }); - return Array.Empty(); + return []; } chat.in_seq_no = dml.out_seq_no; if (pendingMsgSeqNo.Count == 0 || pendingMsgSeqNo[0] != dml.out_seq_no + 2) - if (HandleAction(chat, dml.message.Action)) return Array.Empty(); - else return new[] { dml.message }; + if (HandleAction(chat, dml.message.Action)) return []; + else return [dml.message]; else // we have pendingMsgs completing the sequence in order { var list = new List(); From 3304ba4bacd1badd7a46abc3b1123acfe5a006f2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Mar 2024 17:51:00 +0100 Subject: [PATCH 181/336] raise event for Pong and Affected* --- src/Client.cs | 10 +++++++--- src/TL.Helpers.cs | 4 ++++ src/TL.cs | 6 ++++++ 3 files changed, 17 insertions(+), 3 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 3fce710..2fe549e 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -578,8 +578,11 @@ namespace WTelegram else { Helpers.Log(1, $" → {result?.GetType().Name,-37} #{(short)msgId.GetHashCode():X4}"); - if (OnOwnUpdate != null && result is UpdatesBase updates) - RaiseOwnUpdate(updates); + if (OnOwnUpdate != null) + if (result is UpdatesBase updates) + RaiseOwnUpdate(updates); + else if (result is Messages_AffectedMessages affected) + RaiseOwnUpdate(new UpdateShort { update = new UpdateAffectedMessages { affected = affected }, date = MsgIdToStamp(_lastRecvMsgId) }); } rpc.tcs.SetResult(result); @@ -665,6 +668,7 @@ namespace WTelegram break; case Pong pong: SetResult(pong.msg_id, pong); + RaiseUpdate(pong); break; case FutureSalts futureSalts: SetResult(futureSalts.req_msg_id, futureSalts); @@ -724,7 +728,7 @@ namespace WTelegram rpc.tcs.SetException(new WTException($"BadMsgNotification {badMsgNotification.error_code}")); } else - RaiseUpdate(obj); + RaiseUpdate(badMsgNotification); break; default: RaiseUpdate(obj); diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index d113743..4755b21 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -577,6 +577,7 @@ namespace TL public abstract Update[] OtherUpdates { get; } public abstract bool Final { get; } public abstract int Timeout { get; } + public abstract int Pts { get; } } partial class Updates_ChannelDifferenceEmpty { @@ -584,6 +585,7 @@ namespace TL public override Update[] OtherUpdates => []; public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; + public override int Pts => pts; } partial class Updates_ChannelDifference { @@ -591,6 +593,7 @@ namespace TL public override Update[] OtherUpdates => other_updates; public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; + public override int Pts => pts; } partial class Updates_ChannelDifferenceTooLong { @@ -598,6 +601,7 @@ namespace TL public override Update[] OtherUpdates => null; public override bool Final => flags.HasFlag(Flags.final); public override int Timeout => timeout; + public override int Pts => dialog is Dialog d ? d.pts : 0; } partial class ChannelParticipantBase diff --git a/src/TL.cs b/src/TL.cs index d3872a1..d8e79da 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -352,6 +352,12 @@ namespace TL public static implicit operator byte[](Int256 int256) => int256.raw; } + public class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdate in case of such API call result + { + public Messages_AffectedMessages affected; + public override (long, int, int) GetMBox() => (0, affected.pts, affected.pts_count); + } + // Below TL types are commented "parsed manually" from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/tl/mtproto.tl [TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey From 018f53565538e49f2c6dca6f944eb94cf199214e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 23 Mar 2024 17:58:46 +0100 Subject: [PATCH 182/336] Fix "wrong timestamp" issues when first msgId is too much in the past --- src/Client.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 2fe549e..9fa42bb 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -76,6 +76,7 @@ namespace WTelegram private CancellationTokenSource _cts; private int _reactorReconnects = 0; private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; + private const long Ticks5Secs = 5 * TimeSpan.TicksPerSecond; private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256Recv = SHA256.Create(); @@ -440,7 +441,12 @@ namespace WTelegram if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - utcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); - + long deltaTicks = (msgStamp - utcNow).Ticks; + if (deltaTicks is > 0) + if (deltaTicks < Ticks5Secs) // resync if next message is less than 5 seconds in the future + _dcSession.ServerTicksOffset += deltaTicks; + else if (_dcSession.ServerTicksOffset < -Ticks5Secs && deltaTicks + _dcSession.ServerTicksOffset < 0) + _dcSession.ServerTicksOffset += deltaTicks; if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.OldSalt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) { Helpers.Log(3, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); @@ -453,7 +459,7 @@ namespace WTelegram if ((seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msgId); var ctorNb = reader.ReadUInt32(); - if (ctorNb != Layer.BadMsgCtor && (msgStamp - utcNow).Ticks / TimeSpan.TicksPerSecond is > 30 or < -300) + if (ctorNb != Layer.BadMsgCtor && deltaTicks / TimeSpan.TicksPerSecond is > 30 or < -300) { // msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored. Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.ServerTicksOffset):c}"); return null; From 9fe11966066f76f7bddab7666eafb5b9f11c4900 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 26 Mar 2024 02:30:16 +0100 Subject: [PATCH 183/336] Mark most classes as sealed & partial --- .github/dev.yml | 2 +- .github/release.yml | 2 +- .gitignore | 2 + src/Client.cs | 2 +- src/Encryption.cs | 4 +- src/SecretChats.cs | 2 +- src/Session.cs | 8 +- src/TL.Extensions.cs | 2 +- src/TL.MTProto.cs | 106 +- src/TL.Schema.cs | 2398 ++++++++++++++++++++--------------------- src/TL.SchemaFuncs.cs | 1198 ++++++++++---------- src/TL.Secret.cs | 110 +- src/TL.Table.cs | 5 +- src/TL.cs | 22 +- src/TlsStream.cs | 2 +- 15 files changed, 1933 insertions(+), 1932 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7ca15b3..c9a88ef 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 3.7.2-dev.$(Rev:r) +name: 4.0.0-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index c9cfd5a..aa20ed8 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 3.7.$(Rev:r) +name: 4.0.0 pool: vmImage: ubuntu-latest diff --git a/.gitignore b/.gitignore index 9491a2f..0c768ca 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,8 @@ ## ## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore +launchSettings.json + # User-specific files *.rsuser *.suo diff --git a/src/Client.cs b/src/Client.cs index 9fa42bb..046ddd4 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -625,7 +625,7 @@ namespace WTelegram return new RpcResult { req_msg_id = msgId, result = result }; } - class Rpc + private sealed class Rpc { internal Type type; internal TaskCompletionSource tcs = new(TaskCreationOptions.RunContinuationsAsynchronously); diff --git a/src/Encryption.cs b/src/Encryption.cs index d88a260..4c49f5e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -319,7 +319,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB } #if OBFUSCATION - internal class AesCtr(byte[] key, byte[] ivec) : IDisposable + internal sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable { readonly ICryptoTransform _encryptor = AesECB.CreateEncryptor(key, null); readonly byte[] _ecount = new byte[16]; @@ -518,7 +518,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB #endif } - internal class AES_IGE_Stream : Helpers.IndirectStream + internal sealed class AES_IGE_Stream : Helpers.IndirectStream { private readonly ICryptoTransform _aesCrypto; private readonly byte[] _prevBytes; diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 3898b8c..7b1cfbe 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -37,7 +37,7 @@ namespace WTelegram private const int ThresholdPFS = 100; [TLDef(0xFEFEFEFE)] - internal class SecretChat : IObject, ISecretChat + internal sealed class SecretChat : IObject, ISecretChat { [Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 } public Flags flags; diff --git a/src/Session.cs b/src/Session.cs index 70c88ac..ed184e2 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -11,7 +11,7 @@ using System.Text.Json; namespace WTelegram { - internal class Session : IDisposable + internal sealed partial class Session : IDisposable { public int ApiId; public long UserId; @@ -19,7 +19,7 @@ namespace WTelegram public Dictionary DCSessions = []; public TL.DcOption[] DcOptions; - public class DCSession + public sealed class DCSession { public long Id; public long AuthKeyID; @@ -158,7 +158,7 @@ namespace WTelegram } } - internal class SessionStore : FileStream // This class is designed to be high-performance and failure-resilient with Writes (but when you're Andrei, you can't understand that) + internal sealed class SessionStore : FileStream // This class is designed to be high-performance and failure-resilient with Writes (but when you're Andrei, you can't understand that) { public override long Length { get; } public override long Position { get => base.Position; set { } } @@ -192,7 +192,7 @@ namespace WTelegram } } - internal class ActionStore(byte[] initial, Action save) : MemoryStream(initial ?? []) + internal sealed class ActionStore(byte[] initial, Action save) : MemoryStream(initial ?? []) { public override void Write(byte[] buffer, int offset, int count) => save(buffer[offset..(offset + count)]); public override void SetLength(long value) { } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 1cc5a95..428f243 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -11,7 +11,7 @@ namespace TL { public static class Extensions { - internal class CollectorPeer : Peer + internal sealed partial class CollectorPeer : Peer { public override long ID => 0; internal IDictionary _users; diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index fa8754c..8d9bd50 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -7,7 +7,7 @@ namespace TL { #pragma warning disable IDE1006 [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ - public class ResPQ : IObject + public sealed partial class ResPQ : IObject { public Int128 nonce; public Int128 server_nonce; @@ -16,7 +16,7 @@ namespace TL } [TLDef(0x83C95AEC)] //p_q_inner_data#83c95aec pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 = P_Q_inner_data - public class PQInnerData : IObject + public partial class PQInnerData : IObject { public byte[] pq; public byte[] p; @@ -26,24 +26,24 @@ namespace TL public Int256 new_nonce; } [TLDef(0xA9F55F95, inheritBefore = true)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data - public class PQInnerDataDc : PQInnerData + public sealed partial class PQInnerDataDc : PQInnerData { public int dc; } [TLDef(0x3C6A84D4, inheritBefore = true)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data - public class PQInnerDataTemp : PQInnerData + public sealed partial class PQInnerDataTemp : PQInnerData { public int expires_in; } [TLDef(0x56FDDF88, inheritBefore = true)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data - public class PQInnerDataTempDc : PQInnerData + public sealed partial class PQInnerDataTempDc : PQInnerData { public int dc; public int expires_in; } [TLDef(0x75A3F765)] //bind_auth_key_inner#75a3f765 nonce:long temp_auth_key_id:long perm_auth_key_id:long temp_session_id:long expires_at:int = BindAuthKeyInner - public class BindAuthKeyInner : IObject + public sealed partial class BindAuthKeyInner : IObject { public long nonce; public long temp_auth_key_id; @@ -52,24 +52,24 @@ namespace TL public DateTime expires_at; } - public abstract class ServerDHParams : IObject + public abstract partial class ServerDHParams : IObject { public Int128 nonce; public Int128 server_nonce; } [TLDef(0x79CB045D, inheritBefore = true)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params - public class ServerDHParamsFail : ServerDHParams + public sealed partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; } [TLDef(0xD0E8075C, inheritBefore = true)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params - public class ServerDHParamsOk : ServerDHParams + public sealed partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; } [TLDef(0xB5890DBA)] //server_DH_inner_data#b5890dba nonce:int128 server_nonce:int128 g:int dh_prime:bytes g_a:bytes server_time:int = Server_DH_inner_data - public class ServerDHInnerData : IObject + public sealed partial class ServerDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -80,7 +80,7 @@ namespace TL } [TLDef(0x6643B654)] //client_DH_inner_data#6643b654 nonce:int128 server_nonce:int128 retry_id:long g_b:bytes = Client_DH_Inner_Data - public class ClientDHInnerData : IObject + public sealed partial class ClientDHInnerData : IObject { public Int128 nonce; public Int128 server_nonce; @@ -88,23 +88,23 @@ namespace TL public byte[] g_b; } - public abstract class SetClientDHParamsAnswer : IObject + public abstract partial class SetClientDHParamsAnswer : IObject { public Int128 nonce; public Int128 server_nonce; } [TLDef(0x3BCBF734, inheritBefore = true)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer - public class DhGenOk : SetClientDHParamsAnswer + public sealed partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; } [TLDef(0x46DC1FB9, inheritBefore = true)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer - public class DhGenRetry : SetClientDHParamsAnswer + public sealed partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; } [TLDef(0xA69DAE02, inheritBefore = true)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer - public class DhGenFail : SetClientDHParamsAnswer + public sealed partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; } @@ -120,52 +120,52 @@ namespace TL } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck - public class MsgsAck : IObject + public sealed partial class MsgsAck : IObject { public long[] msg_ids; } [TLDef(0xA7EFF811)] //bad_msg_notification#a7eff811 bad_msg_id:long bad_msg_seqno:int error_code:int = BadMsgNotification - public class BadMsgNotification : IObject + public partial class BadMsgNotification : IObject { public long bad_msg_id; public int bad_msg_seqno; public int error_code; } [TLDef(0xEDAB447B, inheritBefore = true)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification - public class BadServerSalt : BadMsgNotification + public sealed partial class BadServerSalt : BadMsgNotification { public long new_server_salt; } [TLDef(0xDA69FB52)] //msgs_state_req#da69fb52 msg_ids:Vector = MsgsStateReq - public class MsgsStateReq : IObject + public sealed partial class MsgsStateReq : IObject { public long[] msg_ids; } [TLDef(0x04DEB57D)] //msgs_state_info#04deb57d req_msg_id:long info:bytes = MsgsStateInfo - public class MsgsStateInfo : IObject + public sealed partial class MsgsStateInfo : IObject { public long req_msg_id; public byte[] info; } [TLDef(0x8CC0D131)] //msgs_all_info#8cc0d131 msg_ids:Vector info:bytes = MsgsAllInfo - public class MsgsAllInfo : IObject + public sealed partial class MsgsAllInfo : IObject { public long[] msg_ids; public byte[] info; } - public abstract class MsgDetailedInfoBase : IObject + public abstract partial class MsgDetailedInfoBase : IObject { public virtual long AnswerMsgId => default; public virtual int Bytes => default; public virtual int Status => default; } [TLDef(0x276D3EC6)] //msg_detailed_info#276d3ec6 msg_id:long answer_msg_id:long bytes:int status:int = MsgDetailedInfo - public class MsgDetailedInfo : MsgDetailedInfoBase + public sealed partial class MsgDetailedInfo : MsgDetailedInfoBase { public long msg_id; public long answer_msg_id; @@ -177,7 +177,7 @@ namespace TL public override int Status => status; } [TLDef(0x809DB6DF)] //msg_new_detailed_info#809db6df answer_msg_id:long bytes:int status:int = MsgDetailedInfo - public class MsgNewDetailedInfo : MsgDetailedInfoBase + public sealed partial class MsgNewDetailedInfo : MsgDetailedInfoBase { public long answer_msg_id; public int bytes; @@ -189,25 +189,25 @@ namespace TL } [TLDef(0x7D861A08)] //msg_resend_req#7d861a08 msg_ids:Vector = MsgResendReq - public class MsgResendReq : IObject + public sealed partial class MsgResendReq : IObject { public long[] msg_ids; } [TLDef(0x2144CA19)] //rpc_error#2144ca19 error_code:int error_message:string = RpcError - public class RpcError : IObject + public sealed partial class RpcError : IObject { public int error_code; public string error_message; } - public abstract class RpcDropAnswer : IObject { } + public abstract partial class RpcDropAnswer : IObject { } [TLDef(0x5E2AD36E)] //rpc_answer_unknown#5e2ad36e = RpcDropAnswer - public class RpcAnswerUnknown : RpcDropAnswer { } + public sealed partial class RpcAnswerUnknown : RpcDropAnswer { } [TLDef(0xCD78E586)] //rpc_answer_dropped_running#cd78e586 = RpcDropAnswer - public class RpcAnswerDroppedRunning : RpcDropAnswer { } + public sealed partial class RpcAnswerDroppedRunning : RpcDropAnswer { } [TLDef(0xA43AD8B7)] //rpc_answer_dropped#a43ad8b7 msg_id:long seq_no:int bytes:int = RpcDropAnswer - public class RpcAnswerDropped : RpcDropAnswer + public sealed partial class RpcAnswerDropped : RpcDropAnswer { public long msg_id; public int seq_no; @@ -215,7 +215,7 @@ namespace TL } [TLDef(0x0949D9DC)] //future_salt#0949d9dc valid_since:int valid_until:int salt:long = FutureSalt - public class FutureSalt : IObject + public sealed partial class FutureSalt : IObject { public DateTime valid_since; public DateTime valid_until; @@ -223,7 +223,7 @@ namespace TL } [TLDef(0xAE500895)] //future_salts#ae500895 req_msg_id:long now:int salts:vector = FutureSalts - public class FutureSalts : IObject + public sealed partial class FutureSalts : IObject { public long req_msg_id; public DateTime now; @@ -231,24 +231,24 @@ namespace TL } [TLDef(0x347773C5)] //pong#347773c5 msg_id:long ping_id:long = Pong - public class Pong : IObject + public sealed partial class Pong : IObject { public long msg_id; public long ping_id; } - public abstract class DestroySessionRes : IObject + public abstract partial class DestroySessionRes : IObject { public long session_id; } [TLDef(0xE22045FC)] //destroy_session_ok#e22045fc session_id:long = DestroySessionRes - public class DestroySessionOk : DestroySessionRes { } + public sealed partial class DestroySessionOk : DestroySessionRes { } [TLDef(0x62D350C9)] //destroy_session_none#62d350c9 session_id:long = DestroySessionRes - public class DestroySessionNone : DestroySessionRes { } + public sealed partial class DestroySessionNone : DestroySessionRes { } - public abstract class NewSession : IObject { } + public abstract partial class NewSession : IObject { } [TLDef(0x9EC20908)] //new_session_created#9ec20908 first_msg_id:long unique_id:long server_salt:long = NewSession - public class NewSessionCreated : NewSession + public sealed partial class NewSessionCreated : NewSession { public long first_msg_id; public long unique_id; @@ -256,7 +256,7 @@ namespace TL } [TLDef(0x9299359F)] //http_wait#9299359f max_delay:int wait_after:int max_wait:int = HttpWait - public class HttpWait : IObject + public sealed partial class HttpWait : IObject { public int max_delay; public int wait_after; @@ -264,19 +264,19 @@ namespace TL } [TLDef(0xD433AD73)] //ipPort#d433ad73 ipv4:int port:int = IpPort - public class IpPort : IObject + public partial class IpPort : IObject { public int ipv4; public int port; } [TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort - public class IpPortSecret : IpPort + public sealed partial class IpPortSecret : IpPort { public byte[] secret; } [TLDef(0x4679B65F)] //accessPointRule#4679b65f phone_prefix_rules:bytes dc_id:int ips:vector = AccessPointRule - public class AccessPointRule : IObject + public sealed partial class AccessPointRule : IObject { public byte[] phone_prefix_rules; public int dc_id; @@ -284,7 +284,7 @@ namespace TL } [TLDef(0x5A592A6C)] //help.configSimple#5a592a6c date:int expires:int rules:vector = help.ConfigSimple - public class Help_ConfigSimple : IObject + public sealed partial class Help_ConfigSimple : IObject { public DateTime date; public DateTime expires; @@ -368,19 +368,19 @@ namespace TL.Methods { #pragma warning disable IDE1006 [TLDef(0x60469778)] //req_pq#60469778 nonce:int128 = ResPQ - public class ReqPq : IMethod + public sealed partial class ReqPq : IMethod { public Int128 nonce; } [TLDef(0xBE7E8EF1)] //req_pq_multi#be7e8ef1 nonce:int128 = ResPQ - public class ReqPqMulti : IMethod + public sealed partial class ReqPqMulti : IMethod { public Int128 nonce; } [TLDef(0xD712E4BE)] //req_DH_params#d712e4be nonce:int128 server_nonce:int128 p:bytes q:bytes public_key_fingerprint:long encrypted_data:bytes = Server_DH_Params - public class ReqDHParams : IMethod + public sealed partial class ReqDHParams : IMethod { public Int128 nonce; public Int128 server_nonce; @@ -391,7 +391,7 @@ namespace TL.Methods } [TLDef(0xF5045F1F)] //set_client_DH_params#f5045f1f nonce:int128 server_nonce:int128 encrypted_data:bytes = Set_client_DH_params_answer - public class SetClientDHParams : IMethod + public sealed partial class SetClientDHParams : IMethod { public Int128 nonce; public Int128 server_nonce; @@ -399,35 +399,35 @@ namespace TL.Methods } [TLDef(0xD1435160)] //destroy_auth_key#d1435160 = DestroyAuthKeyRes - public class DestroyAuthKey : IMethod { } + public sealed partial class DestroyAuthKey : IMethod { } [TLDef(0x58E4A740)] //rpc_drop_answer#58e4a740 req_msg_id:long = RpcDropAnswer - public class RpcDropAnswer : IMethod + public sealed partial class RpcDropAnswer : IMethod { public long req_msg_id; } [TLDef(0xB921BD04)] //get_future_salts#b921bd04 num:int = FutureSalts - public class GetFutureSalts : IMethod + public sealed partial class GetFutureSalts : IMethod { public int num; } [TLDef(0x7ABE77EC)] //ping#7abe77ec ping_id:long = Pong - public class Ping : IMethod + public sealed partial class Ping : IMethod { public long ping_id; } [TLDef(0xF3427B8C)] //ping_delay_disconnect#f3427b8c ping_id:long disconnect_delay:int = Pong - public class PingDelayDisconnect : IMethod + public sealed partial class PingDelayDisconnect : IMethod { public long ping_id; public int disconnect_delay; } [TLDef(0xE7512126)] //destroy_session#e7512126 session_id:long = DestroySessionRes - public class DestroySession : IMethod + public sealed partial class DestroySession : IMethod { public long session_id; } diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 60f58b6..984dc17 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -15,11 +15,11 @@ namespace TL /// See predefined identifiers. See [TLDef(0x3FEDD339)] - public class True : IObject { } + public sealed partial class True : IObject { } /// Error. See [TLDef(0xC4B9F9BB)] - public class Error : IObject + public sealed partial class Error : IObject { /// Error code public int code; @@ -30,24 +30,24 @@ namespace TL /// Corresponds to an arbitrary empty object. See /// a value means null [TLDef(0x56730BCC)] - public class Null : IObject { } + public sealed partial class Null : IObject { } /// Peer See Derived classes: , , , , , /// a value means inputPeerEmpty public abstract partial class InputPeer : IObject { } /// Defines the current user. See [TLDef(0x7DA07EC9)] - public partial class InputPeerSelf : InputPeer { } + public sealed partial class InputPeerSelf : InputPeer { } /// Defines a chat for further interaction. See [TLDef(0x35A95CB9)] - public partial class InputPeerChat : InputPeer + public sealed partial class InputPeerChat : InputPeer { /// Chat identifier public long chat_id; } /// Defines a user for further interaction. See [TLDef(0xDDE8A54C)] - public partial class InputPeerUser : InputPeer + public sealed partial class InputPeerUser : InputPeer { /// User identifier public long user_id; @@ -56,7 +56,7 @@ namespace TL } /// Defines a channel for further interaction. See [TLDef(0x27BCBBFC)] - public partial class InputPeerChannel : InputPeer + public sealed partial class InputPeerChannel : InputPeer { /// Channel identifier public long channel_id; @@ -65,7 +65,7 @@ namespace TL } /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0xA87B0A1C)] - public partial class InputPeerUserFromMessage : InputPeer + public sealed partial class InputPeerUserFromMessage : InputPeer { /// The chat where the user was seen public InputPeer peer; @@ -76,7 +76,7 @@ namespace TL } /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0xBD2A0840)] - public partial class InputPeerChannelFromMessage : InputPeer + public sealed partial class InputPeerChannelFromMessage : InputPeer { /// The chat where the channel's message was seen public InputPeer peer; @@ -91,10 +91,10 @@ namespace TL public abstract partial class InputUserBase : IObject { } /// Defines the current user. See [TLDef(0xF7C1B13F)] - public partial class InputUserSelf : InputUserBase { } + public sealed partial class InputUserSelf : InputUserBase { } /// Defines a user for further interaction. See [TLDef(0xF21158C6)] - public partial class InputUser : InputUserBase + public sealed partial class InputUser : InputUserBase { /// User identifier public long user_id; @@ -103,7 +103,7 @@ namespace TL } /// Defines a min user that was seen in a certain message of a certain chat. See [TLDef(0x1DA448E2)] - public partial class InputUserFromMessage : InputUserBase + public sealed partial class InputUserFromMessage : InputUserBase { /// The chat where the user was seen public InputPeer peer; @@ -114,10 +114,10 @@ namespace TL } /// Object defines a contact from the user's phone book. See Derived classes: - public abstract class InputContact : IObject { } + public abstract partial class InputContact : IObject { } /// Phone contact. See [TLDef(0xF392B7F4)] - public class InputPhoneContact : InputContact + public sealed partial class InputPhoneContact : InputContact { /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; @@ -141,7 +141,7 @@ namespace TL } /// Defines a file saved in parts using the method Upload_SaveFilePart. See [TLDef(0xF52FF27F)] - public partial class InputFile : InputFileBase + public sealed partial class InputFile : InputFileBase { /// Random file identifier created by the client public long id; @@ -161,7 +161,7 @@ namespace TL } /// Assigns a big file (over 10 MB in size), saved in part using the method Upload_SaveBigFilePart. See [TLDef(0xFA4F0BB5)] - public partial class InputFileBig : InputFileBase + public sealed partial class InputFileBig : InputFileBase { /// Random file id, created by the client public long id; @@ -180,10 +180,10 @@ namespace TL /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , /// a value means inputMediaEmpty - public abstract class InputMedia : IObject { } + public abstract partial class InputMedia : IObject { } /// Photo See [TLDef(0x1E287D04)] - public class InputMediaUploadedPhoto : InputMedia + public sealed partial class InputMediaUploadedPhoto : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -206,7 +206,7 @@ namespace TL } /// Forwarded photo See [TLDef(0xB3BA0635)] - public class InputMediaPhoto : InputMedia + public sealed partial class InputMediaPhoto : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -225,14 +225,14 @@ namespace TL } /// Map. See [TLDef(0xF9C44144)] - public class InputMediaGeoPoint : InputMedia + public sealed partial class InputMediaGeoPoint : InputMedia { /// GeoPoint public InputGeoPoint geo_point; } /// Phone book contact See [TLDef(0xF8AB7DFB)] - public class InputMediaContact : InputMedia + public sealed partial class InputMediaContact : InputMedia { /// Phone number public string phone_number; @@ -245,7 +245,7 @@ namespace TL } /// New document See [TLDef(0x5B38C6C1)] - public partial class InputMediaUploadedDocument : InputMedia + public sealed partial class InputMediaUploadedDocument : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -280,7 +280,7 @@ namespace TL } /// Forwarded document See [TLDef(0x33473058)] - public class InputMediaDocument : InputMedia + public sealed partial class InputMediaDocument : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -303,7 +303,7 @@ namespace TL } /// Can be used to send a venue geolocation. See [TLDef(0xC13D1C11)] - public class InputMediaVenue : InputMedia + public sealed partial class InputMediaVenue : InputMedia { /// Geolocation public InputGeoPoint geo_point; @@ -320,7 +320,7 @@ namespace TL } /// New photo that will be uploaded by the server using the specified URL See [TLDef(0xE5BBFE1A)] - public class InputMediaPhotoExternal : InputMedia + public sealed partial class InputMediaPhotoExternal : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -339,7 +339,7 @@ namespace TL } /// Document that will be downloaded by the telegram servers See [TLDef(0xFB52DC99)] - public class InputMediaDocumentExternal : InputMedia + public sealed partial class InputMediaDocumentExternal : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -358,14 +358,14 @@ namespace TL } /// A game See [TLDef(0xD33F43F3)] - public class InputMediaGame : InputMedia + public sealed partial class InputMediaGame : InputMedia { /// The game to forward public InputGame id; } /// Generated invoice of a bot payment See [TLDef(0x8EB5A6D5)] - public class InputMediaInvoice : InputMedia + public sealed partial class InputMediaInvoice : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -400,7 +400,7 @@ namespace TL } /// Live geolocation See [TLDef(0x971FA843)] - public class InputMediaGeoLive : InputMedia + public sealed partial class InputMediaGeoLive : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -427,7 +427,7 @@ namespace TL } /// A poll See [TLDef(0x0F94E5F1)] - public class InputMediaPoll : InputMedia + public sealed partial class InputMediaPoll : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -450,14 +450,14 @@ namespace TL } /// Send a dice-based animated sticker See [TLDef(0xE66FBF7B)] - public class InputMediaDice : InputMedia + public sealed partial class InputMediaDice : InputMedia { /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } /// Forwarded story See [TLDef(0x89FDD778)] - public class InputMediaStory : InputMedia + public sealed partial class InputMediaStory : InputMedia { /// Peer where the story was posted public InputPeer peer; @@ -466,7 +466,7 @@ namespace TL } /// Specifies options that will be used to generate the link preview for the caption, or even a standalone link preview without an attached message. See [TLDef(0xC21B8849)] - public class InputMediaWebPage : InputMedia + public sealed partial class InputMediaWebPage : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -486,10 +486,10 @@ namespace TL /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty - public abstract class InputChatPhotoBase : IObject { } + public abstract partial class InputChatPhotoBase : IObject { } /// New photo to be set as group profile photo. See [TLDef(0xBDCDAEC0)] - public class InputChatUploadedPhoto : InputChatPhotoBase + public sealed partial class InputChatUploadedPhoto : InputChatPhotoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -516,7 +516,7 @@ namespace TL } /// Existing photo to be set as a chat profile photo. See [TLDef(0x8953AD37)] - public class InputChatPhoto : InputChatPhotoBase + public sealed partial class InputChatPhoto : InputChatPhotoBase { /// Existing photo public InputPhoto id; @@ -525,7 +525,7 @@ namespace TL /// Defines a GeoPoint by its coordinates. See /// a value means inputGeoPointEmpty [TLDef(0x48222FAF)] - public class InputGeoPoint : IObject + public sealed partial class InputGeoPoint : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -546,7 +546,7 @@ namespace TL /// Defines a photo for further interaction. See /// a value means inputPhotoEmpty [TLDef(0x3BB3B94A)] - public partial class InputPhoto : IObject + public sealed partial class InputPhoto : IObject { /// Photo identifier public long id; @@ -557,10 +557,10 @@ namespace TL } /// Defines the location of a file for download. See Derived classes: , , , , , , , , , - public abstract class InputFileLocationBase : IObject { } + public abstract partial class InputFileLocationBase : IObject { } /// DEPRECATED location of a photo See [TLDef(0xDFDAABE1)] - public class InputFileLocation : InputFileLocationBase + public sealed partial class InputFileLocation : InputFileLocationBase { /// Server volume public long volume_id; @@ -573,7 +573,7 @@ namespace TL } /// Location of encrypted secret chat file. See [TLDef(0xF5235D55)] - public class InputEncryptedFileLocation : InputFileLocationBase + public sealed partial class InputEncryptedFileLocation : InputFileLocationBase { /// File ID, id parameter value from public long id; @@ -582,7 +582,7 @@ namespace TL } /// Document location (video, voice, audio, basically every type except photo) See [TLDef(0xBAD07584)] - public class InputDocumentFileLocation : InputFileLocationBase + public sealed partial class InputDocumentFileLocation : InputFileLocationBase { /// Document ID public long id; @@ -595,7 +595,7 @@ namespace TL } /// Location of encrypted telegram passport file. See [TLDef(0xCBC7EE28)] - public class InputSecureFileLocation : InputFileLocationBase + public sealed partial class InputSecureFileLocation : InputFileLocationBase { /// File ID, id parameter value from public long id; @@ -604,10 +604,10 @@ namespace TL } /// Used to download a JSON file that will contain all personal data related to features that do not have a specialized takeout method yet, see here » for more info on the takeout API. See [TLDef(0x29BE5899)] - public class InputTakeoutFileLocation : InputFileLocationBase { } + public sealed partial class InputTakeoutFileLocation : InputFileLocationBase { } /// Use this object to download a photo with Upload_GetFile method See [TLDef(0x40181FFE)] - public class InputPhotoFileLocation : InputFileLocationBase + public sealed partial class InputPhotoFileLocation : InputFileLocationBase { /// Photo ID, obtained from the object public long id; @@ -620,7 +620,7 @@ namespace TL } /// DEPRECATED legacy photo file location See [TLDef(0xD83466F3)] - public class InputPhotoLegacyFileLocation : InputFileLocationBase + public sealed partial class InputPhotoLegacyFileLocation : InputFileLocationBase { /// Photo ID public long id; @@ -637,7 +637,7 @@ namespace TL } /// Location of profile photo of channel/group/supergroup/user See [TLDef(0x37257E99)] - public class InputPeerPhotoFileLocation : InputFileLocationBase + public sealed partial class InputPeerPhotoFileLocation : InputFileLocationBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -654,7 +654,7 @@ namespace TL } /// Location of stickerset thumbnail (see files) See [TLDef(0x9D84F3DB)] - public class InputStickerSetThumb : InputFileLocationBase + public sealed partial class InputStickerSetThumb : InputFileLocationBase { /// Sticker set public InputStickerSet stickerset; @@ -663,7 +663,7 @@ namespace TL } /// Chunk of a livestream See [TLDef(0x0598A92A)] - public class InputGroupCallStream : InputFileLocationBase + public sealed partial class InputGroupCallStream : InputFileLocationBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -689,21 +689,21 @@ namespace TL public abstract partial class Peer : IObject { } /// Chat partner See [TLDef(0x59511722)] - public partial class PeerUser : Peer + public sealed partial class PeerUser : Peer { /// User identifier public long user_id; } /// Group. See [TLDef(0x36C6019A)] - public partial class PeerChat : Peer + public sealed partial class PeerChat : Peer { /// Group identifier public long chat_id; } /// Channel/supergroup See [TLDef(0xA2A5371E)] - public partial class PeerChannel : Peer + public sealed partial class PeerChannel : Peer { /// Channel ID public long channel_id; @@ -738,14 +738,14 @@ namespace TL public abstract partial class UserBase : IObject { } /// Empty constructor, non-existent user. See [TLDef(0xD3BC4B7A)] - public partial class UserEmpty : UserBase + public sealed partial class UserEmpty : UserBase { /// User identifier or 0 public long id; } /// Indicates info about a certain user See [TLDef(0x215C4438)] - public partial class User : UserBase + public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -871,7 +871,7 @@ namespace TL /// User profile photo. See /// a value means userProfilePhotoEmpty [TLDef(0x82D1F706)] - public class UserProfilePhoto : IObject + public sealed partial class UserProfilePhoto : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -898,21 +898,21 @@ namespace TL public abstract partial class UserStatus : IObject { } /// Online status of the user. See [TLDef(0xEDB93949)] - public partial class UserStatusOnline : UserStatus + public sealed partial class UserStatusOnline : UserStatus { /// Time to expiration of the current online status public DateTime expires; } /// The user's offline status. See [TLDef(0x008C703F)] - public partial class UserStatusOffline : UserStatus + public sealed partial class UserStatusOffline : UserStatus { /// Time the user was last seen online public int was_online; } /// Online status: last seen recently See [TLDef(0x7B197DC8)] - public partial class UserStatusRecently : UserStatus + public sealed partial class UserStatusRecently : UserStatus { public Flags flags; @@ -923,7 +923,7 @@ namespace TL } /// Online status: last seen last week See [TLDef(0x541A1D1A)] - public partial class UserStatusLastWeek : UserStatus + public sealed partial class UserStatusLastWeek : UserStatus { public Flags flags; @@ -934,7 +934,7 @@ namespace TL } /// Online status: last seen last month See [TLDef(0x65899777)] - public partial class UserStatusLastMonth : UserStatus + public sealed partial class UserStatusLastMonth : UserStatus { public Flags flags; @@ -954,7 +954,7 @@ namespace TL } /// Empty constructor, group doesn't exist See [TLDef(0x29562865)] - public partial class ChatEmpty : ChatBase + public sealed partial class ChatEmpty : ChatBase { /// Group identifier public long id; @@ -964,7 +964,7 @@ namespace TL } /// Info about a group See [TLDef(0x41CBF256)] - public partial class Chat : ChatBase + public sealed partial class Chat : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1016,7 +1016,7 @@ namespace TL } /// A group to which the user has no access. E.g., because the user was kicked from the group. See [TLDef(0x6592A1A7)] - public partial class ChatForbidden : ChatBase + public sealed partial class ChatForbidden : ChatBase { /// User identifier public long id; @@ -1030,7 +1030,7 @@ namespace TL } /// Channel/supergroup info See [TLDef(0x0AADFC8F)] - public partial class Channel : ChatBase + public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1156,7 +1156,7 @@ namespace TL } /// Indicates a channel/supergroup we can't access because we were banned, or for some other reason. See [TLDef(0x17D493D5)] - public partial class ChannelForbidden : ChatBase + public sealed partial class ChannelForbidden : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1221,7 +1221,7 @@ namespace TL } /// Full info about a basic group. See [TLDef(0xC9D31138)] - public partial class ChatFull : ChatFullBase + public sealed partial class ChatFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1323,7 +1323,7 @@ namespace TL } /// Full info about a channel, supergroup or gigagroup. See [TLDef(0x44C054A7)] - public partial class ChannelFull : ChatFullBase + public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1553,7 +1553,7 @@ namespace TL } /// Represents the creator of the group See [TLDef(0xE46BCEE4)] - public partial class ChatParticipantCreator : ChatParticipantBase + public sealed partial class ChatParticipantCreator : ChatParticipantBase { /// ID of the user that created the group public long user_id; @@ -1563,7 +1563,7 @@ namespace TL } /// Chat admin See [TLDef(0xA0933F5B)] - public partial class ChatParticipantAdmin : ChatParticipant + public sealed partial class ChatParticipantAdmin : ChatParticipant { } @@ -1575,7 +1575,7 @@ namespace TL } /// Info on members is unavailable See [TLDef(0x8763D3E1)] - public partial class ChatParticipantsForbidden : ChatParticipantsBase + public sealed partial class ChatParticipantsForbidden : ChatParticipantsBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1595,7 +1595,7 @@ namespace TL } /// Group members. See [TLDef(0x3CBC93F8)] - public partial class ChatParticipants : ChatParticipantsBase + public sealed partial class ChatParticipants : ChatParticipantsBase { /// Group identifier public long chat_id; @@ -1611,7 +1611,7 @@ namespace TL /// Group profile photo. See /// a value means chatPhotoEmpty [TLDef(0x1C6E1C11)] - public class ChatPhoto : IObject + public sealed partial class ChatPhoto : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1632,7 +1632,7 @@ namespace TL } /// Object describing a message. See Derived classes: , , - public abstract class MessageBase : IObject + public abstract partial class MessageBase : IObject { /// ID of the message public virtual int ID => default; @@ -1649,7 +1649,7 @@ namespace TL } /// Empty constructor, non-existent message. See [TLDef(0x90A6CA84)] - public partial class MessageEmpty : MessageBase + public sealed partial class MessageEmpty : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1671,7 +1671,7 @@ namespace TL } /// A message See [TLDef(0xA66C7EFC)] - public partial class Message : MessageBase + public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1797,7 +1797,7 @@ namespace TL } /// Indicates a service message See [TLDef(0x2B085862)] - public partial class MessageService : MessageBase + public sealed partial class MessageService : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1857,7 +1857,7 @@ namespace TL public abstract partial class MessageMedia : IObject { } /// Attached photo. See [TLDef(0x695150D7)] - public partial class MessageMediaPhoto : MessageMedia + public sealed partial class MessageMediaPhoto : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1878,14 +1878,14 @@ namespace TL } /// Attached map. See [TLDef(0x56E0D474)] - public partial class MessageMediaGeo : MessageMedia + public sealed partial class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; } /// Attached contact. See [TLDef(0x70322949)] - public partial class MessageMediaContact : MessageMedia + public sealed partial class MessageMediaContact : MessageMedia { /// Phone number public string phone_number; @@ -1900,10 +1900,10 @@ namespace TL } /// Current version of the client does not support this media type. See [TLDef(0x9F84F49E)] - public class MessageMediaUnsupported : MessageMedia { } + public sealed partial class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See [TLDef(0x4CF4D72D)] - public partial class MessageMediaDocument : MessageMedia + public sealed partial class MessageMediaDocument : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1936,7 +1936,7 @@ namespace TL } /// Preview of webpage See [TLDef(0xDDF10C3B)] - public partial class MessageMediaWebPage : MessageMedia + public sealed partial class MessageMediaWebPage : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -1957,7 +1957,7 @@ namespace TL } /// Venue See [TLDef(0x2EC0533F)] - public partial class MessageMediaVenue : MessageMedia + public sealed partial class MessageMediaVenue : MessageMedia { /// Geolocation of venue public GeoPoint geo; @@ -1974,14 +1974,14 @@ namespace TL } /// Telegram game See [TLDef(0xFDB19008)] - public partial class MessageMediaGame : MessageMedia + public sealed partial class MessageMediaGame : MessageMedia { /// Game public Game game; } /// Invoice See [TLDef(0xF6A548D3)] - public class MessageMediaInvoice : MessageMedia + public sealed partial class MessageMediaInvoice : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2018,7 +2018,7 @@ namespace TL } /// Indicates a live geolocation See [TLDef(0xB940C666)] - public partial class MessageMediaGeoLive : MessageMedia + public sealed partial class MessageMediaGeoLive : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2041,7 +2041,7 @@ namespace TL } /// Poll See [TLDef(0x4BD6E798)] - public partial class MessageMediaPoll : MessageMedia + public sealed partial class MessageMediaPoll : MessageMedia { /// The poll public Poll poll; @@ -2050,7 +2050,7 @@ namespace TL } /// Dice-based animated sticker See [TLDef(0x3F7EE58B)] - public partial class MessageMediaDice : MessageMedia + public sealed partial class MessageMediaDice : MessageMedia { /// Dice value public int value; @@ -2059,7 +2059,7 @@ namespace TL } /// Represents a forwarded story or a story mention. See [TLDef(0x68CB6283)] - public class MessageMediaStory : MessageMedia + public sealed partial class MessageMediaStory : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2080,7 +2080,7 @@ namespace TL } /// Contains info about a giveaway, see here » for more info. See [TLDef(0xDAAD85B0)] - public class MessageMediaGiveaway : MessageMedia + public sealed partial class MessageMediaGiveaway : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2111,7 +2111,7 @@ namespace TL } /// A giveaway with public winners has finished, this constructor contains info about the winners. See [TLDef(0xC6991068)] - public class MessageMediaGiveawayResults : MessageMedia + public sealed partial class MessageMediaGiveawayResults : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2149,10 +2149,10 @@ namespace TL /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty - public abstract class MessageAction : IObject { } + public abstract partial class MessageAction : IObject { } /// Group created See [TLDef(0xBD47CBAD)] - public class MessageActionChatCreate : MessageAction + public sealed partial class MessageActionChatCreate : MessageAction { /// Group name public string title; @@ -2161,59 +2161,59 @@ namespace TL } /// Group name changed. See [TLDef(0xB5A1CE5A)] - public class MessageActionChatEditTitle : MessageAction + public sealed partial class MessageActionChatEditTitle : MessageAction { /// New group name public string title; } /// Group profile changed See [TLDef(0x7FCB13A8)] - public class MessageActionChatEditPhoto : MessageAction + public sealed partial class MessageActionChatEditPhoto : MessageAction { /// New group profile photo public PhotoBase photo; } /// Group profile photo removed. See [TLDef(0x95E3FBEF)] - public class MessageActionChatDeletePhoto : MessageAction { } + public sealed partial class MessageActionChatDeletePhoto : MessageAction { } /// New member in the group See [TLDef(0x15CEFD00)] - public class MessageActionChatAddUser : MessageAction + public sealed partial class MessageActionChatAddUser : MessageAction { /// Users that were invited to the chat public long[] users; } /// User left the group. See [TLDef(0xA43F30CC)] - public class MessageActionChatDeleteUser : MessageAction + public sealed partial class MessageActionChatDeleteUser : MessageAction { /// Leaving user ID public long user_id; } /// A user joined the chat via an invite link See [TLDef(0x031224C3)] - public class MessageActionChatJoinedByLink : MessageAction + public sealed partial class MessageActionChatJoinedByLink : MessageAction { /// ID of the user that created the invite link public long inviter_id; } /// The channel was created See [TLDef(0x95D2AC92)] - public class MessageActionChannelCreate : MessageAction + public sealed partial class MessageActionChannelCreate : MessageAction { /// Original channel/supergroup title public string title; } /// Indicates the chat was migrated to the specified supergroup See [TLDef(0xE1037F92)] - public class MessageActionChatMigrateTo : MessageAction + public sealed partial class MessageActionChatMigrateTo : MessageAction { /// The supergroup it was migrated to public long channel_id; } /// Indicates the channel was migrated from the specified chat See [TLDef(0xEA3948E9)] - public class MessageActionChannelMigrateFrom : MessageAction + public sealed partial class MessageActionChannelMigrateFrom : MessageAction { /// The old chat title public string title; @@ -2222,13 +2222,13 @@ namespace TL } /// A message was pinned See [TLDef(0x94BD38ED)] - public class MessageActionPinMessage : MessageAction { } + public sealed partial class MessageActionPinMessage : MessageAction { } /// Chat history was cleared See [TLDef(0x9FBAB604)] - public class MessageActionHistoryClear : MessageAction { } + public sealed partial class MessageActionHistoryClear : MessageAction { } /// Someone scored in a game See [TLDef(0x92A72876)] - public class MessageActionGameScore : MessageAction + public sealed partial class MessageActionGameScore : MessageAction { /// Game ID public long game_id; @@ -2237,7 +2237,7 @@ namespace TL } /// A user just sent a payment to me (a bot) See [TLDef(0x8F31B327)] - public class MessageActionPaymentSentMe : MessageAction + public sealed partial class MessageActionPaymentSentMe : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2268,7 +2268,7 @@ namespace TL } /// A payment was sent See [TLDef(0x96163F56)] - public class MessageActionPaymentSent : MessageAction + public sealed partial class MessageActionPaymentSent : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2291,7 +2291,7 @@ namespace TL } /// A phone call See [TLDef(0x80E11A7F)] - public class MessageActionPhoneCall : MessageAction + public sealed partial class MessageActionPhoneCall : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2314,17 +2314,17 @@ namespace TL } /// A screenshot of the chat was taken See [TLDef(0x4792929B)] - public class MessageActionScreenshotTaken : MessageAction { } + public sealed partial class MessageActionScreenshotTaken : MessageAction { } /// Custom action (most likely not supported by the current layer, an upgrade might be needed) See [TLDef(0xFAE69F56)] - public class MessageActionCustomAction : MessageAction + public sealed partial class MessageActionCustomAction : MessageAction { /// Action message public string message; } /// We have given the bot permission to send us direct messages. See [TLDef(0xC516D679)] - public class MessageActionBotAllowed : MessageAction + public sealed partial class MessageActionBotAllowed : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2347,7 +2347,7 @@ namespace TL } /// Secure telegram passport values were received See [TLDef(0x1B287353)] - public class MessageActionSecureValuesSentMe : MessageAction + public sealed partial class MessageActionSecureValuesSentMe : MessageAction { /// Vector with information about documents and other Telegram Passport elements that were shared with the bot public SecureValue[] values; @@ -2356,17 +2356,17 @@ namespace TL } /// Request for secure telegram passport values was sent See [TLDef(0xD95C6154)] - public class MessageActionSecureValuesSent : MessageAction + public sealed partial class MessageActionSecureValuesSent : MessageAction { /// Secure value types public SecureValueType[] types; } /// A contact just signed up to telegram See [TLDef(0xF3F25F76)] - public class MessageActionContactSignUp : MessageAction { } + public sealed partial class MessageActionContactSignUp : MessageAction { } /// A user of the chat is now in proximity of another user See [TLDef(0x98E0D697)] - public class MessageActionGeoProximityReached : MessageAction + public sealed partial class MessageActionGeoProximityReached : MessageAction { /// The user or chat that is now in proximity of to_id public Peer from_id; @@ -2377,7 +2377,7 @@ namespace TL } /// The group call has ended See [TLDef(0x7A0D7F42)] - public class MessageActionGroupCall : MessageAction + public sealed partial class MessageActionGroupCall : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2394,7 +2394,7 @@ namespace TL } /// A set of users was invited to the group call See [TLDef(0x502F92F7)] - public class MessageActionInviteToGroupCall : MessageAction + public sealed partial class MessageActionInviteToGroupCall : MessageAction { /// The group call public InputGroupCall call; @@ -2403,7 +2403,7 @@ namespace TL } /// The Time-To-Live of messages in this chat was changed. See [TLDef(0x3C134D7B)] - public class MessageActionSetMessagesTTL : MessageAction + public sealed partial class MessageActionSetMessagesTTL : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2420,7 +2420,7 @@ namespace TL } /// A group call was scheduled See [TLDef(0xB3A07661)] - public class MessageActionGroupCallScheduled : MessageAction + public sealed partial class MessageActionGroupCallScheduled : MessageAction { /// The group call public InputGroupCall call; @@ -2429,31 +2429,31 @@ namespace TL } /// The chat theme was changed See [TLDef(0xAA786345)] - public class MessageActionSetChatTheme : MessageAction + public sealed partial class MessageActionSetChatTheme : MessageAction { /// The emoji that identifies a chat theme public string emoticon; } /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] - public class MessageActionChatJoinedByRequest : MessageAction { } + public sealed partial class MessageActionChatJoinedByRequest : MessageAction { } /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (bot side service message). See [TLDef(0x47DD8079, inheritBefore = true)] - public class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent + public sealed partial class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent { /// Relayed data. public string data; } /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (user side service message). See [TLDef(0xB4C38CB5)] - public class MessageActionWebViewDataSent : MessageAction + public partial class MessageActionWebViewDataSent : MessageAction { /// Text of the that was pressed to open the web app. public string text; } /// Info about a gifted Telegram Premium subscription See [TLDef(0xC83D6AEC)] - public class MessageActionGiftPremium : MessageAction + public sealed partial class MessageActionGiftPremium : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2476,7 +2476,7 @@ namespace TL } /// A forum topic was created. See [TLDef(0x0D999256)] - public class MessageActionTopicCreate : MessageAction + public sealed partial class MessageActionTopicCreate : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2495,7 +2495,7 @@ namespace TL } /// Forum topic information was edited. See [TLDef(0xC0944820)] - public class MessageActionTopicEdit : MessageAction + public sealed partial class MessageActionTopicEdit : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2522,14 +2522,14 @@ namespace TL } /// A new profile picture was suggested using Photos_UploadContactProfilePhoto. See [TLDef(0x57DE635E)] - public class MessageActionSuggestProfilePhoto : MessageAction + public sealed partial class MessageActionSuggestProfilePhoto : MessageAction { /// The photo that the user suggested we set as profile picture. public PhotoBase photo; } /// Contains info about one or more peers that the user shared with the bot after clicking on a button. See [TLDef(0x31518E9B)] - public class MessageActionRequestedPeer : MessageAction + public sealed partial class MessageActionRequestedPeer : MessageAction { /// button_id contained in the public int button_id; @@ -2538,7 +2538,7 @@ namespace TL } /// The wallpaper » of the current chat was changed. See [TLDef(0x5060A3F4)] - public class MessageActionSetChatWallPaper : MessageAction + public sealed partial class MessageActionSetChatWallPaper : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2555,7 +2555,7 @@ namespace TL } /// Contains a Telegram Premium giftcode link. See [TLDef(0x678C2E09)] - public class MessageActionGiftCode : MessageAction + public sealed partial class MessageActionGiftCode : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2588,10 +2588,10 @@ namespace TL } /// A giveaway was started. See [TLDef(0x332BA9ED)] - public class MessageActionGiveawayLaunch : MessageAction { } + public sealed partial class MessageActionGiveawayLaunch : MessageAction { } /// A giveaway has ended. See [TLDef(0x2A9FADC5)] - public class MessageActionGiveawayResults : MessageAction + public sealed partial class MessageActionGiveawayResults : MessageAction { /// Number of winners in the giveaway public int winners_count; @@ -2600,13 +2600,13 @@ namespace TL } /// See [TLDef(0xCC02AA6D)] - public class MessageActionBoostApply : MessageAction + public sealed partial class MessageActionBoostApply : MessageAction { public int boosts; } /// Chat info. See Derived classes: , - public abstract class DialogBase : IObject + public abstract partial class DialogBase : IObject { /// The chat public virtual Peer Peer => default; @@ -2615,7 +2615,7 @@ namespace TL } /// Chat See [TLDef(0xD58A08C6)] - public class Dialog : DialogBase + public sealed partial class Dialog : DialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2669,7 +2669,7 @@ namespace TL } /// Dialog in folder See [TLDef(0x71BD134C)] - public class DialogFolder : DialogBase + public sealed partial class DialogFolder : DialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2704,14 +2704,14 @@ namespace TL public abstract partial class PhotoBase : IObject { } /// Empty constructor, non-existent photo See [TLDef(0x2331B22D)] - public partial class PhotoEmpty : PhotoBase + public sealed partial class PhotoEmpty : PhotoBase { /// Photo identifier public long id; } /// Photo See [TLDef(0xFB197A65)] - public partial class Photo : PhotoBase + public sealed partial class Photo : PhotoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2747,7 +2747,7 @@ namespace TL } /// Empty constructor. Image with this thumbnail is unavailable. See [TLDef(0x0E17E23C)] - public partial class PhotoSizeEmpty : PhotoSizeBase + public sealed partial class PhotoSizeEmpty : PhotoSizeBase { /// Thumbnail type » public string type; @@ -2757,7 +2757,7 @@ namespace TL } /// Image description. See [TLDef(0x75C78E60)] - public partial class PhotoSize : PhotoSizeBase + public sealed partial class PhotoSize : PhotoSizeBase { /// Thumbnail type » public string type; @@ -2773,7 +2773,7 @@ namespace TL } /// Description of an image and its content. See [TLDef(0x021E1AD6)] - public partial class PhotoCachedSize : PhotoSizeBase + public sealed partial class PhotoCachedSize : PhotoSizeBase { /// Thumbnail type public string type; @@ -2789,7 +2789,7 @@ namespace TL } /// A low-resolution compressed JPG payload See [TLDef(0xE0B0BC2E)] - public partial class PhotoStrippedSize : PhotoSizeBase + public sealed partial class PhotoStrippedSize : PhotoSizeBase { /// Thumbnail type public string type; @@ -2801,7 +2801,7 @@ namespace TL } /// Progressively encoded photosize See [TLDef(0xFA3EFB95)] - public partial class PhotoSizeProgressive : PhotoSizeBase + public sealed partial class PhotoSizeProgressive : PhotoSizeBase { /// Photosize type » public string type; @@ -2817,7 +2817,7 @@ namespace TL } /// Messages with animated stickers can have a compressed svg (< 300 bytes) to show the outline of the sticker before fetching the actual lottie animation. See [TLDef(0xD8214D41)] - public partial class PhotoPathSize : PhotoSizeBase + public sealed partial class PhotoPathSize : PhotoSizeBase { /// Always j public string type; @@ -2831,7 +2831,7 @@ namespace TL /// GeoPoint. See /// a value means geoPointEmpty [TLDef(0xB2A2F663)] - public partial class GeoPoint : IObject + public sealed partial class GeoPoint : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2852,10 +2852,10 @@ namespace TL } /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , - public abstract class Auth_SentCodeBase : IObject { } + public abstract partial class Auth_SentCodeBase : IObject { } /// Contains info about a sent verification code. See [TLDef(0x5E002502)] - public class Auth_SentCode : Auth_SentCodeBase + public sealed partial class Auth_SentCode : Auth_SentCodeBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2878,17 +2878,17 @@ namespace TL } /// The user successfully authorized using future auth tokens See [TLDef(0x2390FE44)] - public class Auth_SentCodeSuccess : Auth_SentCodeBase + public sealed partial class Auth_SentCodeSuccess : Auth_SentCodeBase { /// Authorization info public Auth_AuthorizationBase authorization; } /// Object contains info on user authorization. See Derived classes: , - public abstract class Auth_AuthorizationBase : IObject { } + public abstract partial class Auth_AuthorizationBase : IObject { } /// Contains user authorization info. See [TLDef(0x2EA2C0D4)] - public class Auth_Authorization : Auth_AuthorizationBase + public sealed partial class Auth_Authorization : Auth_AuthorizationBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2913,7 +2913,7 @@ namespace TL } /// An account with this phone number doesn't exist on telegram: the user has to enter basic information and sign up See [TLDef(0x44747E9A)] - public class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase + public sealed partial class Auth_AuthorizationSignUpRequired : Auth_AuthorizationBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -2929,7 +2929,7 @@ namespace TL /// Data for copying of authorization between data centers. See [TLDef(0xB434E2B8)] - public class Auth_ExportedAuthorization : IObject + public sealed partial class Auth_ExportedAuthorization : IObject { /// current user identifier public long id; @@ -2941,23 +2941,23 @@ namespace TL public abstract partial class InputNotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0xB8BC5B0C)] - public class InputNotifyPeer : InputNotifyPeerBase + public sealed partial class InputNotifyPeer : InputNotifyPeerBase { /// User or group public InputPeer peer; } /// Notifications generated by all users. See [TLDef(0x193B4417)] - public class InputNotifyUsers : InputNotifyPeerBase { } + public sealed partial class InputNotifyUsers : InputNotifyPeerBase { } /// Notifications generated by all groups. See [TLDef(0x4A95E84E)] - public class InputNotifyChats : InputNotifyPeerBase { } + public sealed partial class InputNotifyChats : InputNotifyPeerBase { } /// All channels See [TLDef(0xB1DB7C7E)] - public class InputNotifyBroadcasts : InputNotifyPeerBase { } + public sealed partial class InputNotifyBroadcasts : InputNotifyPeerBase { } /// Notifications generated by a topic in a forum. See [TLDef(0x5C467992)] - public class InputNotifyForumTopic : InputNotifyPeerBase + public sealed partial class InputNotifyForumTopic : InputNotifyPeerBase { /// Forum ID public InputPeer peer; @@ -2967,7 +2967,7 @@ namespace TL /// Notification settings. See [TLDef(0xCACB6AE2)] - public class InputPeerNotifySettings : IObject + public sealed partial class InputPeerNotifySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3007,7 +3007,7 @@ namespace TL /// Notification settings. See [TLDef(0x99622C0C)] - public class PeerNotifySettings : IObject + public sealed partial class PeerNotifySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3063,7 +3063,7 @@ namespace TL /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat action bar », see here » for more info. See [TLDef(0xA518110D)] - public class PeerSettings : IObject + public sealed partial class PeerSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3111,7 +3111,7 @@ namespace TL } /// Represents a wallpaper based on an image. See [TLDef(0xA437C3ED)] - public partial class WallPaper : WallPaperBase + public sealed partial class WallPaper : WallPaperBase { /// Identifier public long id; @@ -3147,7 +3147,7 @@ namespace TL } /// Represents a wallpaper only based on colors/gradients. See [TLDef(0xE0804116)] - public partial class WallPaperNoFile : WallPaperBase + public sealed partial class WallPaperNoFile : WallPaperBase { /// Wallpaper ID public long id; @@ -3199,7 +3199,7 @@ namespace TL /// Extended user info See [TLDef(0x22FF3E85)] - public class UserFull : IObject + public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3320,7 +3320,7 @@ namespace TL /// A contact of the current user that is registered in the system. See [TLDef(0x145ADE0B)] - public class Contact : IObject + public sealed partial class Contact : IObject { /// User identifier public long user_id; @@ -3330,7 +3330,7 @@ namespace TL /// Successfully imported contact. See [TLDef(0xC13E3C50)] - public class ImportedContact : IObject + public sealed partial class ImportedContact : IObject { /// User identifier public long user_id; @@ -3340,7 +3340,7 @@ namespace TL /// Contact status: online / offline. See [TLDef(0x16D9703B)] - public class ContactStatus : IObject + public sealed partial class ContactStatus : IObject { /// User identifier public long user_id; @@ -3351,7 +3351,7 @@ namespace TL /// The current user's contact list and info on users. See /// a value means contacts.contactsNotModified [TLDef(0xEAE87E42)] - public class Contacts_Contacts : IObject + public sealed partial class Contacts_Contacts : IObject { /// Contact list public Contact[] contacts; @@ -3363,7 +3363,7 @@ namespace TL /// Info on successfully imported contacts. See [TLDef(0x77D01C3B)] - public class Contacts_ImportedContacts : IObject + public sealed partial class Contacts_ImportedContacts : IObject { /// List of successfully imported contacts public ImportedContact[] imported; @@ -3390,7 +3390,7 @@ namespace TL } /// Incomplete list of blocked users. See [TLDef(0xE1664194)] - public class Contacts_BlockedSlice : Contacts_Blocked + public sealed partial class Contacts_BlockedSlice : Contacts_Blocked { /// Total number of elements in the list public int count; @@ -3428,14 +3428,14 @@ namespace TL } /// Incomplete list of dialogs with messages and auxiliary data. See [TLDef(0x71E094F3)] - public partial class Messages_DialogsSlice : Messages_Dialogs, IPeerResolver + public sealed partial class Messages_DialogsSlice : Messages_Dialogs, IPeerResolver { /// Total number of dialogs public int count; } /// Dialogs haven't changed See [TLDef(0xF0E3E596)] - public partial class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver + public sealed partial class Messages_DialogsNotModified : Messages_DialogsBase, IPeerResolver { /// Number of dialogs found server-side by the query public int count; @@ -3469,7 +3469,7 @@ namespace TL } /// Incomplete list of messages and auxiliary data. See [TLDef(0x3A54685E)] - public partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver + public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3492,7 +3492,7 @@ namespace TL } /// Channel messages See [TLDef(0xC776BA4E)] - public partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver + public sealed partial class Messages_ChannelMessages : Messages_MessagesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3526,7 +3526,7 @@ namespace TL } /// No new messages matching the query were found See [TLDef(0x74535F21)] - public partial class Messages_MessagesNotModified : Messages_MessagesBase, IPeerResolver + public sealed partial class Messages_MessagesNotModified : Messages_MessagesBase, IPeerResolver { /// Number of results found server-side by the given query public int count; @@ -3536,14 +3536,14 @@ namespace TL /// List of chats with auxiliary data. See [TLDef(0x64FF9FD5)] - public class Messages_Chats : IObject + public partial class Messages_Chats : IObject { /// List of chats public Dictionary chats; } /// Partial list of chats, more would have to be fetched with pagination See [TLDef(0x9CD81144)] - public class Messages_ChatsSlice : Messages_Chats + public sealed partial class Messages_ChatsSlice : Messages_Chats { /// Total number of results that were found server-side (not all are included in chats) public int count; @@ -3551,7 +3551,7 @@ namespace TL /// Full info about a channel, supergroup, gigagroup or basic group. See [TLDef(0xE5D7D19C)] - public class Messages_ChatFull : IObject, IPeerResolver + public sealed partial class Messages_ChatFull : IObject, IPeerResolver { /// Full info public ChatFullBase full_chat; @@ -3565,7 +3565,7 @@ namespace TL /// Affected part of communication history with the user or in a chat. See [TLDef(0xB45C69D1, inheritBefore = true)] - public class Messages_AffectedHistory : Messages_AffectedMessages + public partial class Messages_AffectedHistory : Messages_AffectedMessages { /// If a parameter contains positive value, it is necessary to repeat the method call using the given value; during the proceeding of all the history the value itself shall gradually decrease public int offset; @@ -3573,37 +3573,37 @@ namespace TL /// Object describes message filter. See Derived classes: , , , , , , , , , , , , , , , /// a value means inputMessagesFilterEmpty - public abstract class MessagesFilter : IObject { } + public abstract partial class MessagesFilter : IObject { } /// Filter for messages containing photos. See [TLDef(0x9609A51C)] - public class InputMessagesFilterPhotos : MessagesFilter { } + public sealed partial class InputMessagesFilterPhotos : MessagesFilter { } /// Filter for messages containing videos. See [TLDef(0x9FC00E65)] - public class InputMessagesFilterVideo : MessagesFilter { } + public sealed partial class InputMessagesFilterVideo : MessagesFilter { } /// Filter for messages containing photos or videos. See [TLDef(0x56E9F0E4)] - public class InputMessagesFilterPhotoVideo : MessagesFilter { } + public sealed partial class InputMessagesFilterPhotoVideo : MessagesFilter { } /// Filter for messages containing documents. See [TLDef(0x9EDDF188)] - public class InputMessagesFilterDocument : MessagesFilter { } + public sealed partial class InputMessagesFilterDocument : MessagesFilter { } /// Return only messages containing URLs See [TLDef(0x7EF0DD87)] - public class InputMessagesFilterUrl : MessagesFilter { } + public sealed partial class InputMessagesFilterUrl : MessagesFilter { } /// Return only messages containing gifs See [TLDef(0xFFC86587)] - public class InputMessagesFilterGif : MessagesFilter { } + public sealed partial class InputMessagesFilterGif : MessagesFilter { } /// Return only messages containing voice notes See [TLDef(0x50F5C392)] - public class InputMessagesFilterVoice : MessagesFilter { } + public sealed partial class InputMessagesFilterVoice : MessagesFilter { } /// Return only messages containing audio files See [TLDef(0x3751B49E)] - public class InputMessagesFilterMusic : MessagesFilter { } + public sealed partial class InputMessagesFilterMusic : MessagesFilter { } /// Return only chat photo changes See [TLDef(0x3A20ECB8)] - public class InputMessagesFilterChatPhotos : MessagesFilter { } + public sealed partial class InputMessagesFilterChatPhotos : MessagesFilter { } /// Return only phone calls See [TLDef(0x80C99768)] - public class InputMessagesFilterPhoneCalls : MessagesFilter + public sealed partial class InputMessagesFilterPhoneCalls : MessagesFilter { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3616,31 +3616,31 @@ namespace TL } /// Return only round videos and voice notes See [TLDef(0x7A7C17A4)] - public class InputMessagesFilterRoundVoice : MessagesFilter { } + public sealed partial class InputMessagesFilterRoundVoice : MessagesFilter { } /// Return only round videos See [TLDef(0xB549DA53)] - public class InputMessagesFilterRoundVideo : MessagesFilter { } + public sealed partial class InputMessagesFilterRoundVideo : MessagesFilter { } /// Return only messages where the current user was mentioned. See [TLDef(0xC1F8E69A)] - public class InputMessagesFilterMyMentions : MessagesFilter { } + public sealed partial class InputMessagesFilterMyMentions : MessagesFilter { } /// Return only messages containing geolocations See [TLDef(0xE7026D0D)] - public class InputMessagesFilterGeo : MessagesFilter { } + public sealed partial class InputMessagesFilterGeo : MessagesFilter { } /// Return only messages containing contacts See [TLDef(0xE062DB83)] - public class InputMessagesFilterContacts : MessagesFilter { } + public sealed partial class InputMessagesFilterContacts : MessagesFilter { } /// Fetch only pinned messages See [TLDef(0x1BB00451)] - public class InputMessagesFilterPinned : MessagesFilter { } + public sealed partial class InputMessagesFilterPinned : MessagesFilter { } /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , - public abstract class Update : IObject + public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] - public class UpdateNewMessage : Update + public partial class UpdateNewMessage : Update { /// Message public MessageBase message; @@ -3653,7 +3653,7 @@ namespace TL } /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] - public class UpdateMessageID : Update + public sealed partial class UpdateMessageID : Update { /// id identifier of a respective public int id; @@ -3662,7 +3662,7 @@ namespace TL } /// Messages were deleted. See [TLDef(0xA20DB0E5)] - public class UpdateDeleteMessages : Update + public partial class UpdateDeleteMessages : Update { /// List of identifiers of deleted messages public int[] messages; @@ -3675,14 +3675,14 @@ namespace TL } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See [TLDef(0xC01E857F, inheritBefore = true)] - public class UpdateUserTyping : UpdateUser + public sealed partial class UpdateUserTyping : UpdateUser { /// Action type public SendMessageAction action; } /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See [TLDef(0x83487AF0, inheritBefore = true)] - public class UpdateChatUserTyping : UpdateChat + public sealed partial class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). public Peer from_id; @@ -3691,21 +3691,21 @@ namespace TL } /// Composition of chat participants changed. See [TLDef(0x07761198)] - public class UpdateChatParticipants : Update + public sealed partial class UpdateChatParticipants : Update { /// Updated chat participants public ChatParticipantsBase participants; } /// Contact status update. See [TLDef(0xE5BDF8DE, inheritBefore = true)] - public class UpdateUserStatus : UpdateUser + public sealed partial class UpdateUserStatus : UpdateUser { /// New status public UserStatus status; } /// Changes the user's first name, last name and username. See [TLDef(0xA7848924, inheritBefore = true)] - public class UpdateUserName : UpdateUser + public sealed partial class UpdateUserName : UpdateUser { /// New first name. Corresponds to the new value of real_first_name field of the . public string first_name; @@ -3716,7 +3716,7 @@ namespace TL } /// A new session logged into the current user's account through an unknown device. See [TLDef(0x8951ABEF)] - public class UpdateNewAuthorization : Update + public sealed partial class UpdateNewAuthorization : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3737,7 +3737,7 @@ namespace TL } /// New encrypted message. See [TLDef(0x12BCBD9A)] - public class UpdateNewEncryptedMessage : Update + public sealed partial class UpdateNewEncryptedMessage : Update { /// Message public EncryptedMessageBase message; @@ -3748,14 +3748,14 @@ namespace TL } /// Interlocutor is typing a message in an encrypted chat. Update period is 6 second. If upon this time there is no repeated update, it shall be considered that the interlocutor stopped typing. See [TLDef(0x1710F156)] - public class UpdateEncryptedChatTyping : Update + public sealed partial class UpdateEncryptedChatTyping : Update { /// Chat ID public int chat_id; } /// Change of state in an encrypted chat. See [TLDef(0xB4A2E88D)] - public class UpdateEncryption : Update + public sealed partial class UpdateEncryption : Update { /// Encrypted chat public EncryptedChatBase chat; @@ -3764,7 +3764,7 @@ namespace TL } /// Communication history in an encrypted chat was marked as read. See [TLDef(0x38FE25B7)] - public class UpdateEncryptedMessagesRead : Update + public sealed partial class UpdateEncryptedMessagesRead : Update { /// Chat ID public int chat_id; @@ -3775,7 +3775,7 @@ namespace TL } /// New group member. See [TLDef(0x3DDA5451, inheritBefore = true)] - public class UpdateChatParticipantAdd : UpdateChat + public sealed partial class UpdateChatParticipantAdd : UpdateChat { /// ID of the new member public long user_id; @@ -3788,7 +3788,7 @@ namespace TL } /// A member has left the group. See [TLDef(0xE32F3D77, inheritBefore = true)] - public class UpdateChatParticipantDelete : UpdateChat + public sealed partial class UpdateChatParticipantDelete : UpdateChat { /// ID of the user public long user_id; @@ -3797,14 +3797,14 @@ namespace TL } /// Changes in the data center configuration options. See [TLDef(0x8E5E9873)] - public class UpdateDcOptions : Update + public sealed partial class UpdateDcOptions : Update { /// New connection options public DcOption[] dc_options; } /// Changes in notification settings. See [TLDef(0xBEC268EF)] - public class UpdateNotifySettings : Update + public sealed partial class UpdateNotifySettings : Update { /// Notification source public NotifyPeerBase peer; @@ -3813,7 +3813,7 @@ namespace TL } /// A service message for the user. See [TLDef(0xEBE46819)] - public class UpdateServiceNotification : Update + public sealed partial class UpdateServiceNotification : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3840,7 +3840,7 @@ namespace TL } /// Privacy rules were changed See [TLDef(0xEE3B272A)] - public class UpdatePrivacy : Update + public sealed partial class UpdatePrivacy : Update { /// Peers to which the privacy rules apply public PrivacyKey key; @@ -3849,14 +3849,14 @@ namespace TL } /// A user's phone number was changed See [TLDef(0x05492A13, inheritBefore = true)] - public class UpdateUserPhone : UpdateUser + public sealed partial class UpdateUserPhone : UpdateUser { /// New phone number public string phone; } /// Incoming messages were read See [TLDef(0x9C974FDF)] - public class UpdateReadHistoryInbox : Update + public sealed partial class UpdateReadHistoryInbox : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3883,7 +3883,7 @@ namespace TL } /// Outgoing messages were read See [TLDef(0x2F2F21BF)] - public class UpdateReadHistoryOutbox : Update + public sealed partial class UpdateReadHistoryOutbox : Update { /// Peer public Peer peer; @@ -3898,7 +3898,7 @@ namespace TL } /// An instant view webpage preview was generated See [TLDef(0x7F891213)] - public class UpdateWebPage : Update + public partial class UpdateWebPage : Update { /// Webpage preview public WebPageBase webpage; @@ -3911,7 +3911,7 @@ namespace TL } /// Contents of messages in the common message box were read See [TLDef(0xF8227181)] - public class UpdateReadMessagesContents : Update + public sealed partial class UpdateReadMessagesContents : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3934,7 +3934,7 @@ namespace TL } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] - public class UpdateChannelTooLong : Update + public sealed partial class UpdateChannelTooLong : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3953,20 +3953,20 @@ namespace TL } /// A new channel or supergroup is available, or info about an existing channel has changed and must be refeteched. See [TLDef(0x635B4C09)] - public class UpdateChannel : Update + public partial class UpdateChannel : Update { /// Channel ID public long channel_id; } /// A new message was sent in a channel/supergroup See [TLDef(0x62BA04D9)] - public class UpdateNewChannelMessage : UpdateNewMessage + public sealed partial class UpdateNewChannelMessage : UpdateNewMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); } /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] - public class UpdateReadChannelInbox : Update + public sealed partial class UpdateReadChannelInbox : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -3991,7 +3991,7 @@ namespace TL } /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12)] - public class UpdateDeleteChannelMessages : UpdateDeleteMessages + public sealed partial class UpdateDeleteChannelMessages : UpdateDeleteMessages { /// Channel ID public long channel_id; @@ -4000,7 +4000,7 @@ namespace TL } /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08, inheritBefore = true)] - public class UpdateChannelMessageViews : UpdateChannel + public sealed partial class UpdateChannelMessageViews : UpdateChannel { /// ID of the message public int id; @@ -4009,7 +4009,7 @@ namespace TL } /// Admin permissions of a user in a basic group were changed See [TLDef(0xD7CA61A2, inheritBefore = true)] - public class UpdateChatParticipantAdmin : UpdateChat + public sealed partial class UpdateChatParticipantAdmin : UpdateChat { /// ID of the (de)admined user public long user_id; @@ -4020,21 +4020,21 @@ namespace TL } /// A new stickerset was installed See [TLDef(0x688A30AA)] - public class UpdateNewStickerSet : Update + public sealed partial class UpdateNewStickerSet : Update { /// The installed stickerset public Messages_StickerSet stickerset; } /// The order of stickersets was changed See [TLDef(0x0BB2D201, inheritBefore = true)] - public class UpdateStickerSetsOrder : UpdateStickerSets + public sealed partial class UpdateStickerSetsOrder : UpdateStickerSets { /// New sticker order by sticker ID public long[] order; } /// Installed stickersets have changed, the client should refetch them as described in the docs. See [TLDef(0x31C24808)] - public class UpdateStickerSets : Update + public partial class UpdateStickerSets : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4049,10 +4049,10 @@ namespace TL } /// The saved gif list has changed, the client should refetch it using Messages_GetSavedGifs See [TLDef(0x9375341E)] - public class UpdateSavedGifs : Update { } + public sealed partial class UpdateSavedGifs : Update { } /// An incoming inline query See [TLDef(0x496F379C)] - public class UpdateBotInlineQuery : Update + public sealed partial class UpdateBotInlineQuery : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4079,7 +4079,7 @@ namespace TL } /// The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot. See [TLDef(0x12F12A07)] - public class UpdateBotInlineSend : Update + public sealed partial class UpdateBotInlineSend : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4104,13 +4104,13 @@ namespace TL } /// A message was edited in a channel/supergroup See [TLDef(0x1B3F4DF7)] - public class UpdateEditChannelMessage : UpdateEditMessage + public sealed partial class UpdateEditChannelMessage : UpdateEditMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); } /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] - public class UpdateBotCallbackQuery : Update + public sealed partial class UpdateBotCallbackQuery : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4139,7 +4139,7 @@ namespace TL } /// A message was edited See [TLDef(0xE40370A3)] - public class UpdateEditMessage : Update + public partial class UpdateEditMessage : Update { /// The new edited message public MessageBase message; @@ -4152,7 +4152,7 @@ namespace TL } /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] - public class UpdateInlineBotCallbackQuery : Update + public sealed partial class UpdateInlineBotCallbackQuery : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4179,7 +4179,7 @@ namespace TL } /// Outgoing messages in a channel/supergroup were read See [TLDef(0xB75F99A9)] - public class UpdateReadChannelOutbox : Update + public sealed partial class UpdateReadChannelOutbox : Update { /// Channel/supergroup ID public long channel_id; @@ -4188,7 +4188,7 @@ namespace TL } /// Notifies a change of a message draft. See [TLDef(0x1B49EC6D)] - public class UpdateDraftMessage : Update + public sealed partial class UpdateDraftMessage : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4207,19 +4207,19 @@ namespace TL } /// Some featured stickers were marked as read See [TLDef(0x571D2742)] - public class UpdateReadFeaturedStickers : Update { } + public sealed partial class UpdateReadFeaturedStickers : Update { } /// The recent sticker list was updated See [TLDef(0x9A422C20)] - public class UpdateRecentStickers : Update { } + public sealed partial class UpdateRecentStickers : Update { } /// The server-side configuration has changed; the client should re-fetch the config using Help_GetConfig See [TLDef(0xA229DD06)] - public class UpdateConfig : Update { } + public sealed partial class UpdateConfig : Update { } /// Common message box sequence PTS has changed, state has to be refetched using updates.getState See [TLDef(0x3354678F)] - public class UpdatePtsChanged : Update { } + public sealed partial class UpdatePtsChanged : Update { } /// A webpage preview of a link in a channel/supergroup message was generated See [TLDef(0x2F2BA99F)] - public class UpdateChannelWebPage : UpdateWebPage + public sealed partial class UpdateChannelWebPage : UpdateWebPage { /// Channel/supergroup ID public long channel_id; @@ -4228,7 +4228,7 @@ namespace TL } /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] - public class UpdateDialogPinned : Update + public sealed partial class UpdateDialogPinned : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4247,7 +4247,7 @@ namespace TL } /// Pinned dialogs were updated See [TLDef(0xFA0F3CA2)] - public class UpdatePinnedDialogs : Update + public sealed partial class UpdatePinnedDialogs : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4266,14 +4266,14 @@ namespace TL } /// A new incoming event; for bots only See [TLDef(0x8317C0C3)] - public class UpdateBotWebhookJSON : Update + public sealed partial class UpdateBotWebhookJSON : Update { /// The event public DataJSON data; } /// A new incoming query; for bots only See [TLDef(0x9B9240A6)] - public class UpdateBotWebhookJSONQuery : Update + public sealed partial class UpdateBotWebhookJSONQuery : Update { /// Query identifier public long query_id; @@ -4284,7 +4284,7 @@ namespace TL } /// This object contains information about an incoming shipping query. See [TLDef(0xB5AEFD7D)] - public class UpdateBotShippingQuery : Update + public sealed partial class UpdateBotShippingQuery : Update { /// Unique query identifier public long query_id; @@ -4297,7 +4297,7 @@ namespace TL } /// This object contains information about an incoming pre-checkout query. See [TLDef(0x8CAA9A96)] - public class UpdateBotPrecheckoutQuery : Update + public sealed partial class UpdateBotPrecheckoutQuery : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4326,31 +4326,31 @@ namespace TL } /// An incoming phone call See [TLDef(0xAB0F6B1E)] - public class UpdatePhoneCall : Update + public sealed partial class UpdatePhoneCall : Update { /// Phone call public PhoneCallBase phone_call; } /// A language pack has changed, the client should manually fetch the changed strings using Langpack_GetDifference See [TLDef(0x46560264)] - public class UpdateLangPackTooLong : Update + public sealed partial class UpdateLangPackTooLong : Update { /// Language code public string lang_code; } /// Language pack updated See [TLDef(0x56022F4D)] - public class UpdateLangPack : Update + public sealed partial class UpdateLangPack : Update { /// Changed strings public LangPackDifference difference; } /// The list of favorited stickers was changed, the client should call Messages_GetFavedStickers to refetch the new list See [TLDef(0xE511996D)] - public class UpdateFavedStickers : Update { } + public sealed partial class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See [TLDef(0xEA29055D)] - public class UpdateChannelReadMessagesContents : Update + public sealed partial class UpdateChannelReadMessagesContents : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4369,17 +4369,17 @@ namespace TL } /// All contacts were deleted See [TLDef(0x7084A7BE)] - public class UpdateContactsReset : Update { } + public sealed partial class UpdateContactsReset : Update { } /// The history of a channel/supergroup was hidden. See [TLDef(0xB23FC698, inheritBefore = true)] - public class UpdateChannelAvailableMessages : UpdateChannel + public sealed partial class UpdateChannelAvailableMessages : UpdateChannel { /// Identifier of a maximum unavailable message in a channel due to hidden history. public int available_min_id; } /// The manual unread mark of a chat was changed See [TLDef(0xE16459C3)] - public class UpdateDialogUnreadMark : Update + public sealed partial class UpdateDialogUnreadMark : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4394,7 +4394,7 @@ namespace TL } /// The results of a poll have changed See [TLDef(0xACA1657B)] - public class UpdateMessagePoll : Update + public sealed partial class UpdateMessagePoll : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4413,7 +4413,7 @@ namespace TL } /// Default banned rights in a normal chat were updated See [TLDef(0x54C01850)] - public class UpdateChatDefaultBannedRights : Update + public sealed partial class UpdateChatDefaultBannedRights : Update { /// The chat public Peer peer; @@ -4424,7 +4424,7 @@ namespace TL } /// The peer list of a peer folder was updated See [TLDef(0x19360DC0)] - public class UpdateFolderPeers : Update + public sealed partial class UpdateFolderPeers : Update { /// New peer list public FolderPeer[] folder_peers; @@ -4437,7 +4437,7 @@ namespace TL } /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] - public class UpdatePeerSettings : Update + public sealed partial class UpdatePeerSettings : Update { /// The peer public Peer peer; @@ -4446,21 +4446,21 @@ namespace TL } /// List of peers near you was updated See [TLDef(0xB4AFCFB0)] - public class UpdatePeerLocated : Update + public sealed partial class UpdatePeerLocated : Update { /// Geolocated peer list update public PeerLocatedBase[] peers; } /// A message was added to the schedule queue of a chat See [TLDef(0x39A51DFB)] - public class UpdateNewScheduledMessage : Update + public sealed partial class UpdateNewScheduledMessage : Update { /// Message public MessageBase message; } /// Some scheduled messages were deleted from the schedule queue of a chat See [TLDef(0x90866CEE)] - public class UpdateDeleteScheduledMessages : Update + public sealed partial class UpdateDeleteScheduledMessages : Update { /// Peer public Peer peer; @@ -4469,14 +4469,14 @@ namespace TL } /// A cloud theme was updated See [TLDef(0x8216FBA3)] - public class UpdateTheme : Update + public sealed partial class UpdateTheme : Update { /// Theme public Theme theme; } /// Live geoposition message was viewed See [TLDef(0x871FB939)] - public class UpdateGeoLiveViewed : Update + public sealed partial class UpdateGeoLiveViewed : Update { /// The user that viewed the live geoposition public Peer peer; @@ -4485,10 +4485,10 @@ namespace TL } /// A login token (for login via QR code) was accepted. See [TLDef(0x564FE691)] - public class UpdateLoginToken : Update { } + public sealed partial class UpdateLoginToken : Update { } /// A specific peer has voted in a poll See [TLDef(0x24F40E77)] - public class UpdateMessagePollVote : Update + public sealed partial class UpdateMessagePollVote : Update { /// Poll ID public long poll_id; @@ -4503,7 +4503,7 @@ namespace TL } /// A new folder was added See [TLDef(0x26FFDE7D)] - public class UpdateDialogFilter : Update + public sealed partial class UpdateDialogFilter : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4520,17 +4520,17 @@ namespace TL } /// New folder order See [TLDef(0xA5D72105)] - public class UpdateDialogFilterOrder : Update + public sealed partial class UpdateDialogFilterOrder : Update { /// Ordered folder IDs public int[] order; } /// Clients should update folder info See [TLDef(0x3504914F)] - public class UpdateDialogFilters : Update { } + public sealed partial class UpdateDialogFilters : Update { } /// Incoming phone call signaling payload See [TLDef(0x2661BF09)] - public class UpdatePhoneCallSignalingData : Update + public sealed partial class UpdatePhoneCallSignalingData : Update { /// Phone call ID public long phone_call_id; @@ -4539,7 +4539,7 @@ namespace TL } /// The forward counter of a message in a channel has changed See [TLDef(0xD29A27F4, inheritBefore = true)] - public class UpdateChannelMessageForwards : UpdateChannel + public sealed partial class UpdateChannelMessageForwards : UpdateChannel { /// ID of the message public int id; @@ -4548,7 +4548,7 @@ namespace TL } /// Incoming comments in a discussion thread were marked as read See [TLDef(0xD6B19546)] - public class UpdateReadChannelDiscussionInbox : Update + public sealed partial class UpdateReadChannelDiscussionInbox : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4571,7 +4571,7 @@ namespace TL } /// Outgoing comments in a discussion thread were marked as read See [TLDef(0x695C9E7C)] - public class UpdateReadChannelDiscussionOutbox : Update + public sealed partial class UpdateReadChannelDiscussionOutbox : Update { /// Supergroup ID public long channel_id; @@ -4582,7 +4582,7 @@ namespace TL } /// We blocked a peer, see here » for more info on blocklists. See [TLDef(0xEBE07752)] - public class UpdatePeerBlocked : Update + public sealed partial class UpdatePeerBlocked : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4599,7 +4599,7 @@ namespace TL } /// A user is typing in a supergroup, channel or message thread See [TLDef(0x8C88C923)] - public class UpdateChannelUserTyping : Update + public sealed partial class UpdateChannelUserTyping : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4620,7 +4620,7 @@ namespace TL } /// Some messages were pinned in a chat See [TLDef(0xED85EAB5)] - public class UpdatePinnedMessages : Update + public sealed partial class UpdatePinnedMessages : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4643,7 +4643,7 @@ namespace TL } /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] - public class UpdatePinnedChannelMessages : Update + public sealed partial class UpdatePinnedChannelMessages : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4666,14 +4666,14 @@ namespace TL } /// A new chat is available See [TLDef(0xF89A6A4E)] - public class UpdateChat : Update + public partial class UpdateChat : Update { /// Chat ID public long chat_id; } /// The participant list of a certain group call has changed See [TLDef(0xF2EBDB4E)] - public class UpdateGroupCallParticipants : Update + public sealed partial class UpdateGroupCallParticipants : Update { /// Group call public InputGroupCall call; @@ -4684,7 +4684,7 @@ namespace TL } /// A new groupcall was started See [TLDef(0x14B24500)] - public class UpdateGroupCall : Update + public sealed partial class UpdateGroupCall : Update { /// The channel/supergroup where this group call or livestream takes place public long chat_id; @@ -4693,7 +4693,7 @@ namespace TL } /// The Time-To-Live for messages sent by the current user in a specific chat has changed See [TLDef(0xBB9BB9A5)] - public class UpdatePeerHistoryTTL : Update + public sealed partial class UpdatePeerHistoryTTL : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4710,7 +4710,7 @@ namespace TL } /// A user has joined or left a specific chat See [TLDef(0xD087663A)] - public class UpdateChatParticipant : Update + public sealed partial class UpdateChatParticipant : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4745,7 +4745,7 @@ namespace TL } /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] - public class UpdateChannelParticipant : Update + public sealed partial class UpdateChannelParticipant : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4782,7 +4782,7 @@ namespace TL } /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] - public class UpdateBotStopped : Update + public sealed partial class UpdateBotStopped : Update { /// The user ID public long user_id; @@ -4797,7 +4797,7 @@ namespace TL } /// New WebRTC parameters See [TLDef(0x0B783982)] - public class UpdateGroupCallConnection : Update + public sealed partial class UpdateGroupCallConnection : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4812,7 +4812,7 @@ namespace TL } /// The command set of a certain bot in a certain chat has changed. See [TLDef(0x4D712F2E)] - public class UpdateBotCommands : Update + public sealed partial class UpdateBotCommands : Update { /// The affected chat public Peer peer; @@ -4823,7 +4823,7 @@ namespace TL } /// Someone has requested to join a chat or channel See [TLDef(0x7063C3DB)] - public class UpdatePendingJoinRequests : Update + public sealed partial class UpdatePendingJoinRequests : Update { /// Chat or channel public Peer peer; @@ -4834,7 +4834,7 @@ namespace TL } /// Someone has requested to join a chat or channel (bots only, users will receive an , instead) See [TLDef(0x11DFA986)] - public class UpdateBotChatInviteRequester : Update + public sealed partial class UpdateBotChatInviteRequester : Update { /// The chat or channel in question public Peer peer; @@ -4853,7 +4853,7 @@ namespace TL } /// New message reactions » are available See [TLDef(0x5E1B3CB8)] - public class UpdateMessageReactions : Update + public sealed partial class UpdateMessageReactions : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4874,17 +4874,17 @@ namespace TL } /// The list of installed attachment menu entries » has changed, use Messages_GetAttachMenuBots to fetch the updated list. See [TLDef(0x17B7A20B)] - public class UpdateAttachMenuBots : Update { } + public sealed partial class UpdateAttachMenuBots : Update { } /// Indicates to a bot that a webview was closed and an inline message was sent on behalf of the user using Messages_SendWebViewResultMessage See [TLDef(0x1592B79D)] - public class UpdateWebViewResultSent : Update + public sealed partial class UpdateWebViewResultSent : Update { /// Web app interaction ID public long query_id; } /// The menu button behavior for the specified bot has changed See [TLDef(0x14B85813)] - public class UpdateBotMenuButton : Update + public sealed partial class UpdateBotMenuButton : Update { /// Bot ID public long bot_id; @@ -4893,10 +4893,10 @@ namespace TL } /// The list of saved notification sounds has changed, use Account_GetSavedRingtones to fetch the new list. See [TLDef(0x74D8BE99)] - public class UpdateSavedRingtones : Update { } + public sealed partial class UpdateSavedRingtones : Update { } /// A pending voice message transcription » initiated with Messages_TranscribeAudio was updated. See [TLDef(0x0084CD5A)] - public class UpdateTranscribedAudio : Update + public sealed partial class UpdateTranscribedAudio : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4917,23 +4917,23 @@ namespace TL } /// Some featured custom emoji stickers were marked as read See [TLDef(0xFB4C496C)] - public class UpdateReadFeaturedEmojiStickers : Update { } + public sealed partial class UpdateReadFeaturedEmojiStickers : Update { } /// The emoji status of a certain user has changed See [TLDef(0x28373599, inheritBefore = true)] - public class UpdateUserEmojiStatus : UpdateUser + public sealed partial class UpdateUserEmojiStatus : UpdateUser { /// New emoji status public EmojiStatus emoji_status; } /// The list of recent emoji statuses has changed See [TLDef(0x30F443DB)] - public class UpdateRecentEmojiStatuses : Update { } + public sealed partial class UpdateRecentEmojiStatuses : Update { } /// The list of recent message reactions has changed See [TLDef(0x6F7863F4)] - public class UpdateRecentReactions : Update { } + public sealed partial class UpdateRecentReactions : Update { } /// A stickerset was just moved to top, see here for more info » See [TLDef(0x86FCCF85)] - public class UpdateMoveStickerSetToTop : Update + public sealed partial class UpdateMoveStickerSetToTop : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4950,7 +4950,7 @@ namespace TL } /// Extended media update See [TLDef(0x5A73A98C)] - public class UpdateMessageExtendedMedia : Update + public sealed partial class UpdateMessageExtendedMedia : Update { /// Peer public Peer peer; @@ -4961,7 +4961,7 @@ namespace TL } /// A forum topic » was pinned or unpinned. See [TLDef(0x192EFBE3)] - public class UpdateChannelPinnedTopic : Update + public sealed partial class UpdateChannelPinnedTopic : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4978,7 +4978,7 @@ namespace TL } /// The pinned topics of a forum have changed. See [TLDef(0xFE198602)] - public class UpdateChannelPinnedTopics : Update + public sealed partial class UpdateChannelPinnedTopics : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -4995,24 +4995,24 @@ namespace TL } /// User information was updated, it must be refetched using Users_GetFullUser. See [TLDef(0x20529438)] - public class UpdateUser : Update + public partial class UpdateUser : Update { /// User ID public long user_id; } /// Media autosave settings have changed and must be refetched using Account_GetAutoSaveSettings. See [TLDef(0xEC05B097)] - public class UpdateAutoSaveSettings : Update { } + public sealed partial class UpdateAutoSaveSettings : Update { } /// 0-N updates of this type may be returned only when invoking Messages_AddChatUser, Channels_InviteToChannel or Messages_CreateChat: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead. See [TLDef(0xCCF08AD6)] - public class UpdateGroupInvitePrivacyForbidden : Update + public sealed partial class UpdateGroupInvitePrivacyForbidden : Update { /// ID of the user we couldn't add. public long user_id; } /// A new story was posted. See [TLDef(0x75B3B798)] - public class UpdateStory : Update + public sealed partial class UpdateStory : Update { /// ID of the poster. public Peer peer; @@ -5021,7 +5021,7 @@ namespace TL } /// Stories of a specific peer were marked as read. See [TLDef(0xF74E932B)] - public class UpdateReadStories : Update + public sealed partial class UpdateReadStories : Update { /// The peer public Peer peer; @@ -5030,7 +5030,7 @@ namespace TL } /// A story was successfully uploaded. See [TLDef(0x1BF335B9)] - public class UpdateStoryID : Update + public sealed partial class UpdateStoryID : Update { /// The id that was attributed to the story. public int id; @@ -5039,14 +5039,14 @@ namespace TL } /// Indicates that stories stealth mode was activated. See [TLDef(0x2C084DC1)] - public class UpdateStoriesStealthMode : Update + public sealed partial class UpdateStoriesStealthMode : Update { /// Information about the current stealth mode session. public StoriesStealthMode stealth_mode; } /// Indicates we reacted to a story ». See [TLDef(0x7D627683)] - public class UpdateSentStoryReaction : Update + public sealed partial class UpdateSentStoryReaction : Update { /// The peer that sent the story public Peer peer; @@ -5057,7 +5057,7 @@ namespace TL } /// A channel boost has changed (bots only) See [TLDef(0x904DD49C)] - public class UpdateBotChatBoost : Update + public sealed partial class UpdateBotChatBoost : Update { /// Channel public Peer peer; @@ -5070,14 +5070,14 @@ namespace TL } /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
[TLDef(0x07B68920, inheritBefore = true)] - public class UpdateChannelViewForumAsMessages : UpdateChannel + public sealed partial class UpdateChannelViewForumAsMessages : UpdateChannel { /// The new value of the toggle. public bool enabled; } /// The wallpaper » of a given peer has changed. See [TLDef(0xAE3F101D)] - public class UpdatePeerWallpaper : Update + public sealed partial class UpdatePeerWallpaper : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5096,7 +5096,7 @@ namespace TL } /// Bots only: a user has changed their reactions on a message with public reactions. See [TLDef(0xAC21D3CE)] - public class UpdateBotMessageReaction : Update + public sealed partial class UpdateBotMessageReaction : Update { /// Peer of the reacted-to message. public Peer peer; @@ -5117,7 +5117,7 @@ namespace TL } /// Bots only: the number of reactions on a message with anonymous reactions has changed. See [TLDef(0x09CB7759)] - public class UpdateBotMessageReactions : Update + public sealed partial class UpdateBotMessageReactions : Update { /// Peer of the reacted-to message. public Peer peer; @@ -5134,7 +5134,7 @@ namespace TL } /// A saved message dialog was pinned/unpinned See [TLDef(0xAEAF9E74)] - public class UpdateSavedDialogPinned : Update + public sealed partial class UpdateSavedDialogPinned : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5149,7 +5149,7 @@ namespace TL } /// Pinned saved dialogs » were updated See [TLDef(0x686C85A6)] - public class UpdatePinnedSavedDialogs : Update + public sealed partial class UpdatePinnedSavedDialogs : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5164,47 +5164,47 @@ namespace TL } /// See [TLDef(0x39C67432)] - public class UpdateSavedReactionTags : Update { } + public sealed partial class UpdateSavedReactionTags : Update { } /// See [TLDef(0xF16269D4)] - public class UpdateSmsJob : Update + public sealed partial class UpdateSmsJob : Update { public string job_id; } /// See [TLDef(0xF9470AB2)] - public class UpdateQuickReplies : Update + public sealed partial class UpdateQuickReplies : Update { public QuickReply[] quick_replies; } /// See [TLDef(0xF53DA717)] - public class UpdateNewQuickReply : Update + public sealed partial class UpdateNewQuickReply : Update { public QuickReply quick_reply; } /// See [TLDef(0x53E6F1EC)] - public class UpdateDeleteQuickReply : Update + public partial class UpdateDeleteQuickReply : Update { public int shortcut_id; } /// See [TLDef(0x3E050D0F)] - public class UpdateQuickReplyMessage : Update + public sealed partial class UpdateQuickReplyMessage : Update { public MessageBase message; } /// See [TLDef(0x566FE7CD, inheritBefore = true)] - public class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply + public sealed partial class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply { public int[] messages; } /// Updates state. See [TLDef(0xA56C2A3E)] - public class Updates_State : IObject + public sealed partial class Updates_State : IObject { /// Number of events occurred in a text box public int pts; @@ -5232,7 +5232,7 @@ namespace TL } /// No events. See [TLDef(0x5D75A138)] - public partial class Updates_DifferenceEmpty : Updates_DifferenceBase, IPeerResolver + public sealed partial class Updates_DifferenceEmpty : Updates_DifferenceBase, IPeerResolver { /// Current date public DateTime date; @@ -5247,7 +5247,7 @@ namespace TL } /// Full list of occurred events. See [TLDef(0x00F49CA0)] - public partial class Updates_Difference : Updates_DifferenceBase, IPeerResolver + public sealed partial class Updates_Difference : Updates_DifferenceBase, IPeerResolver { /// List of new messages public MessageBase[] new_messages; @@ -5273,7 +5273,7 @@ namespace TL } /// Incomplete list of occurred events. See [TLDef(0xA8FB1981)] - public partial class Updates_DifferenceSlice : Updates_DifferenceBase, IPeerResolver + public sealed partial class Updates_DifferenceSlice : Updates_DifferenceBase, IPeerResolver { /// List of new messages public MessageBase[] new_messages; @@ -5299,7 +5299,7 @@ namespace TL } /// The difference is too long, and the specified state must be used to refetch updates. See [TLDef(0x4AFE8F6D)] - public partial class Updates_DifferenceTooLong : Updates_DifferenceBase, IPeerResolver + public sealed partial class Updates_DifferenceTooLong : Updates_DifferenceBase, IPeerResolver { /// The new state to use. public int pts; @@ -5317,14 +5317,14 @@ namespace TL } /// Too many updates, it is necessary to execute Updates_GetDifference. See [TLDef(0xE317AF7E)] - public partial class UpdatesTooLong : UpdatesBase, IPeerResolver + public sealed partial class UpdatesTooLong : UpdatesBase, IPeerResolver { /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => null; } /// Info about a message sent to (received from) another user See [TLDef(0x313BC7F8)] - public partial class UpdateShortMessage : UpdatesBase, IPeerResolver + public sealed partial class UpdateShortMessage : UpdatesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5380,7 +5380,7 @@ namespace TL } /// Shortened constructor containing info on one new incoming text message from a chat See [TLDef(0x4D6DEEA5)] - public partial class UpdateShortChatMessage : UpdatesBase, IPeerResolver + public sealed partial class UpdateShortChatMessage : UpdatesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5438,7 +5438,7 @@ namespace TL } /// Shortened constructor containing info on one update not requiring auxiliary data See [TLDef(0x78D4DEC1)] - public partial class UpdateShort : UpdatesBase, IPeerResolver + public sealed partial class UpdateShort : UpdatesBase, IPeerResolver { /// Update public Update update; @@ -5452,7 +5452,7 @@ namespace TL } /// Constructor for a group of updates. See [TLDef(0x725B04C3)] - public partial class UpdatesCombined : UpdatesBase, IPeerResolver + public sealed partial class UpdatesCombined : UpdatesBase, IPeerResolver { /// List of updates public Update[] updates; @@ -5474,7 +5474,7 @@ namespace TL } /// Full constructor of updates See [TLDef(0x74AE4240)] - public partial class Updates : UpdatesBase, IPeerResolver + public sealed partial class Updates : UpdatesBase, IPeerResolver { /// List of updates public Update[] updates; @@ -5494,7 +5494,7 @@ namespace TL } /// Shortened constructor containing info on one outgoing message to a contact (the destination chat has to be extracted from the method call that returned this object). See [TLDef(0x9015E101)] - public partial class UpdateShortSentMessage : UpdatesBase, IPeerResolver + public sealed partial class UpdateShortSentMessage : UpdatesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5533,7 +5533,7 @@ namespace TL /// Full list of photos with auxiliary data. See [TLDef(0x8DCA6AA5)] - public class Photos_Photos : IObject + public partial class Photos_Photos : IObject { /// List of photos public PhotoBase[] photos; @@ -5542,7 +5542,7 @@ namespace TL } /// Incomplete list of photos with auxiliary data. See [TLDef(0x15051F54)] - public class Photos_PhotosSlice : Photos_Photos + public sealed partial class Photos_PhotosSlice : Photos_Photos { /// Total number of photos public int count; @@ -5550,7 +5550,7 @@ namespace TL /// Photo with auxiliary data. See [TLDef(0x20212CA8)] - public class Photos_Photo : IObject + public sealed partial class Photos_Photo : IObject { /// Photo public PhotoBase photo; @@ -5559,10 +5559,10 @@ namespace TL } /// Contains info on file. See Derived classes: , - public abstract class Upload_FileBase : IObject { } + public abstract partial class Upload_FileBase : IObject { } /// File content. See [TLDef(0x096A18D5)] - public class Upload_File : Upload_FileBase + public sealed partial class Upload_File : Upload_FileBase { /// File type public Storage_FileType type; @@ -5573,7 +5573,7 @@ namespace TL } /// The file must be downloaded from a CDN DC. See [TLDef(0xF18CDA44)] - public class Upload_FileCdnRedirect : Upload_FileBase + public sealed partial class Upload_FileCdnRedirect : Upload_FileBase { /// CDN DC ID public int dc_id; @@ -5589,7 +5589,7 @@ namespace TL /// Data center See [TLDef(0x18B7A10D)] - public class DcOption : IObject + public sealed partial class DcOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5623,7 +5623,7 @@ namespace TL /// Current configuration See [TLDef(0xCC1A241E)] - public class Config : IObject + public sealed partial class Config : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5747,7 +5747,7 @@ namespace TL /// Nearest data center, according to geo-ip. See [TLDef(0x8E1A1775)] - public class NearestDc : IObject + public sealed partial class NearestDc : IObject { /// Country code determined by geo-ip public string country; @@ -5760,7 +5760,7 @@ namespace TL /// An update is available for the application. See /// a value means help.noAppUpdate [TLDef(0xCCBBCE30)] - public class Help_AppUpdate : IObject + public sealed partial class Help_AppUpdate : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5794,14 +5794,14 @@ namespace TL /// Text of a text message with an invitation to install Telegram. See [TLDef(0x18CB9F78)] - public class Help_InviteText : IObject + public sealed partial class Help_InviteText : IObject { /// Text of the message public string message; } /// Object contains info on an encrypted chat. See Derived classes: , , , , - public abstract class EncryptedChatBase : IObject + public abstract partial class EncryptedChatBase : IObject { /// Chat ID public virtual int ID => default; @@ -5816,7 +5816,7 @@ namespace TL } /// Empty constructor. See [TLDef(0xAB7EC0A0)] - public class EncryptedChatEmpty : EncryptedChatBase + public sealed partial class EncryptedChatEmpty : EncryptedChatBase { /// Chat ID public int id; @@ -5826,7 +5826,7 @@ namespace TL } /// Chat waiting for approval of second participant. See [TLDef(0x66B25953)] - public class EncryptedChatWaiting : EncryptedChatBase + public sealed partial class EncryptedChatWaiting : EncryptedChatBase { /// Chat ID public int id; @@ -5852,7 +5852,7 @@ namespace TL } /// Request to create an encrypted chat. See [TLDef(0x48F1D94C)] - public class EncryptedChatRequested : EncryptedChatBase + public sealed partial class EncryptedChatRequested : EncryptedChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5890,7 +5890,7 @@ namespace TL } /// Encrypted chat See [TLDef(0x61F0D4C7)] - public class EncryptedChat : EncryptedChatBase + public sealed partial class EncryptedChat : EncryptedChatBase { /// Chat ID public int id; @@ -5920,7 +5920,7 @@ namespace TL } /// Discarded or deleted chat. See [TLDef(0x1E1C7C45)] - public class EncryptedChatDiscarded : EncryptedChatBase + public sealed partial class EncryptedChatDiscarded : EncryptedChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -5939,7 +5939,7 @@ namespace TL /// Creates an encrypted chat. See [TLDef(0xF141B5E1)] - public partial class InputEncryptedChat : IObject + public sealed partial class InputEncryptedChat : IObject { /// Chat ID public int chat_id; @@ -5950,7 +5950,7 @@ namespace TL /// Encrypted file. See /// a value means encryptedFileEmpty [TLDef(0xA8008CD8)] - public partial class EncryptedFile : IObject + public sealed partial class EncryptedFile : IObject { /// File ID public long id; @@ -5966,14 +5966,14 @@ namespace TL /// Object sets encrypted file for attachment See Derived classes: , , /// a value means inputEncryptedFileEmpty - public abstract class InputEncryptedFileBase : IObject + public abstract partial class InputEncryptedFileBase : IObject { /// Random file ID created by client public abstract long ID { get; set; } } /// Sets new encrypted file saved by parts using upload.saveFilePart method. See [TLDef(0x64BD0306)] - public class InputEncryptedFileUploaded : InputEncryptedFileBase + public sealed partial class InputEncryptedFileUploaded : InputEncryptedFileBase { /// Random file ID created by client public long id; @@ -5989,7 +5989,7 @@ namespace TL } /// Sets forwarded encrypted file for attachment. See [TLDef(0x5A17B5E5)] - public class InputEncryptedFile : InputEncryptedFileBase + public sealed partial class InputEncryptedFile : InputEncryptedFileBase { /// File ID, value of id parameter from public long id; @@ -6001,7 +6001,7 @@ namespace TL } /// Assigns a new big encrypted file (over 10 MB in size), saved in parts using the method Upload_SaveBigFilePart. See [TLDef(0x2DC173C8)] - public class InputEncryptedFileBigUploaded : InputEncryptedFileBase + public sealed partial class InputEncryptedFileBigUploaded : InputEncryptedFileBase { /// Random file id, created by the client public long id; @@ -6015,7 +6015,7 @@ namespace TL } /// Object contains encrypted message. See Derived classes: , - public abstract class EncryptedMessageBase : IObject + public abstract partial class EncryptedMessageBase : IObject { /// Random message ID, assigned by the author of message public virtual long RandomId => default; @@ -6028,7 +6028,7 @@ namespace TL } /// Encrypted message. See [TLDef(0xED18C118)] - public class EncryptedMessage : EncryptedMessageBase + public sealed partial class EncryptedMessage : EncryptedMessageBase { /// Random message ID, assigned by the author of message public long random_id; @@ -6052,7 +6052,7 @@ namespace TL } /// Encrypted service message See [TLDef(0x23734B06)] - public class EncryptedMessageService : EncryptedMessageBase + public sealed partial class EncryptedMessageService : EncryptedMessageBase { /// Random message ID, assigned by the author of message public long random_id; @@ -6074,17 +6074,17 @@ namespace TL } /// Contains Diffie-Hellman key generation protocol parameters. See Derived classes: , - public abstract class Messages_DhConfigBase : IObject { } + public abstract partial class Messages_DhConfigBase : IObject { } /// Configuring parameters did not change. See [TLDef(0xC0E24635)] - public class Messages_DhConfigNotModified : Messages_DhConfigBase + public sealed partial class Messages_DhConfigNotModified : Messages_DhConfigBase { /// Random sequence of bytes of assigned length public byte[] random; } /// New set of configuring parameters. See [TLDef(0x2C221EDD)] - public class Messages_DhConfig : Messages_DhConfigBase + public sealed partial class Messages_DhConfig : Messages_DhConfigBase { /// New value prime, see Wikipedia public int g; @@ -6098,14 +6098,14 @@ namespace TL /// Message without file attachments sent to an encrypted file. See [TLDef(0x560F8935)] - public class Messages_SentEncryptedMessage : IObject + public partial class Messages_SentEncryptedMessage : IObject { /// Date of sending public DateTime date; } /// Message with a file enclosure sent to a protected chat See [TLDef(0x9493FF32, inheritBefore = true)] - public class Messages_SentEncryptedFile : Messages_SentEncryptedMessage + public sealed partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { /// Attached file public EncryptedFile file; @@ -6114,7 +6114,7 @@ namespace TL /// Defines a document for subsequent interaction. See /// a value means inputDocumentEmpty [TLDef(0x1ABFB575)] - public partial class InputDocument : IObject + public sealed partial class InputDocument : IObject { /// Document ID public long id; @@ -6128,14 +6128,14 @@ namespace TL public abstract partial class DocumentBase : IObject { } /// Empty constructor, document doesn't exist. See [TLDef(0x36F8C871)] - public partial class DocumentEmpty : DocumentBase + public sealed partial class DocumentEmpty : DocumentBase { /// Document ID or 0 public long id; } /// Document See [TLDef(0x8FD4C4D8)] - public partial class Document : DocumentBase + public sealed partial class Document : DocumentBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6171,7 +6171,7 @@ namespace TL /// Info on support user. See [TLDef(0x17C6B5F6)] - public class Help_Support : IObject + public sealed partial class Help_Support : IObject { /// Phone number public string phone_number; @@ -6180,26 +6180,26 @@ namespace TL } /// Object defines the set of users and/or groups that generate notifications. See Derived classes: , , , , - public abstract class NotifyPeerBase : IObject { } + public abstract partial class NotifyPeerBase : IObject { } /// Notifications generated by a certain user or group. See [TLDef(0x9FD40BD8)] - public class NotifyPeer : NotifyPeerBase + public sealed partial class NotifyPeer : NotifyPeerBase { /// user or group public Peer peer; } /// Notifications generated by all users. See [TLDef(0xB4C83B4C)] - public class NotifyUsers : NotifyPeerBase { } + public sealed partial class NotifyUsers : NotifyPeerBase { } /// Notifications generated by all groups. See [TLDef(0xC007CEC3)] - public class NotifyChats : NotifyPeerBase { } + public sealed partial class NotifyChats : NotifyPeerBase { } /// Channel notification settings See [TLDef(0xD612E8EF)] - public class NotifyBroadcasts : NotifyPeerBase { } + public sealed partial class NotifyBroadcasts : NotifyPeerBase { } /// Notifications generated by a topic in a forum. See [TLDef(0x226E6308)] - public class NotifyForumTopic : NotifyPeerBase + public sealed partial class NotifyForumTopic : NotifyPeerBase { /// Forum ID public Peer peer; @@ -6211,79 +6211,79 @@ namespace TL public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] - public partial class SendMessageTypingAction : SendMessageAction { } + public sealed partial class SendMessageTypingAction : SendMessageAction { } /// Invalidate all previous action updates. E.g. when user deletes entered text or aborts a video upload. See [TLDef(0xFD5EC8F5)] - public partial class SendMessageCancelAction : SendMessageAction { } + public sealed partial class SendMessageCancelAction : SendMessageAction { } /// User is recording a video. See [TLDef(0xA187D66F)] - public class SendMessageRecordVideoAction : SendMessageAction { } + public sealed partial class SendMessageRecordVideoAction : SendMessageAction { } /// User is uploading a video. See [TLDef(0xE9763AEC)] - public class SendMessageUploadVideoAction : SendMessageAction + public sealed partial class SendMessageUploadVideoAction : SendMessageAction { /// Progress percentage public int progress; } /// User is recording a voice message. See [TLDef(0xD52F73F7)] - public class SendMessageRecordAudioAction : SendMessageAction { } + public sealed partial class SendMessageRecordAudioAction : SendMessageAction { } /// User is uploading a voice message. See [TLDef(0xF351D7AB)] - public class SendMessageUploadAudioAction : SendMessageAction + public sealed partial class SendMessageUploadAudioAction : SendMessageAction { /// Progress percentage public int progress; } /// User is uploading a photo. See [TLDef(0xD1D34A26)] - public class SendMessageUploadPhotoAction : SendMessageAction + public sealed partial class SendMessageUploadPhotoAction : SendMessageAction { /// Progress percentage public int progress; } /// User is uploading a file. See [TLDef(0xAA0CD9E4)] - public class SendMessageUploadDocumentAction : SendMessageAction + public sealed partial class SendMessageUploadDocumentAction : SendMessageAction { /// Progress percentage public int progress; } /// User is selecting a location to share. See [TLDef(0x176F8BA1)] - public partial class SendMessageGeoLocationAction : SendMessageAction { } + public sealed partial class SendMessageGeoLocationAction : SendMessageAction { } /// User is selecting a contact to share. See [TLDef(0x628CBC6F)] - public class SendMessageChooseContactAction : SendMessageAction { } + public sealed partial class SendMessageChooseContactAction : SendMessageAction { } /// User is playing a game See [TLDef(0xDD6A8F48)] - public partial class SendMessageGamePlayAction : SendMessageAction { } + public sealed partial class SendMessageGamePlayAction : SendMessageAction { } /// User is recording a round video to share See [TLDef(0x88F27FBC)] - public class SendMessageRecordRoundAction : SendMessageAction { } + public sealed partial class SendMessageRecordRoundAction : SendMessageAction { } /// User is uploading a round video See [TLDef(0x243E1C66)] - public class SendMessageUploadRoundAction : SendMessageAction + public sealed partial class SendMessageUploadRoundAction : SendMessageAction { /// Progress percentage public int progress; } /// User is currently speaking in the group call See [TLDef(0xD92C2285)] - public partial class SpeakingInGroupCallAction : SendMessageAction { } + public sealed partial class SpeakingInGroupCallAction : SendMessageAction { } /// Chat history is being imported See [TLDef(0xDBDA9246)] - public partial class SendMessageHistoryImportAction : SendMessageAction + public sealed partial class SendMessageHistoryImportAction : SendMessageAction { /// Progress percentage public int progress; } /// User is choosing a sticker See [TLDef(0xB05AC6B1)] - public class SendMessageChooseStickerAction : SendMessageAction { } + public sealed partial class SendMessageChooseStickerAction : SendMessageAction { } /// User has clicked on an animated emoji triggering a reaction, click here for more info ». See [TLDef(0x25972BCB)] - public partial class SendMessageEmojiInteraction : SendMessageAction + public sealed partial class SendMessageEmojiInteraction : SendMessageAction { /// Emoji public string emoticon; @@ -6294,7 +6294,7 @@ namespace TL } /// User is watching an animated emoji reaction triggered by another user, click here for more info ». See [TLDef(0xB665902E)] - public partial class SendMessageEmojiInteractionSeen : SendMessageAction + public sealed partial class SendMessageEmojiInteractionSeen : SendMessageAction { /// Emoji public string emoticon; @@ -6302,7 +6302,7 @@ namespace TL /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] - public class Contacts_Found : IObject, IPeerResolver + public sealed partial class Contacts_Found : IObject, IPeerResolver { /// Personalized results public Peer[] my_results; @@ -6367,100 +6367,100 @@ namespace TL } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , - public abstract class InputPrivacyRule : IObject { } + public abstract partial class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] - public class InputPrivacyValueAllowContacts : InputPrivacyRule { } + public sealed partial class InputPrivacyValueAllowContacts : InputPrivacyRule { } /// Allow all users See [TLDef(0x184B35CE)] - public class InputPrivacyValueAllowAll : InputPrivacyRule { } + public sealed partial class InputPrivacyValueAllowAll : InputPrivacyRule { } /// Allow only certain users See [TLDef(0x131CC67F)] - public class InputPrivacyValueAllowUsers : InputPrivacyRule + public sealed partial class InputPrivacyValueAllowUsers : InputPrivacyRule { /// Allowed users public InputUserBase[] users; } /// Disallow only contacts See [TLDef(0x0BA52007)] - public class InputPrivacyValueDisallowContacts : InputPrivacyRule { } + public sealed partial class InputPrivacyValueDisallowContacts : InputPrivacyRule { } /// Disallow all See [TLDef(0xD66B66C9)] - public class InputPrivacyValueDisallowAll : InputPrivacyRule { } + public sealed partial class InputPrivacyValueDisallowAll : InputPrivacyRule { } /// Disallow only certain users See [TLDef(0x90110467)] - public class InputPrivacyValueDisallowUsers : InputPrivacyRule + public sealed partial class InputPrivacyValueDisallowUsers : InputPrivacyRule { /// Users to disallow public InputUserBase[] users; } /// Allow only participants of certain chats See [TLDef(0x840649CF)] - public class InputPrivacyValueAllowChatParticipants : InputPrivacyRule + public sealed partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { /// Allowed chat IDs public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0xE94F0F86)] - public class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule + public sealed partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { /// Disallowed chat IDs public long[] chats; } /// Allow only close friends » See [TLDef(0x2F453E49)] - public class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } + public sealed partial class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , - public abstract class PrivacyRule : IObject { } + public abstract partial class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] - public class PrivacyValueAllowContacts : PrivacyRule { } + public sealed partial class PrivacyValueAllowContacts : PrivacyRule { } /// Allow all users See [TLDef(0x65427B82)] - public class PrivacyValueAllowAll : PrivacyRule { } + public sealed partial class PrivacyValueAllowAll : PrivacyRule { } /// Allow only certain users See [TLDef(0xB8905FB2)] - public class PrivacyValueAllowUsers : PrivacyRule + public sealed partial class PrivacyValueAllowUsers : PrivacyRule { /// Allowed users public long[] users; } /// Disallow only contacts See [TLDef(0xF888FA1A)] - public class PrivacyValueDisallowContacts : PrivacyRule { } + public sealed partial class PrivacyValueDisallowContacts : PrivacyRule { } /// Disallow all users See [TLDef(0x8B73E763)] - public class PrivacyValueDisallowAll : PrivacyRule { } + public sealed partial class PrivacyValueDisallowAll : PrivacyRule { } /// Disallow only certain users See [TLDef(0xE4621141)] - public class PrivacyValueDisallowUsers : PrivacyRule + public sealed partial class PrivacyValueDisallowUsers : PrivacyRule { /// Disallowed users public long[] users; } /// Allow all participants of certain chats See [TLDef(0x6B134E8E)] - public class PrivacyValueAllowChatParticipants : PrivacyRule + public sealed partial class PrivacyValueAllowChatParticipants : PrivacyRule { /// Allowed chats public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0x41C87565)] - public class PrivacyValueDisallowChatParticipants : PrivacyRule + public sealed partial class PrivacyValueDisallowChatParticipants : PrivacyRule { /// Disallowed chats public long[] chats; } /// Allow only close friends » See [TLDef(0xF7E8D89B)] - public class PrivacyValueAllowCloseFriends : PrivacyRule { } + public sealed partial class PrivacyValueAllowCloseFriends : PrivacyRule { } /// Privacy rules See [TLDef(0x50A04E45)] - public class Account_PrivacyRules : IObject, IPeerResolver + public sealed partial class Account_PrivacyRules : IObject, IPeerResolver { /// Privacy rules public PrivacyRule[] rules; @@ -6474,17 +6474,17 @@ namespace TL /// Time to live in days of the current account See [TLDef(0xB8D0AFDF)] - public class AccountDaysTTL : IObject + public sealed partial class AccountDaysTTL : IObject { /// This account will self-destruct in the specified number of days public int days; } /// Various possible attributes of a document (used to define if it's a sticker, a GIF, a video, a mask sticker, an image, an audio, and so on) See Derived classes: , , , , , , , - public abstract class DocumentAttribute : IObject { } + public abstract partial class DocumentAttribute : IObject { } /// Defines the width and height of an image uploaded as document See [TLDef(0x6C37C15C)] - public class DocumentAttributeImageSize : DocumentAttribute + public sealed partial class DocumentAttributeImageSize : DocumentAttribute { /// Width of image public int w; @@ -6493,10 +6493,10 @@ namespace TL } /// Defines an animated GIF See [TLDef(0x11B58939)] - public class DocumentAttributeAnimated : DocumentAttribute { } + public sealed partial class DocumentAttributeAnimated : DocumentAttribute { } /// Defines a sticker See [TLDef(0x6319D612)] - public class DocumentAttributeSticker : DocumentAttribute + public sealed partial class DocumentAttributeSticker : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6517,7 +6517,7 @@ namespace TL } /// Defines a video See [TLDef(0xD38FF1C2)] - public class DocumentAttributeVideo : DocumentAttribute + public sealed partial class DocumentAttributeVideo : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6544,7 +6544,7 @@ namespace TL } /// Represents an audio file See [TLDef(0x9852F9C6)] - public class DocumentAttributeAudio : DocumentAttribute + public sealed partial class DocumentAttributeAudio : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6571,17 +6571,17 @@ namespace TL } /// A simple document with a file name See [TLDef(0x15590068)] - public class DocumentAttributeFilename : DocumentAttribute + public sealed partial class DocumentAttributeFilename : DocumentAttribute { /// The file name public string file_name; } /// Whether the current document has stickers attached See [TLDef(0x9801D2F7)] - public class DocumentAttributeHasStickers : DocumentAttribute { } + public sealed partial class DocumentAttributeHasStickers : DocumentAttribute { } /// Info about a custom emoji See [TLDef(0xFD149899)] - public class DocumentAttributeCustomEmoji : DocumentAttribute + public sealed partial class DocumentAttributeCustomEmoji : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6602,7 +6602,7 @@ namespace TL /// Found stickers See /// a value means messages.stickersNotModified [TLDef(0x30A6EC7E)] - public class Messages_Stickers : IObject + public sealed partial class Messages_Stickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -6612,7 +6612,7 @@ namespace TL /// A stickerpack is a group of stickers associated to the same emoji.
It is not a sticker pack the way it is usually intended, you may be looking for a . See
[TLDef(0x12B299D4)] - public class StickerPack : IObject + public sealed partial class StickerPack : IObject { /// Emoji public string emoticon; @@ -6623,7 +6623,7 @@ namespace TL /// Info about all installed stickers See /// a value means messages.allStickersNotModified [TLDef(0xCDBBCEBB)] - public class Messages_AllStickers : IObject + public sealed partial class Messages_AllStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -6633,7 +6633,7 @@ namespace TL /// Events affected by operation See [TLDef(0x84D19185)] - public class Messages_AffectedMessages : IObject + public partial class Messages_AffectedMessages : IObject { /// Event count after generation public int pts; @@ -6642,7 +6642,7 @@ namespace TL } /// Instant View webpage preview See Derived classes: , , , - public abstract class WebPageBase : IObject + public abstract partial class WebPageBase : IObject { /// Preview ID public virtual long ID => default; @@ -6651,7 +6651,7 @@ namespace TL } /// No preview is available for the webpage See [TLDef(0x211A1788)] - public class WebPageEmpty : WebPageBase + public sealed partial class WebPageEmpty : WebPageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6673,7 +6673,7 @@ namespace TL } /// A preview of the webpage is currently being generated See [TLDef(0xB0D13E47)] - public class WebPagePending : WebPageBase + public sealed partial class WebPagePending : WebPageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6697,7 +6697,7 @@ namespace TL } /// Webpage preview See [TLDef(0xE89C45B2)] - public class WebPage : WebPageBase + public sealed partial class WebPage : WebPageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6775,7 +6775,7 @@ namespace TL } /// The preview of the webpage hasn't changed See [TLDef(0x7311CA11)] - public class WebPageNotModified : WebPageBase + public sealed partial class WebPageNotModified : WebPageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6791,7 +6791,7 @@ namespace TL /// Logged-in session See [TLDef(0xAD01D61D)] - public class Authorization : IObject + public sealed partial class Authorization : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6839,7 +6839,7 @@ namespace TL /// Logged-in sessions See [TLDef(0x4BFF8EA0)] - public class Account_Authorizations : IObject + public sealed partial class Account_Authorizations : IObject { /// Time-to-live of session public int authorization_ttl_days; @@ -6849,7 +6849,7 @@ namespace TL /// Configuration for two-factor authorization See [TLDef(0x957B50FB)] - public class Account_Password : IObject + public sealed partial class Account_Password : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6895,7 +6895,7 @@ namespace TL /// Private info associated to the password info (recovery email, telegram passport info & so on) See [TLDef(0x9A5C33E5)] - public class Account_PasswordSettings : IObject + public sealed partial class Account_PasswordSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6915,7 +6915,7 @@ namespace TL /// Settings for setting up a new password See [TLDef(0xC23727C9)] - public class Account_PasswordInputSettings : IObject + public sealed partial class Account_PasswordInputSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6943,7 +6943,7 @@ namespace TL /// Recovery info of a 2FA password, only for accounts with a recovery email configured. See [TLDef(0x137948A5)] - public class Auth_PasswordRecovery : IObject + public sealed partial class Auth_PasswordRecovery : IObject { /// The email to which the recovery code was sent must match this pattern. public string email_pattern; @@ -6951,7 +6951,7 @@ namespace TL /// Message ID, for which PUSH-notifications were cancelled. See [TLDef(0xA384B779)] - public class ReceivedNotifyMessage : IObject + public sealed partial class ReceivedNotifyMessage : IObject { /// Message ID, for which PUSH-notifications were canceled public int id; @@ -6960,10 +6960,10 @@ namespace TL } /// Exported chat invite See Derived classes: , - public abstract class ExportedChatInvite : IObject { } + public abstract partial class ExportedChatInvite : IObject { } /// Exported chat invite See [TLDef(0x0AB4A819)] - public class ChatInviteExported : ExportedChatInvite + public sealed partial class ChatInviteExported : ExportedChatInvite { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7010,20 +7010,20 @@ namespace TL } /// Used in updates and in the channel log to indicate when a user is requesting to join or has joined a discussion group See [TLDef(0xED107AB7)] - public class ChatInvitePublicJoinRequests : ExportedChatInvite { } + public sealed partial class ChatInvitePublicJoinRequests : ExportedChatInvite { } /// Chat invite See Derived classes: , , - public abstract class ChatInviteBase : IObject { } + public abstract partial class ChatInviteBase : IObject { } /// The user has already joined this chat See [TLDef(0x5A686D7C)] - public class ChatInviteAlready : ChatInviteBase + public sealed partial class ChatInviteAlready : ChatInviteBase { /// The chat connected to the invite public ChatBase chat; } /// Chat invite info See [TLDef(0xCDE0EC40)] - public class ChatInvite : ChatInviteBase + public sealed partial class ChatInvite : ChatInviteBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7066,7 +7066,7 @@ namespace TL } /// A chat invitation that also allows peeking into the group to read messages without joining it. See [TLDef(0x61695CB0)] - public class ChatInvitePeek : ChatInviteBase + public sealed partial class ChatInvitePeek : ChatInviteBase { /// Chat information public ChatBase chat; @@ -7079,7 +7079,7 @@ namespace TL public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See [TLDef(0x9DE7A269)] - public class InputStickerSetID : InputStickerSet + public sealed partial class InputStickerSetID : InputStickerSet { /// ID public long id; @@ -7088,43 +7088,43 @@ namespace TL } /// Stickerset by short name, from a stickerset deep link » See [TLDef(0x861CC8A0)] - public class InputStickerSetShortName : InputStickerSet + public sealed partial class InputStickerSetShortName : InputStickerSet { /// Short name from a stickerset deep link » public string short_name; } /// Animated emojis stickerset See [TLDef(0x028703C8)] - public class InputStickerSetAnimatedEmoji : InputStickerSet { } + public sealed partial class InputStickerSetAnimatedEmoji : InputStickerSet { } /// Used for fetching animated dice stickers See [TLDef(0xE67F520E)] - public class InputStickerSetDice : InputStickerSet + public sealed partial class InputStickerSetDice : InputStickerSet { /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; } /// Animated emoji reaction stickerset (contains animations to play when a user clicks on a given animated emoji) See [TLDef(0x0CDE3739)] - public class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } + public sealed partial class InputStickerSetAnimatedEmojiAnimations : InputStickerSet { } /// Stickers to show when receiving a gifted Telegram Premium subscription See [TLDef(0xC88B3B02)] - public class InputStickerSetPremiumGifts : InputStickerSet { } + public sealed partial class InputStickerSetPremiumGifts : InputStickerSet { } /// Generic animation stickerset containing animations to play when reacting to messages using a normal emoji without a custom animation See [TLDef(0x04C4D4CE)] - public class InputStickerSetEmojiGenericAnimations : InputStickerSet { } + public sealed partial class InputStickerSetEmojiGenericAnimations : InputStickerSet { } /// Default custom emoji status stickerset See [TLDef(0x29D0F5EE)] - public class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } + public sealed partial class InputStickerSetEmojiDefaultStatuses : InputStickerSet { } /// Default custom emoji stickerset for forum topic icons See [TLDef(0x44C1F8E9)] - public class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } + public sealed partial class InputStickerSetEmojiDefaultTopicIcons : InputStickerSet { } /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] - public class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } + public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] - public partial class StickerSet : IObject + public sealed partial class StickerSet : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7181,7 +7181,7 @@ namespace TL /// Stickerset and stickers inside it See /// a value means messages.stickerSetNotModified [TLDef(0x6E153F16)] - public class Messages_StickerSet : IObject + public sealed partial class Messages_StickerSet : IObject { /// The stickerset public StickerSet set; @@ -7195,7 +7195,7 @@ namespace TL /// Describes a bot command that can be used in a chat See [TLDef(0xC27AC8C7)] - public class BotCommand : IObject + public sealed partial class BotCommand : IObject { /// /command name public string command; @@ -7205,7 +7205,7 @@ namespace TL /// Info about bots (available bot commands, etc) See [TLDef(0x8F300B57)] - public class BotInfo : IObject + public sealed partial class BotInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7240,14 +7240,14 @@ namespace TL } /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , - public abstract class KeyboardButtonBase : IObject + public abstract partial class KeyboardButtonBase : IObject { /// Button text public virtual string Text => default; } /// Bot keyboard button See [TLDef(0xA2FA4880)] - public class KeyboardButton : KeyboardButtonBase + public partial class KeyboardButton : KeyboardButtonBase { /// Button text public string text; @@ -7257,14 +7257,14 @@ namespace TL } /// URL button See [TLDef(0x258AFF05, inheritBefore = true)] - public class KeyboardButtonUrl : KeyboardButton + public sealed partial class KeyboardButtonUrl : KeyboardButton { /// URL public string url; } /// Callback button See [TLDef(0x35BBDB6B)] - public class KeyboardButtonCallback : KeyboardButtonBase + public sealed partial class KeyboardButtonCallback : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7284,17 +7284,17 @@ namespace TL } /// Button to request a user's phone number See [TLDef(0xB16A6C29)] - public class KeyboardButtonRequestPhone : KeyboardButton + public sealed partial class KeyboardButtonRequestPhone : KeyboardButton { } /// Button to request a user's geolocation See [TLDef(0xFC796B3F)] - public class KeyboardButtonRequestGeoLocation : KeyboardButton + public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButton { } /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See [TLDef(0x93B9FBB5)] - public class KeyboardButtonSwitchInline : KeyboardButtonBase + public sealed partial class KeyboardButtonSwitchInline : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7318,17 +7318,17 @@ namespace TL } /// Button to start a game See [TLDef(0x50F41CCF)] - public class KeyboardButtonGame : KeyboardButton + public sealed partial class KeyboardButtonGame : KeyboardButton { } /// Button to buy a product See [TLDef(0xAFD93FBB)] - public class KeyboardButtonBuy : KeyboardButton + public sealed partial class KeyboardButtonBuy : KeyboardButton { } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See [TLDef(0x10B78D29)] - public class KeyboardButtonUrlAuth : KeyboardButtonBase + public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7352,7 +7352,7 @@ namespace TL } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0xD02E7FD4)] - public class InputKeyboardButtonUrlAuth : KeyboardButtonBase + public sealed partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7378,7 +7378,7 @@ namespace TL } /// A button that allows the user to create and send a poll when pressed; available only in private See [TLDef(0xBBC7515D)] - public class KeyboardButtonRequestPoll : KeyboardButton + public sealed partial class KeyboardButtonRequestPoll : KeyboardButton { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7393,7 +7393,7 @@ namespace TL } /// Button that links directly to a user profile See [TLDef(0xE988037B)] - public class InputKeyboardButtonUserProfile : KeyboardButtonBase + public sealed partial class InputKeyboardButtonUserProfile : KeyboardButtonBase { /// Button text public string text; @@ -7405,26 +7405,26 @@ namespace TL } /// Button that links directly to a user profile See [TLDef(0x308660C1, inheritBefore = true)] - public class KeyboardButtonUserProfile : KeyboardButton + public sealed partial class KeyboardButtonUserProfile : KeyboardButton { /// User ID public long user_id; } /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See [TLDef(0x13767230, inheritBefore = true)] - public class KeyboardButtonWebView : KeyboardButton + public partial class KeyboardButtonWebView : KeyboardButton { /// Web app url public string url; } /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See [TLDef(0xA0C0505C)] - public class KeyboardButtonSimpleWebView : KeyboardButtonWebView + public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonWebView { } /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See [TLDef(0x53D7BFD8, inheritBefore = true)] - public class KeyboardButtonRequestPeer : KeyboardButton + public sealed partial class KeyboardButtonRequestPeer : KeyboardButton { /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; @@ -7436,17 +7436,17 @@ namespace TL /// Inline keyboard row See [TLDef(0x77608B83)] - public class KeyboardButtonRow : IObject + public sealed partial class KeyboardButtonRow : IObject { /// Bot or inline keyboard buttons public KeyboardButtonBase[] buttons; } /// Reply markup for bot and inline keyboards See Derived classes: , , , - public abstract class ReplyMarkup : IObject { } + public abstract partial class ReplyMarkup : IObject { } /// Hide sent bot keyboard See [TLDef(0xA03E5B85)] - public class ReplyKeyboardHide : ReplyMarkup + public sealed partial class ReplyKeyboardHide : ReplyMarkup { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7459,7 +7459,7 @@ namespace TL } /// Force the user to send a reply See [TLDef(0x86B40B08)] - public class ReplyKeyboardForceReply : ReplyMarkup + public sealed partial class ReplyKeyboardForceReply : ReplyMarkup { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7478,7 +7478,7 @@ namespace TL } /// Bot keyboard See [TLDef(0x85DD99D1)] - public class ReplyKeyboardMarkup : ReplyMarkup + public sealed partial class ReplyKeyboardMarkup : ReplyMarkup { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7503,7 +7503,7 @@ namespace TL } /// Bot or inline keyboard See [TLDef(0x48A30254)] - public class ReplyInlineMarkup : ReplyMarkup + public sealed partial class ReplyInlineMarkup : ReplyMarkup { /// Bot or inline keyboard rows public KeyboardButtonRow[] rows; @@ -7519,98 +7519,98 @@ namespace TL } /// Unknown message entity See [TLDef(0xBB92BA95)] - public class MessageEntityUnknown : MessageEntity { } + public sealed partial class MessageEntityUnknown : MessageEntity { } /// Message entity mentioning a user by @username; can also be used to mention users by their ID. See [TLDef(0xFA04579D)] - public class MessageEntityMention : MessageEntity { } + public sealed partial class MessageEntityMention : MessageEntity { } /// #hashtag message entity See [TLDef(0x6F635B0D)] - public class MessageEntityHashtag : MessageEntity { } + public sealed partial class MessageEntityHashtag : MessageEntity { } /// Message entity representing a bot /command See [TLDef(0x6CEF8AC7)] - public class MessageEntityBotCommand : MessageEntity { } + public sealed partial class MessageEntityBotCommand : MessageEntity { } /// Message entity representing an in-text url: https://google.com; for text urls, use . See [TLDef(0x6ED02538)] - public class MessageEntityUrl : MessageEntity { } + public sealed partial class MessageEntityUrl : MessageEntity { } /// Message entity representing an email@example.com. See [TLDef(0x64E475C2)] - public class MessageEntityEmail : MessageEntity { } + public sealed partial class MessageEntityEmail : MessageEntity { } /// Message entity representing bold text. See [TLDef(0xBD610BC9)] - public class MessageEntityBold : MessageEntity { } + public sealed partial class MessageEntityBold : MessageEntity { } /// Message entity representing italic text. See [TLDef(0x826F8B60)] - public class MessageEntityItalic : MessageEntity { } + public sealed partial class MessageEntityItalic : MessageEntity { } /// Message entity representing a codeblock. See [TLDef(0x28A20571)] - public class MessageEntityCode : MessageEntity { } + public sealed partial class MessageEntityCode : MessageEntity { } /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock. See [TLDef(0x73924BE0, inheritBefore = true)] - public class MessageEntityPre : MessageEntity + public sealed partial class MessageEntityPre : MessageEntity { /// Programming language of the code public string language; } /// Message entity representing a text url: for in-text urls like https://google.com use . See [TLDef(0x76A6D327, inheritBefore = true)] - public class MessageEntityTextUrl : MessageEntity + public sealed partial class MessageEntityTextUrl : MessageEntity { /// The actual URL public string url; } /// Message entity representing a user mention: for creating a mention use . See [TLDef(0xDC7B1140, inheritBefore = true)] - public class MessageEntityMentionName : MessageEntity + public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public long user_id; } /// Message entity that can be used to create a user user mention: received mentions use the , instead. See [TLDef(0x208E68C9, inheritBefore = true)] - public class InputMessageEntityMentionName : MessageEntity + public sealed partial class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public InputUserBase user_id; } /// Message entity representing a phone number. See [TLDef(0x9B69E34B)] - public class MessageEntityPhone : MessageEntity { } + public sealed partial class MessageEntityPhone : MessageEntity { } /// Message entity representing a $cashtag. See [TLDef(0x4C4E743F)] - public class MessageEntityCashtag : MessageEntity { } + public sealed partial class MessageEntityCashtag : MessageEntity { } /// Message entity representing underlined text. See [TLDef(0x9C4E7E8B)] - public class MessageEntityUnderline : MessageEntity { } + public sealed partial class MessageEntityUnderline : MessageEntity { } /// Message entity representing strikethrough text. See [TLDef(0xBF0693D4)] - public class MessageEntityStrike : MessageEntity { } + public sealed partial class MessageEntityStrike : MessageEntity { } /// Indicates a credit card number See [TLDef(0x761E6AF4)] - public class MessageEntityBankCard : MessageEntity { } + public sealed partial class MessageEntityBankCard : MessageEntity { } /// Message entity representing a spoiler See [TLDef(0x32CA960F)] - public class MessageEntitySpoiler : MessageEntity { } + public sealed partial class MessageEntitySpoiler : MessageEntity { } /// Represents a custom emoji.
Note that this entity must wrap exactly one regular emoji (the one contained in .alt) in the related text, otherwise the server will ignore it. See
[TLDef(0xC8CF05F8, inheritBefore = true)] - public class MessageEntityCustomEmoji : MessageEntity + public sealed partial class MessageEntityCustomEmoji : MessageEntity { /// Document ID of the custom emoji, use Messages_GetCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. public long document_id; } /// Message entity representing a block quote. See [TLDef(0x020DF5D0)] - public class MessageEntityBlockquote : MessageEntity { } + public sealed partial class MessageEntityBlockquote : MessageEntity { } /// Represents a channel See Derived classes: , /// a value means inputChannelEmpty - public abstract class InputChannelBase : IObject + public abstract partial class InputChannelBase : IObject { /// Channel ID public abstract long ChannelId { get; set; } } /// Represents a channel See [TLDef(0xF35AEC28)] - public partial class InputChannel : InputChannelBase + public sealed partial class InputChannel : InputChannelBase { /// Channel ID public long channel_id; @@ -7622,7 +7622,7 @@ namespace TL } /// Defines a min channel that was seen in a certain message of a certain chat. See [TLDef(0x5B934F9D)] - public class InputChannelFromMessage : InputChannelBase + public sealed partial class InputChannelFromMessage : InputChannelBase { /// The chat where the channel was seen public InputPeer peer; @@ -7637,7 +7637,7 @@ namespace TL /// Resolved peer See [TLDef(0x7F077AD9)] - public partial class Contacts_ResolvedPeer : IObject + public sealed partial class Contacts_ResolvedPeer : IObject { /// The peer public Peer peer; @@ -7651,7 +7651,7 @@ namespace TL /// Indicates a range of chat messages See [TLDef(0x0AE30253)] - public class MessageRange : IObject + public sealed partial class MessageRange : IObject { /// Start of range (message ID) public int min_id; @@ -7667,7 +7667,7 @@ namespace TL } /// There are no new updates See [TLDef(0x3E11AFFB)] - public partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase, IPeerResolver + public sealed partial class Updates_ChannelDifferenceEmpty : Updates_ChannelDifferenceBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7688,7 +7688,7 @@ namespace TL } /// The provided pts + limit < remote pts. Simply, there are too many updates to be fetched (more than limit), the client has to resolve the update gap in one of the following ways (assuming the existence of a persistent database to locally store messages): See [TLDef(0xA4BCC6FE)] - public partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase, IPeerResolver + public sealed partial class Updates_ChannelDifferenceTooLong : Updates_ChannelDifferenceBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7715,7 +7715,7 @@ namespace TL } /// The new updates See [TLDef(0x2064674E)] - public partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase, IPeerResolver + public sealed partial class Updates_ChannelDifference : Updates_ChannelDifferenceBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7746,7 +7746,7 @@ namespace TL /// Filter for getting only certain types of channel messages See /// a value means channelMessagesFilterEmpty [TLDef(0xCD77D957)] - public class ChannelMessagesFilter : IObject + public sealed partial class ChannelMessagesFilter : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7764,7 +7764,7 @@ namespace TL public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See [TLDef(0xC00C07C0)] - public partial class ChannelParticipant : ChannelParticipantBase + public sealed partial class ChannelParticipant : ChannelParticipantBase { /// Participant user ID public long user_id; @@ -7773,7 +7773,7 @@ namespace TL } /// Myself See [TLDef(0x35A8BFA7)] - public partial class ChannelParticipantSelf : ChannelParticipantBase + public sealed partial class ChannelParticipantSelf : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7792,7 +7792,7 @@ namespace TL } /// Channel/supergroup creator See [TLDef(0x2FE601D3)] - public partial class ChannelParticipantCreator : ChannelParticipantBase + public sealed partial class ChannelParticipantCreator : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7811,7 +7811,7 @@ namespace TL } /// Admin See [TLDef(0x34C3BB53)] - public partial class ChannelParticipantAdmin : ChannelParticipantBase + public sealed partial class ChannelParticipantAdmin : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7840,7 +7840,7 @@ namespace TL } /// Banned/kicked user See [TLDef(0x6DF8014E)] - public partial class ChannelParticipantBanned : ChannelParticipantBase + public sealed partial class ChannelParticipantBanned : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7861,54 +7861,54 @@ namespace TL } /// A participant that left the channel/supergroup See [TLDef(0x1B03F006)] - public partial class ChannelParticipantLeft : ChannelParticipantBase + public sealed partial class ChannelParticipantLeft : ChannelParticipantBase { /// The peer that left public Peer peer; } /// Filter for fetching channel participants See Derived classes: , , , , , , , - public abstract class ChannelParticipantsFilter : IObject { } + public abstract partial class ChannelParticipantsFilter : IObject { } /// Fetch only recent participants See [TLDef(0xDE3F3C79)] - public class ChannelParticipantsRecent : ChannelParticipantsFilter { } + public sealed partial class ChannelParticipantsRecent : ChannelParticipantsFilter { } /// Fetch only admin participants See [TLDef(0xB4608969)] - public class ChannelParticipantsAdmins : ChannelParticipantsFilter { } + public sealed partial class ChannelParticipantsAdmins : ChannelParticipantsFilter { } /// Fetch only kicked participants See [TLDef(0xA3B54985)] - public class ChannelParticipantsKicked : ChannelParticipantsFilter + public sealed partial class ChannelParticipantsKicked : ChannelParticipantsFilter { /// Optional filter for searching kicked participants by name (otherwise empty) public string q; } /// Fetch only bot participants See [TLDef(0xB0D1865B)] - public class ChannelParticipantsBots : ChannelParticipantsFilter { } + public sealed partial class ChannelParticipantsBots : ChannelParticipantsFilter { } /// Fetch only banned participants See [TLDef(0x1427A5E1)] - public class ChannelParticipantsBanned : ChannelParticipantsFilter + public sealed partial class ChannelParticipantsBanned : ChannelParticipantsFilter { /// Optional filter for searching banned participants by name (otherwise empty) public string q; } /// Query participants by name See [TLDef(0x0656AC4B)] - public class ChannelParticipantsSearch : ChannelParticipantsFilter + public sealed partial class ChannelParticipantsSearch : ChannelParticipantsFilter { /// Search query public string q; } /// Fetch only participants that are also contacts See [TLDef(0xBB6AE88D)] - public class ChannelParticipantsContacts : ChannelParticipantsFilter + public sealed partial class ChannelParticipantsContacts : ChannelParticipantsFilter { /// Optional search query for searching contact participants by name public string q; } /// This filter is used when looking for supergroup members to mention.
This filter will automatically remove anonymous admins, and return even non-participant users that replied to a specific
thread through the comment section of a channel. See
[TLDef(0xE04B5CEB)] - public class ChannelParticipantsMentions : ChannelParticipantsFilter + public sealed partial class ChannelParticipantsMentions : ChannelParticipantsFilter { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7929,7 +7929,7 @@ namespace TL /// Represents multiple channel participants See /// a value means channels.channelParticipantsNotModified [TLDef(0x9AB0FEAF)] - public class Channels_ChannelParticipants : IObject, IPeerResolver + public sealed partial class Channels_ChannelParticipants : IObject, IPeerResolver { /// Total number of participants that correspond to the given query public int count; @@ -7945,7 +7945,7 @@ namespace TL /// Represents a channel participant See [TLDef(0xDFB80317)] - public class Channels_ChannelParticipant : IObject, IPeerResolver + public sealed partial class Channels_ChannelParticipant : IObject, IPeerResolver { /// The channel participant public ChannelParticipantBase participant; @@ -7959,7 +7959,7 @@ namespace TL /// Info about the latest telegram Terms Of Service See [TLDef(0x780A0310)] - public class Help_TermsOfService : IObject + public sealed partial class Help_TermsOfService : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -7984,7 +7984,7 @@ namespace TL /// Saved gifs See /// a value means messages.savedGifsNotModified [TLDef(0x84A02A0D)] - public class Messages_SavedGifs : IObject + public sealed partial class Messages_SavedGifs : IObject { /// Hash for pagination, for more info click here public long hash; @@ -7993,10 +7993,10 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot See Derived classes: , , , , , , , - public abstract class InputBotInlineMessage : IObject { } + public abstract partial class InputBotInlineMessage : IObject { } /// A media See [TLDef(0x3380C786)] - public class InputBotInlineMessageMediaAuto : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaAuto : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8019,7 +8019,7 @@ namespace TL } /// Simple text message See [TLDef(0x3DCD7A87)] - public class InputBotInlineMessageText : InputBotInlineMessage + public sealed partial class InputBotInlineMessageText : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8044,7 +8044,7 @@ namespace TL } /// Geolocation See [TLDef(0x96929A85)] - public class InputBotInlineMessageMediaGeo : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaGeo : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8073,7 +8073,7 @@ namespace TL } /// Venue See [TLDef(0x417BBF11)] - public class InputBotInlineMessageMediaVenue : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaVenue : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8100,7 +8100,7 @@ namespace TL } /// A contact See [TLDef(0xA6EDBFFD)] - public class InputBotInlineMessageMediaContact : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaContact : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8123,7 +8123,7 @@ namespace TL } /// A game See [TLDef(0x4B425864)] - public class InputBotInlineMessageGame : InputBotInlineMessage + public sealed partial class InputBotInlineMessageGame : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8138,7 +8138,7 @@ namespace TL } /// An invoice See [TLDef(0xD7E78225)] - public class InputBotInlineMessageMediaInvoice : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaInvoice : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8169,7 +8169,7 @@ namespace TL } /// Specifies options that will be used to generate the link preview for the message, or even a standalone link preview without an attached message. See [TLDef(0xBDDCC510)] - public class InputBotInlineMessageMediaWebPage : InputBotInlineMessage + public sealed partial class InputBotInlineMessageMediaWebPage : InputBotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8200,7 +8200,7 @@ namespace TL } /// Inline bot result See Derived classes: , , , - public abstract class InputBotInlineResultBase : IObject + public abstract partial class InputBotInlineResultBase : IObject { /// ID of result public abstract string ID { get; set; } @@ -8209,7 +8209,7 @@ namespace TL } /// An inline bot result See [TLDef(0x88BF9319)] - public class InputBotInlineResult : InputBotInlineResultBase + public sealed partial class InputBotInlineResult : InputBotInlineResultBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8251,7 +8251,7 @@ namespace TL } /// Photo See [TLDef(0xA8D864A7)] - public class InputBotInlineResultPhoto : InputBotInlineResultBase + public sealed partial class InputBotInlineResultPhoto : InputBotInlineResultBase { /// Result ID public string id; @@ -8269,7 +8269,7 @@ namespace TL } /// Document (media of any type except for photos) See [TLDef(0xFFF8FDC4)] - public class InputBotInlineResultDocument : InputBotInlineResultBase + public sealed partial class InputBotInlineResultDocument : InputBotInlineResultBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8301,7 +8301,7 @@ namespace TL } /// Game See [TLDef(0x4FA417F2)] - public class InputBotInlineResultGame : InputBotInlineResultBase + public sealed partial class InputBotInlineResultGame : InputBotInlineResultBase { /// Result ID public string id; @@ -8317,10 +8317,10 @@ namespace TL } /// Inline message See Derived classes: , , , , , , - public abstract class BotInlineMessage : IObject { } + public abstract partial class BotInlineMessage : IObject { } /// Send whatever media is attached to the See [TLDef(0x764CF810)] - public class BotInlineMessageMediaAuto : BotInlineMessage + public sealed partial class BotInlineMessageMediaAuto : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8343,7 +8343,7 @@ namespace TL } /// Send a simple text message See [TLDef(0x8C7F65E2)] - public class BotInlineMessageText : BotInlineMessage + public sealed partial class BotInlineMessageText : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8368,7 +8368,7 @@ namespace TL } /// Send a geolocation See [TLDef(0x051846FD)] - public class BotInlineMessageMediaGeo : BotInlineMessage + public sealed partial class BotInlineMessageMediaGeo : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8397,7 +8397,7 @@ namespace TL } /// Send a venue See [TLDef(0x8A86659C)] - public class BotInlineMessageMediaVenue : BotInlineMessage + public sealed partial class BotInlineMessageMediaVenue : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8424,7 +8424,7 @@ namespace TL } /// Send a contact See [TLDef(0x18D1CDC2)] - public class BotInlineMessageMediaContact : BotInlineMessage + public sealed partial class BotInlineMessageMediaContact : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8447,7 +8447,7 @@ namespace TL } /// Send an invoice See [TLDef(0x354A9B09)] - public class BotInlineMessageMediaInvoice : BotInlineMessage + public sealed partial class BotInlineMessageMediaInvoice : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8478,7 +8478,7 @@ namespace TL } /// Specifies options that must be used to generate the link preview for the message, or even a standalone link preview without an attached message. See [TLDef(0x809AD9A6)] - public class BotInlineMessageMediaWebPage : BotInlineMessage + public sealed partial class BotInlineMessageMediaWebPage : BotInlineMessage { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8511,7 +8511,7 @@ namespace TL } /// Results of an inline query See Derived classes: , - public abstract class BotInlineResultBase : IObject + public abstract partial class BotInlineResultBase : IObject { /// Result ID public virtual string ID => default; @@ -8526,7 +8526,7 @@ namespace TL } /// Generic result See [TLDef(0x11965F3A)] - public class BotInlineResult : BotInlineResultBase + public sealed partial class BotInlineResult : BotInlineResultBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8574,7 +8574,7 @@ namespace TL } /// Media result See [TLDef(0x17DB940B)] - public class BotInlineMediaResult : BotInlineResultBase + public sealed partial class BotInlineMediaResult : BotInlineResultBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8619,7 +8619,7 @@ namespace TL /// Result of a query to an inline bot See [TLDef(0xE021F2F6)] - public class Messages_BotResults : IObject + public sealed partial class Messages_BotResults : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8653,7 +8653,7 @@ namespace TL /// Link to a message in a supergroup/channel See [TLDef(0x5DAB1AF4)] - public class ExportedMessageLink : IObject + public sealed partial class ExportedMessageLink : IObject { /// URL public string link; @@ -8663,7 +8663,7 @@ namespace TL /// Info about a forwarded message See [TLDef(0x4E4DF4BB)] - public class MessageFwdHeader : IObject + public sealed partial class MessageFwdHeader : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8733,45 +8733,45 @@ namespace TL } /// Type of the verification code that was sent See Derived classes: , , , , , , , , - public abstract class Auth_SentCodeType : IObject { } + public abstract partial class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] - public class Auth_SentCodeTypeApp : Auth_SentCodeType + public sealed partial class Auth_SentCodeTypeApp : Auth_SentCodeType { /// Length of the code in bytes public int length; } /// The code was sent via SMS See [TLDef(0xC000BBA2)] - public class Auth_SentCodeTypeSms : Auth_SentCodeType + public partial class Auth_SentCodeTypeSms : Auth_SentCodeType { /// Length of the code in bytes public int length; } /// The code will be sent via a phone call: a synthesized voice will tell the user which verification code to input. See [TLDef(0x5353E5A7)] - public class Auth_SentCodeTypeCall : Auth_SentCodeType + public partial class Auth_SentCodeTypeCall : Auth_SentCodeType { /// Length of the verification code public int length; } /// The code will be sent via a flash phone call, that will be closed immediately. The phone code will then be the phone number itself, just make sure that the phone number matches the specified pattern. See [TLDef(0xAB03C6D9)] - public class Auth_SentCodeTypeFlashCall : Auth_SentCodeType + public sealed partial class Auth_SentCodeTypeFlashCall : Auth_SentCodeType { /// pattern to match public string pattern; } /// The code will be sent via a flash phone call, that will be closed immediately. The last digits of the phone number that calls are the code that must be entered manually by the user. See [TLDef(0x82006484)] - public class Auth_SentCodeTypeMissedCall : Auth_SentCodeTypeCall + public sealed partial class Auth_SentCodeTypeMissedCall : Auth_SentCodeTypeCall { /// Prefix of the phone number from which the call will be made public string prefix; } /// The code was sent via the previously configured login email » See [TLDef(0xF450F59B)] - public class Auth_SentCodeTypeEmailCode : Auth_SentCodeType + public sealed partial class Auth_SentCodeTypeEmailCode : Auth_SentCodeType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8798,7 +8798,7 @@ namespace TL } /// The user should add and verify an email address in order to login as described here ». See [TLDef(0xA5491DEA)] - public class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType + public sealed partial class Auth_SentCodeTypeSetUpEmailRequired : Auth_SentCodeType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8813,14 +8813,14 @@ namespace TL } /// The code was delivered via fragment.com. See [TLDef(0xD9565C39)] - public class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms + public sealed partial class Auth_SentCodeTypeFragmentSms : Auth_SentCodeTypeSms { /// Open the specified URL to log into fragment.com with the wallet that owns the specified phone number and view the code. public string url; } /// An authentication code should be delivered via SMS after Firebase attestation, as described in the auth documentation ». See [TLDef(0xE57B1432)] - public class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms + public sealed partial class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8842,7 +8842,7 @@ namespace TL /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] - public class Messages_BotCallbackAnswer : IObject + public sealed partial class Messages_BotCallbackAnswer : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8870,7 +8870,7 @@ namespace TL /// Message edit data for media See [TLDef(0x26B5DDE6)] - public class Messages_MessageEditData : IObject + public sealed partial class Messages_MessageEditData : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8883,7 +8883,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot See Derived classes: , - public abstract class InputBotInlineMessageIDBase : IObject + public abstract partial class InputBotInlineMessageIDBase : IObject { /// DC ID to use when working with this inline message public abstract int DcId { get; set; } @@ -8892,7 +8892,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot (legacy constructor) See [TLDef(0x890C3D89)] - public class InputBotInlineMessageID : InputBotInlineMessageIDBase + public sealed partial class InputBotInlineMessageID : InputBotInlineMessageIDBase { /// DC ID to use when working with this inline message public int dc_id; @@ -8908,7 +8908,7 @@ namespace TL } /// Represents a sent inline message from the perspective of a bot See [TLDef(0xB6D915D7)] - public class InputBotInlineMessageID64 : InputBotInlineMessageIDBase + public sealed partial class InputBotInlineMessageID64 : InputBotInlineMessageIDBase { /// DC ID to use when working with this inline message public int dc_id; @@ -8927,7 +8927,7 @@ namespace TL /// The bot requested the user to message them in private See [TLDef(0x3C20629F)] - public class InlineBotSwitchPM : IObject + public sealed partial class InlineBotSwitchPM : IObject { /// Text for the button that switches the user to a private chat with the bot and sends the bot a start message with the parameter start_parameter (can be empty) public string text; @@ -8937,7 +8937,7 @@ namespace TL /// Dialog info of multiple peers See [TLDef(0x3371C354)] - public partial class Messages_PeerDialogs : IObject, IPeerResolver + public sealed partial class Messages_PeerDialogs : IObject, IPeerResolver { /// Dialog info public DialogBase[] dialogs; @@ -8955,7 +8955,7 @@ namespace TL /// Top peer See [TLDef(0xEDCDC05B)] - public class TopPeer : IObject + public sealed partial class TopPeer : IObject { /// Peer public Peer peer; @@ -8986,7 +8986,7 @@ namespace TL /// Top peer category See [TLDef(0xFB834291)] - public class TopPeerCategoryPeers : IObject + public sealed partial class TopPeerCategoryPeers : IObject { /// Top peer category of peers public TopPeerCategory category; @@ -8998,10 +8998,10 @@ namespace TL /// Top peers See Derived classes: , /// a value means contacts.topPeersNotModified - public abstract class Contacts_TopPeersBase : IObject { } + public abstract partial class Contacts_TopPeersBase : IObject { } /// Top peers See [TLDef(0x70B772A8)] - public class Contacts_TopPeers : Contacts_TopPeersBase, IPeerResolver + public sealed partial class Contacts_TopPeers : Contacts_TopPeersBase, IPeerResolver { /// Top peers by top peer category public TopPeerCategoryPeers[] categories; @@ -9014,13 +9014,13 @@ namespace TL } /// Top peers disabled See [TLDef(0xB52C939D)] - public class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } + public sealed partial class Contacts_TopPeersDisabled : Contacts_TopPeersBase { } /// Represents a message draft. See Derived classes: , - public abstract class DraftMessageBase : IObject { } + public abstract partial class DraftMessageBase : IObject { } /// Empty draft See [TLDef(0x1B0C841A)] - public class DraftMessageEmpty : DraftMessageBase + public sealed partial class DraftMessageEmpty : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9035,7 +9035,7 @@ namespace TL } /// Represents a message draft. See [TLDef(0x3FCCF7EF)] - public class DraftMessage : DraftMessageBase + public sealed partial class DraftMessage : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9066,17 +9066,17 @@ namespace TL } /// Featured stickers See Derived classes: , - public abstract class Messages_FeaturedStickersBase : IObject { } + public abstract partial class Messages_FeaturedStickersBase : IObject { } /// Featured stickers haven't changed See [TLDef(0xC6DC0C66)] - public class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase + public sealed partial class Messages_FeaturedStickersNotModified : Messages_FeaturedStickersBase { /// Total number of featured stickers public int count; } /// Featured stickersets See [TLDef(0xBE382906)] - public class Messages_FeaturedStickers : Messages_FeaturedStickersBase + public sealed partial class Messages_FeaturedStickers : Messages_FeaturedStickersBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9099,7 +9099,7 @@ namespace TL /// Recently used stickers See /// a value means messages.recentStickersNotModified [TLDef(0x88D37C56)] - public class Messages_RecentStickers : IObject + public sealed partial class Messages_RecentStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -9113,7 +9113,7 @@ namespace TL /// Archived stickersets See [TLDef(0x4FCBA9C8)] - public class Messages_ArchivedStickers : IObject + public sealed partial class Messages_ArchivedStickers : IObject { /// Number of archived stickers public int count; @@ -9122,27 +9122,27 @@ namespace TL } /// Result of stickerset installation process See Derived classes: , - public abstract class Messages_StickerSetInstallResult : IObject { } + public abstract partial class Messages_StickerSetInstallResult : IObject { } /// The stickerset was installed successfully See [TLDef(0x38641628)] - public class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } + public sealed partial class Messages_StickerSetInstallResultSuccess : Messages_StickerSetInstallResult { } /// The stickerset was installed, but since there are too many stickersets some were archived See [TLDef(0x35E410A8)] - public class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult + public sealed partial class Messages_StickerSetInstallResultArchive : Messages_StickerSetInstallResult { /// Archived stickersets public StickerSetCoveredBase[] sets; } /// Stickerset preview See Derived classes: , , , - public abstract class StickerSetCoveredBase : IObject + public abstract partial class StickerSetCoveredBase : IObject { /// Stickerset public virtual StickerSet Set => default; } /// Stickerset with a single sticker as preview See [TLDef(0x6410A5D2)] - public class StickerSetCovered : StickerSetCoveredBase + public sealed partial class StickerSetCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; @@ -9154,7 +9154,7 @@ namespace TL } /// Stickerset, with multiple stickers as preview See [TLDef(0x3407E51B)] - public class StickerSetMultiCovered : StickerSetCoveredBase + public sealed partial class StickerSetMultiCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; @@ -9166,7 +9166,7 @@ namespace TL } /// Stickerset preview with all stickers of the stickerset included.
Currently used only for
custom emoji stickersets, to avoid a further call to Messages_GetStickerSet. See
[TLDef(0x40D13C0E)] - public class StickerSetFullCovered : StickerSetCoveredBase + public sealed partial class StickerSetFullCovered : StickerSetCoveredBase { /// Stickerset public StickerSet set; @@ -9182,7 +9182,7 @@ namespace TL } /// Just the stickerset information, with no previews. See [TLDef(0x77B15D1C)] - public class StickerSetNoCovered : StickerSetCoveredBase + public sealed partial class StickerSetNoCovered : StickerSetCoveredBase { /// Stickerset information. public StickerSet set; @@ -9193,7 +9193,7 @@ namespace TL /// Position on a photo where a mask should be placed when attaching stickers to media » See [TLDef(0xAED6DBB2)] - public class MaskCoords : IObject + public sealed partial class MaskCoords : IObject { /// Part of the face, relative to which the mask should be placed public int n; @@ -9206,17 +9206,17 @@ namespace TL } /// Represents a media with attached stickers See Derived classes: , - public abstract class InputStickeredMedia : IObject { } + public abstract partial class InputStickeredMedia : IObject { } /// A photo with stickers attached See [TLDef(0x4A992157)] - public class InputStickeredMediaPhoto : InputStickeredMedia + public sealed partial class InputStickeredMediaPhoto : InputStickeredMedia { /// The photo public InputPhoto id; } /// A document with stickers attached See [TLDef(0x0438865B)] - public class InputStickeredMediaDocument : InputStickeredMedia + public sealed partial class InputStickeredMediaDocument : InputStickeredMedia { /// The document public InputDocument id; @@ -9224,7 +9224,7 @@ namespace TL /// Indicates an already sent game See [TLDef(0xBDF9653B)] - public partial class Game : IObject + public sealed partial class Game : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9251,10 +9251,10 @@ namespace TL } /// A game to send See Derived classes: , - public abstract class InputGame : IObject { } + public abstract partial class InputGame : IObject { } /// Indicates an already sent game See [TLDef(0x032C3E77)] - public class InputGameID : InputGame + public sealed partial class InputGameID : InputGame { /// game ID from constructor public long id; @@ -9263,7 +9263,7 @@ namespace TL } /// Game by short name See [TLDef(0xC331E80A)] - public class InputGameShortName : InputGame + public sealed partial class InputGameShortName : InputGame { /// The bot that provides the game public InputUserBase bot_id; @@ -9273,7 +9273,7 @@ namespace TL /// Game highscore See [TLDef(0x73A379EB)] - public class HighScore : IObject + public sealed partial class HighScore : IObject { /// Position in highscore list public int pos; @@ -9285,7 +9285,7 @@ namespace TL /// Highscores in a game See [TLDef(0x9A3BFD99)] - public class Messages_HighScores : IObject + public sealed partial class Messages_HighScores : IObject { /// Highscores public HighScore[] scores; @@ -9295,52 +9295,52 @@ namespace TL /// Rich text See Derived classes: , , , , , , , , , , , , , , /// a value means textEmpty - public abstract class RichText : IObject { } + public abstract partial class RichText : IObject { } /// Plain text See [TLDef(0x744694E0)] - public class TextPlain : RichText + public sealed partial class TextPlain : RichText { /// Text public string text; } /// Bold text See [TLDef(0x6724ABC4)] - public class TextBold : RichText + public sealed partial class TextBold : RichText { /// Text public RichText text; } /// Italic text See [TLDef(0xD912A59C)] - public class TextItalic : RichText + public sealed partial class TextItalic : RichText { /// Text public RichText text; } /// Underlined text See [TLDef(0xC12622C4)] - public class TextUnderline : RichText + public sealed partial class TextUnderline : RichText { /// Text public RichText text; } /// Strikethrough text See [TLDef(0x9BF8BB95)] - public class TextStrike : RichText + public sealed partial class TextStrike : RichText { /// Text public RichText text; } /// fixed-width rich text See [TLDef(0x6C3F19B9)] - public class TextFixed : RichText + public sealed partial class TextFixed : RichText { /// Text public RichText text; } /// Link See [TLDef(0x3C2884C1)] - public class TextUrl : RichText + public sealed partial class TextUrl : RichText { /// Text of link public RichText text; @@ -9351,7 +9351,7 @@ namespace TL } /// Rich text email link See [TLDef(0xDE5A0DD6)] - public class TextEmail : RichText + public sealed partial class TextEmail : RichText { /// Link text public RichText text; @@ -9360,35 +9360,35 @@ namespace TL } /// Concatenation of rich texts See [TLDef(0x7E6260D7)] - public class TextConcat : RichText + public sealed partial class TextConcat : RichText { /// Concatenated rich texts public RichText[] texts; } /// Subscript text See [TLDef(0xED6A8504)] - public class TextSubscript : RichText + public sealed partial class TextSubscript : RichText { /// Text public RichText text; } /// Superscript text See [TLDef(0xC7FB5E01)] - public class TextSuperscript : RichText + public sealed partial class TextSuperscript : RichText { /// Text public RichText text; } /// Highlighted text See [TLDef(0x034B8621)] - public class TextMarked : RichText + public sealed partial class TextMarked : RichText { /// Text public RichText text; } /// Rich text linked to a phone number See [TLDef(0x1CCB966A)] - public class TextPhone : RichText + public sealed partial class TextPhone : RichText { /// Text public RichText text; @@ -9397,7 +9397,7 @@ namespace TL } /// Inline image See [TLDef(0x081CCF4F)] - public class TextImage : RichText + public sealed partial class TextImage : RichText { /// Document ID public long document_id; @@ -9408,7 +9408,7 @@ namespace TL } /// Text linking to another section of the page See [TLDef(0x35553762)] - public class TextAnchor : RichText + public sealed partial class TextAnchor : RichText { /// Text public RichText text; @@ -9417,27 +9417,27 @@ namespace TL } /// Represents an instant view page element See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , - public abstract class PageBlock : IObject { } + public abstract partial class PageBlock : IObject { } /// Unsupported IV element See [TLDef(0x13567E8A)] - public class PageBlockUnsupported : PageBlock { } + public sealed partial class PageBlockUnsupported : PageBlock { } /// Title See [TLDef(0x70ABC3FD)] - public class PageBlockTitle : PageBlock + public sealed partial class PageBlockTitle : PageBlock { /// Title public RichText text; } /// Subtitle See [TLDef(0x8FFA9A1F)] - public class PageBlockSubtitle : PageBlock + public sealed partial class PageBlockSubtitle : PageBlock { /// Text public RichText text; } /// Author and date of creation of article See [TLDef(0xBAAFE5E0)] - public class PageBlockAuthorDate : PageBlock + public sealed partial class PageBlockAuthorDate : PageBlock { /// Author name public RichText author; @@ -9446,28 +9446,28 @@ namespace TL } /// Page header See [TLDef(0xBFD064EC)] - public class PageBlockHeader : PageBlock + public sealed partial class PageBlockHeader : PageBlock { /// Contents public RichText text; } /// Subheader See [TLDef(0xF12BB6E1)] - public class PageBlockSubheader : PageBlock + public sealed partial class PageBlockSubheader : PageBlock { /// Subheader public RichText text; } /// A paragraph See [TLDef(0x467A0766)] - public class PageBlockParagraph : PageBlock + public sealed partial class PageBlockParagraph : PageBlock { /// Text public RichText text; } /// Preformatted (<pre> text) See [TLDef(0xC070D93E)] - public class PageBlockPreformatted : PageBlock + public sealed partial class PageBlockPreformatted : PageBlock { /// Text public RichText text; @@ -9476,31 +9476,31 @@ namespace TL } /// Page footer See [TLDef(0x48870999)] - public class PageBlockFooter : PageBlock + public sealed partial class PageBlockFooter : PageBlock { /// Contents public RichText text; } /// An empty block separating a page See [TLDef(0xDB20B188)] - public class PageBlockDivider : PageBlock { } + public sealed partial class PageBlockDivider : PageBlock { } /// Link to section within the page itself (like <a href="#target">anchor</a>) See [TLDef(0xCE0D37B0)] - public class PageBlockAnchor : PageBlock + public sealed partial class PageBlockAnchor : PageBlock { /// Name of target section public string name; } /// Unordered list of IV blocks See [TLDef(0xE4E88011)] - public class PageBlockList : PageBlock + public sealed partial class PageBlockList : PageBlock { /// List of blocks in an IV page public PageListItem[] items; } /// Quote (equivalent to the HTML <blockquote>) See [TLDef(0x263D7C26)] - public class PageBlockBlockquote : PageBlock + public sealed partial class PageBlockBlockquote : PageBlock { /// Quote contents public RichText text; @@ -9509,7 +9509,7 @@ namespace TL } /// Pullquote See [TLDef(0x4F4456D3)] - public class PageBlockPullquote : PageBlock + public sealed partial class PageBlockPullquote : PageBlock { /// Text public RichText text; @@ -9518,7 +9518,7 @@ namespace TL } /// A photo See [TLDef(0x1759C560)] - public class PageBlockPhoto : PageBlock + public sealed partial class PageBlockPhoto : PageBlock { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9539,7 +9539,7 @@ namespace TL } /// Video See [TLDef(0x7C8FE7B6)] - public class PageBlockVideo : PageBlock + public sealed partial class PageBlockVideo : PageBlock { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9558,14 +9558,14 @@ namespace TL } /// A page cover See [TLDef(0x39F23300)] - public class PageBlockCover : PageBlock + public sealed partial class PageBlockCover : PageBlock { /// Cover public PageBlock cover; } /// An embedded webpage See [TLDef(0xA8718DC5)] - public class PageBlockEmbed : PageBlock + public sealed partial class PageBlockEmbed : PageBlock { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9600,7 +9600,7 @@ namespace TL } /// An embedded post See [TLDef(0xF259A80B)] - public class PageBlockEmbedPost : PageBlock + public sealed partial class PageBlockEmbedPost : PageBlock { /// Web page URL public string url; @@ -9619,7 +9619,7 @@ namespace TL } /// Collage of media See [TLDef(0x65A0FA4D)] - public class PageBlockCollage : PageBlock + public sealed partial class PageBlockCollage : PageBlock { /// Media elements public PageBlock[] items; @@ -9628,7 +9628,7 @@ namespace TL } /// Slideshow See [TLDef(0x031F9590)] - public class PageBlockSlideshow : PageBlock + public sealed partial class PageBlockSlideshow : PageBlock { /// Slideshow items public PageBlock[] items; @@ -9637,14 +9637,14 @@ namespace TL } /// Reference to a telegram channel See [TLDef(0xEF1751B5)] - public class PageBlockChannel : PageBlock + public sealed partial class PageBlockChannel : PageBlock { /// The channel/supergroup/chat public ChatBase channel; } /// Audio See [TLDef(0x804361EA)] - public class PageBlockAudio : PageBlock + public sealed partial class PageBlockAudio : PageBlock { /// Audio ID (to be fetched from the container public long audio_id; @@ -9653,14 +9653,14 @@ namespace TL } /// Kicker See [TLDef(0x1E148390)] - public class PageBlockKicker : PageBlock + public sealed partial class PageBlockKicker : PageBlock { /// Contents public RichText text; } /// Table See [TLDef(0xBF4DEA82)] - public class PageBlockTable : PageBlock + public sealed partial class PageBlockTable : PageBlock { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9679,14 +9679,14 @@ namespace TL } /// Ordered list of IV blocks See [TLDef(0x9A8AE1E1)] - public class PageBlockOrderedList : PageBlock + public sealed partial class PageBlockOrderedList : PageBlock { /// List items public PageListOrderedItem[] items; } /// A collapsible details block See [TLDef(0x76768BED)] - public class PageBlockDetails : PageBlock + public sealed partial class PageBlockDetails : PageBlock { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9703,7 +9703,7 @@ namespace TL } /// Related articles See [TLDef(0x16115A96)] - public class PageBlockRelatedArticles : PageBlock + public sealed partial class PageBlockRelatedArticles : PageBlock { /// Title public RichText title; @@ -9712,7 +9712,7 @@ namespace TL } /// A map See [TLDef(0xA44F3EF6)] - public class PageBlockMap : PageBlock + public sealed partial class PageBlockMap : PageBlock { /// Location of the map center public GeoPoint geo; @@ -9741,7 +9741,7 @@ namespace TL /// Represents a json-encoded object See [TLDef(0x7D748D04)] - public class DataJSON : IObject + public sealed partial class DataJSON : IObject { /// JSON-encoded object public string data; @@ -9749,7 +9749,7 @@ namespace TL /// This object represents a portion of the price for goods or services. See [TLDef(0xCB296BF8)] - public class LabeledPrice : IObject + public sealed partial class LabeledPrice : IObject { /// Portion label public string label; @@ -9759,7 +9759,7 @@ namespace TL /// Invoice See [TLDef(0x5DB95A15)] - public class Invoice : IObject + public sealed partial class Invoice : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9803,7 +9803,7 @@ namespace TL /// Payment identifier See [TLDef(0xEA02C27E)] - public class PaymentCharge : IObject + public sealed partial class PaymentCharge : IObject { /// Telegram payment identifier public string id; @@ -9813,7 +9813,7 @@ namespace TL /// Shipping address See [TLDef(0x1E8CAAEB)] - public class PostAddress : IObject + public sealed partial class PostAddress : IObject { /// First line for the address public string street_line1; @@ -9831,7 +9831,7 @@ namespace TL /// Order info provided by the user See [TLDef(0x909C3F94)] - public class PaymentRequestedInfo : IObject + public sealed partial class PaymentRequestedInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9858,10 +9858,10 @@ namespace TL } /// Saved payment credentials See Derived classes: - public abstract class PaymentSavedCredentials : IObject { } + public abstract partial class PaymentSavedCredentials : IObject { } /// Saved credit card See [TLDef(0xCDC27A1F)] - public class PaymentSavedCredentialsCard : PaymentSavedCredentials + public sealed partial class PaymentSavedCredentialsCard : PaymentSavedCredentials { /// Card ID public string id; @@ -9883,7 +9883,7 @@ namespace TL } /// Remote document See [TLDef(0x1C570ED1)] - public partial class WebDocument : WebDocumentBase + public sealed partial class WebDocument : WebDocumentBase { /// Document URL public string url; @@ -9907,7 +9907,7 @@ namespace TL } /// Remote document that can be downloaded without proxying through telegram See [TLDef(0xF9C8BCC6)] - public class WebDocumentNoProxy : WebDocumentBase + public sealed partial class WebDocumentNoProxy : WebDocumentBase { /// Document URL public string url; @@ -9930,7 +9930,7 @@ namespace TL /// The document See [TLDef(0x9BED434D)] - public class InputWebDocument : IObject + public sealed partial class InputWebDocument : IObject { /// Remote document URL to be downloaded using the appropriate method public string url; @@ -9943,10 +9943,10 @@ namespace TL } /// Location of remote file See Derived classes: , , - public abstract class InputWebFileLocationBase : IObject { } + public abstract partial class InputWebFileLocationBase : IObject { } /// Location of a remote HTTP(s) file See [TLDef(0xC239D686)] - public class InputWebFileLocation : InputWebFileLocationBase + public sealed partial class InputWebFileLocation : InputWebFileLocationBase { /// HTTP URL of file public string url; @@ -9955,7 +9955,7 @@ namespace TL } /// Used to download a server-generated image with the map preview from a , see the webfile docs for more info ». See [TLDef(0x9F2221C9)] - public class InputWebFileGeoPointLocation : InputWebFileLocationBase + public sealed partial class InputWebFileGeoPointLocation : InputWebFileLocationBase { /// Generated from the lat, long and accuracy_radius parameters of the public InputGeoPoint geo_point; @@ -9972,7 +9972,7 @@ namespace TL } /// Used to download an album cover for any music file using Upload_GetWebFile, see the webfile docs for more info ». See [TLDef(0xF46FE924)] - public class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase + public sealed partial class InputWebFileAudioAlbumThumbLocation : InputWebFileLocationBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -9996,7 +9996,7 @@ namespace TL /// Represents a chunk of an HTTP webfile downloaded through telegram's secure MTProto servers See [TLDef(0x21E753BC)] - public class Upload_WebFile : IObject + public sealed partial class Upload_WebFile : IObject { /// File size public int size; @@ -10012,7 +10012,7 @@ namespace TL /// Payment form See [TLDef(0xA0058751)] - public class Payments_PaymentForm : IObject + public sealed partial class Payments_PaymentForm : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10066,7 +10066,7 @@ namespace TL /// Validated user-provided info See [TLDef(0xD1451883)] - public class Payments_ValidatedRequestedInfo : IObject + public sealed partial class Payments_ValidatedRequestedInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10085,17 +10085,17 @@ namespace TL } /// Payment result See Derived classes: , - public abstract class Payments_PaymentResultBase : IObject { } + public abstract partial class Payments_PaymentResultBase : IObject { } /// Payment result See [TLDef(0x4E5F810D)] - public class Payments_PaymentResult : Payments_PaymentResultBase + public sealed partial class Payments_PaymentResult : Payments_PaymentResultBase { /// Info about the payment public UpdatesBase updates; } /// Payment was not successful, additional verification is needed See [TLDef(0xD8411139)] - public class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase + public sealed partial class Payments_PaymentVerificationNeeded : Payments_PaymentResultBase { /// URL for additional payment credentials verification public string url; @@ -10103,7 +10103,7 @@ namespace TL /// Receipt See [TLDef(0x70C4FE03)] - public class Payments_PaymentReceipt : IObject + public sealed partial class Payments_PaymentReceipt : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10151,7 +10151,7 @@ namespace TL /// Saved server-side order information See [TLDef(0xFB8FE43C)] - public class Payments_SavedInfo : IObject + public sealed partial class Payments_SavedInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10168,10 +10168,10 @@ namespace TL } /// Payment credentials See Derived classes: , , , - public abstract class InputPaymentCredentialsBase : IObject { } + public abstract partial class InputPaymentCredentialsBase : IObject { } /// Saved payment credentials See [TLDef(0xC10EB2CF)] - public class InputPaymentCredentialsSaved : InputPaymentCredentialsBase + public sealed partial class InputPaymentCredentialsSaved : InputPaymentCredentialsBase { /// Credential ID public string id; @@ -10180,7 +10180,7 @@ namespace TL } /// Payment credentials See [TLDef(0x3417D728)] - public class InputPaymentCredentials : InputPaymentCredentialsBase + public sealed partial class InputPaymentCredentials : InputPaymentCredentialsBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10195,14 +10195,14 @@ namespace TL } /// Apple pay payment credentials See [TLDef(0x0AA1C39F)] - public class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase + public sealed partial class InputPaymentCredentialsApplePay : InputPaymentCredentialsBase { /// Payment data public DataJSON payment_data; } /// Google Pay payment credentials See [TLDef(0x8AC32801)] - public class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase + public sealed partial class InputPaymentCredentialsGooglePay : InputPaymentCredentialsBase { /// Payment token public DataJSON payment_token; @@ -10210,7 +10210,7 @@ namespace TL /// Temporary payment password See [TLDef(0xDB64FD34)] - public class Account_TmpPassword : IObject + public sealed partial class Account_TmpPassword : IObject { /// Temporary password public byte[] tmp_password; @@ -10220,7 +10220,7 @@ namespace TL /// Shipping option See [TLDef(0xB6213CDF)] - public class ShippingOption : IObject + public sealed partial class ShippingOption : IObject { /// Option ID public string id; @@ -10232,7 +10232,7 @@ namespace TL /// Sticker in a stickerset See [TLDef(0x32DA9E9C)] - public class InputStickerSetItem : IObject + public sealed partial class InputStickerSetItem : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10256,7 +10256,7 @@ namespace TL /// Phone call See [TLDef(0x1E36FDED)] - public class InputPhoneCall : IObject + public sealed partial class InputPhoneCall : IObject { /// Call ID public long id; @@ -10282,7 +10282,7 @@ namespace TL } /// Empty constructor See [TLDef(0x5366C915)] - public class PhoneCallEmpty : PhoneCallBase + public sealed partial class PhoneCallEmpty : PhoneCallBase { /// Call ID public long id; @@ -10292,7 +10292,7 @@ namespace TL } /// Incoming phone call See [TLDef(0xC5226F17)] - public class PhoneCallWaiting : PhoneCallBase + public sealed partial class PhoneCallWaiting : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10334,7 +10334,7 @@ namespace TL } /// Requested phone call See [TLDef(0x14B0ED0C)] - public class PhoneCallRequested : PhoneCallBase + public sealed partial class PhoneCallRequested : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10374,7 +10374,7 @@ namespace TL } /// An accepted phone call See [TLDef(0x3660C311)] - public class PhoneCallAccepted : PhoneCallBase + public sealed partial class PhoneCallAccepted : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10414,7 +10414,7 @@ namespace TL } /// Phone call See [TLDef(0x967F7C67)] - public class PhoneCall : PhoneCallBase + public sealed partial class PhoneCall : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10462,7 +10462,7 @@ namespace TL } /// Indicates a discarded phone call See [TLDef(0x50CA4DE1)] - public class PhoneCallDiscarded : PhoneCallBase + public sealed partial class PhoneCallDiscarded : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10492,7 +10492,7 @@ namespace TL } /// Phone call connection See Derived classes: , - public abstract class PhoneConnectionBase : IObject + public abstract partial class PhoneConnectionBase : IObject { /// Endpoint ID public virtual long ID => default; @@ -10505,7 +10505,7 @@ namespace TL } /// Identifies an endpoint that can be used to connect to the other user in a phone call See [TLDef(0x9CC123C7)] - public class PhoneConnection : PhoneConnectionBase + public sealed partial class PhoneConnection : PhoneConnectionBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10537,7 +10537,7 @@ namespace TL } /// WebRTC connection parameters See [TLDef(0x635FE375)] - public class PhoneConnectionWebrtc : PhoneConnectionBase + public sealed partial class PhoneConnectionWebrtc : PhoneConnectionBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10574,7 +10574,7 @@ namespace TL /// Protocol info for libtgvoip See [TLDef(0xFC878FC8)] - public class PhoneCallProtocol : IObject + public sealed partial class PhoneCallProtocol : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10596,7 +10596,7 @@ namespace TL /// A VoIP phone call See [TLDef(0xEC82E140)] - public class Phone_PhoneCall : IObject + public sealed partial class Phone_PhoneCall : IObject { /// The VoIP phone call public PhoneCallBase phone_call; @@ -10605,17 +10605,17 @@ namespace TL } /// Represents the download status of a CDN file See Derived classes: , - public abstract class Upload_CdnFileBase : IObject { } + public abstract partial class Upload_CdnFileBase : IObject { } /// The file was cleared from the temporary RAM cache of the CDN and has to be re-uploaded. See [TLDef(0xEEA8E46E)] - public class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase + public sealed partial class Upload_CdnFileReuploadNeeded : Upload_CdnFileBase { /// Request token (see CDN) public byte[] request_token; } /// Represent a chunk of a CDN file. See [TLDef(0xA99FCA4F)] - public class Upload_CdnFile : Upload_CdnFileBase + public sealed partial class Upload_CdnFile : Upload_CdnFileBase { /// The data public byte[] bytes; @@ -10623,7 +10623,7 @@ namespace TL /// Public key to use only during handshakes to CDN DCs. See [TLDef(0xC982EABA)] - public class CdnPublicKey : IObject + public sealed partial class CdnPublicKey : IObject { /// CDN DC ID public int dc_id; @@ -10633,21 +10633,21 @@ namespace TL /// Configuration for CDN file downloads. See [TLDef(0x5725E40A)] - public class CdnConfig : IObject + public sealed partial class CdnConfig : IObject { /// Vector of public keys to use only during handshakes to CDN DCs. public CdnPublicKey[] public_keys; } /// Language pack string See Derived classes: , , - public abstract class LangPackStringBase : IObject + public abstract partial class LangPackStringBase : IObject { /// Language key public virtual string Key => default; } /// Translated localization string See [TLDef(0xCAD181F6)] - public class LangPackString : LangPackStringBase + public sealed partial class LangPackString : LangPackStringBase { /// Language key public string key; @@ -10659,7 +10659,7 @@ namespace TL } /// A language pack string which has different forms based on the number of some object it mentions. See https://www.unicode.org/cldr/charts/latest/supplemental/language_plural_rules.html for more info See [TLDef(0x6C47AC9F)] - public class LangPackStringPluralized : LangPackStringBase + public sealed partial class LangPackStringPluralized : LangPackStringBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10697,7 +10697,7 @@ namespace TL } /// Deleted localization string See [TLDef(0x2979EEB2)] - public class LangPackStringDeleted : LangPackStringBase + public sealed partial class LangPackStringDeleted : LangPackStringBase { /// Localization key public string key; @@ -10708,7 +10708,7 @@ namespace TL /// Changes to the app's localization pack See [TLDef(0xF385C1F6)] - public class LangPackDifference : IObject + public sealed partial class LangPackDifference : IObject { /// Language code public string lang_code; @@ -10722,7 +10722,7 @@ namespace TL /// Identifies a localization pack See [TLDef(0xEECA5CE3)] - public class LangPackLanguage : IObject + public sealed partial class LangPackLanguage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10757,10 +10757,10 @@ namespace TL } /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , - public abstract class ChannelAdminLogEventAction : IObject { } + public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] - public class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeTitle : ChannelAdminLogEventAction { /// Previous title public string prev_value; @@ -10769,7 +10769,7 @@ namespace TL } /// The description was changed See [TLDef(0x55188A2E)] - public class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeAbout : ChannelAdminLogEventAction { /// Previous description public string prev_value; @@ -10778,7 +10778,7 @@ namespace TL } /// Channel/supergroup username was changed See [TLDef(0x6A4AFC38)] - public class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeUsername : ChannelAdminLogEventAction { /// Old username public string prev_value; @@ -10787,7 +10787,7 @@ namespace TL } /// The channel/supergroup's picture was changed See [TLDef(0x434BD2AF)] - public class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangePhoto : ChannelAdminLogEventAction { /// Previous picture public PhotoBase prev_photo; @@ -10796,28 +10796,28 @@ namespace TL } /// Invites were enabled/disabled See [TLDef(0x1B7907AE)] - public class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleInvites : ChannelAdminLogEventAction { /// New value public bool new_value; } /// Channel signatures were enabled/disabled See [TLDef(0x26AE0971)] - public class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction { /// New value public bool new_value; } /// A message was pinned See [TLDef(0xE9E82C18)] - public class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionUpdatePinned : ChannelAdminLogEventAction { /// The message that was pinned public MessageBase message; } /// A message was edited See [TLDef(0x709B2405)] - public class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionEditMessage : ChannelAdminLogEventAction { /// Old message public MessageBase prev_message; @@ -10826,27 +10826,27 @@ namespace TL } /// A message was deleted See [TLDef(0x42E047BB)] - public class ChannelAdminLogEventActionDeleteMessage : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionDeleteMessage : ChannelAdminLogEventAction { /// The message that was deleted public MessageBase message; } /// A user has joined the group (in the case of big groups, info of the user that has joined isn't shown) See [TLDef(0x183040D3)] - public class ChannelAdminLogEventActionParticipantJoin : ChannelAdminLogEventAction { } + public sealed partial class ChannelAdminLogEventActionParticipantJoin : ChannelAdminLogEventAction { } /// A user left the channel/supergroup (in the case of big groups, info of the user that has joined isn't shown) See [TLDef(0xF89777F2)] - public class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } + public sealed partial class ChannelAdminLogEventActionParticipantLeave : ChannelAdminLogEventAction { } /// A user was invited to the group See [TLDef(0xE31C34D8)] - public class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantInvite : ChannelAdminLogEventAction { /// The user that was invited public ChannelParticipantBase participant; } /// The banned rights of a user were changed See [TLDef(0xE6D83D7E)] - public class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantToggleBan : ChannelAdminLogEventAction { /// Old banned rights of user public ChannelParticipantBase prev_participant; @@ -10855,7 +10855,7 @@ namespace TL } /// The admin rights of a user were changed See [TLDef(0xD5676710)] - public class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantToggleAdmin : ChannelAdminLogEventAction { /// Previous admin rights public ChannelParticipantBase prev_participant; @@ -10864,7 +10864,7 @@ namespace TL } /// The supergroup's stickerset was changed See [TLDef(0xB1C3CAA7)] - public class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction + public partial class ChannelAdminLogEventActionChangeStickerSet : ChannelAdminLogEventAction { /// Previous stickerset public InputStickerSet prev_stickerset; @@ -10873,14 +10873,14 @@ namespace TL } /// The hidden prehistory setting was Channels_TogglePreHistoryHidden See [TLDef(0x5F5C95F1)] - public class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionTogglePreHistoryHidden : ChannelAdminLogEventAction { /// New value public bool new_value; } /// The default banned rights were modified See [TLDef(0x2DF5FC0A)] - public class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionDefaultBannedRights : ChannelAdminLogEventAction { /// Previous global banned rights public ChatBannedRights prev_banned_rights; @@ -10889,14 +10889,14 @@ namespace TL } /// A poll was stopped See [TLDef(0x8F079643)] - public class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionStopPoll : ChannelAdminLogEventAction { /// The poll that was stopped public MessageBase message; } /// The linked chat was changed See [TLDef(0x050C7AC8)] - public class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeLinkedChat : ChannelAdminLogEventAction { /// Previous linked chat public long prev_value; @@ -10905,7 +10905,7 @@ namespace TL } /// The geogroup location was changed See [TLDef(0x0E6B76AE)] - public class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeLocation : ChannelAdminLogEventAction { /// Previous location public ChannelLocation prev_value; @@ -10914,7 +10914,7 @@ namespace TL } /// Channels_ToggleSlowMode See [TLDef(0x53909779)] - public class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleSlowMode : ChannelAdminLogEventAction { /// Previous slow mode value public int prev_value; @@ -10923,42 +10923,42 @@ namespace TL } /// A group call was started See [TLDef(0x23209745)] - public class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { /// Group call public InputGroupCall call; } /// A group call was terminated See [TLDef(0xDB9F9140)] - public class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { /// The group call that was terminated public InputGroupCall call; } /// A group call participant was muted See [TLDef(0xF92424D2)] - public class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantMute : ChannelAdminLogEventAction { /// The participant that was muted public GroupCallParticipant participant; } /// A group call participant was unmuted See [TLDef(0xE64429C0)] - public class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantUnmute : ChannelAdminLogEventAction { /// The participant that was unmuted public GroupCallParticipant participant; } /// Group call settings were changed See [TLDef(0x56D6A247)] - public class ChannelAdminLogEventActionToggleGroupCallSetting : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleGroupCallSetting : ChannelAdminLogEventAction { /// Whether all users are muted by default upon joining public bool join_muted; } /// A user joined the supergroup/channel using a specific invite link See [TLDef(0xFE9FC158)] - public class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantJoinByInvite : ChannelAdminLogEventAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10973,21 +10973,21 @@ namespace TL } /// A chat invite was deleted See [TLDef(0x5A50FCA4)] - public class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionExportedInviteDelete : ChannelAdminLogEventAction { /// The deleted chat invite public ExportedChatInvite invite; } /// A specific invite link was revoked See [TLDef(0x410A134E)] - public class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionExportedInviteRevoke : ChannelAdminLogEventAction { /// The invite link that was revoked public ExportedChatInvite invite; } /// A chat invite was edited See [TLDef(0xE90EBB59)] - public class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionExportedInviteEdit : ChannelAdminLogEventAction { /// Previous chat invite information public ExportedChatInvite prev_invite; @@ -10996,14 +10996,14 @@ namespace TL } /// channelAdminLogEvent.user_id has set the volume of participant.peer to participant.volume See [TLDef(0x3E7F6847)] - public class ChannelAdminLogEventActionParticipantVolume : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantVolume : ChannelAdminLogEventAction { /// The participant whose volume was changed public GroupCallParticipant participant; } /// The Time-To-Live of messages in this chat was changed See [TLDef(0x6E941A38)] - public class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeHistoryTTL : ChannelAdminLogEventAction { /// Previous value public int prev_value; @@ -11012,7 +11012,7 @@ namespace TL } /// A new member was accepted to the chat by an admin See [TLDef(0xAFB6144A)] - public class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionParticipantJoinByRequest : ChannelAdminLogEventAction { /// The invite link that was used to join the chat public ExportedChatInvite invite; @@ -11021,21 +11021,21 @@ namespace TL } /// Forwards were enabled or disabled See [TLDef(0xCB2AC766)] - public class ChannelAdminLogEventActionToggleNoForwards : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleNoForwards : ChannelAdminLogEventAction { /// Old value public bool new_value; } /// A message was posted in a channel See [TLDef(0x278F2868)] - public class ChannelAdminLogEventActionSendMessage : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionSendMessage : ChannelAdminLogEventAction { /// The message that was sent public MessageBase message; } /// The set of allowed message reactions » for this channel has changed See [TLDef(0xBE4E0EF8)] - public class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeAvailableReactions : ChannelAdminLogEventAction { /// Previously allowed reaction emojis public ChatReactions prev_value; @@ -11044,7 +11044,7 @@ namespace TL } /// The list of usernames associated with the channel was changed See [TLDef(0xF04FB3A9)] - public class ChannelAdminLogEventActionChangeUsernames : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeUsernames : ChannelAdminLogEventAction { /// Previous set of usernames public string[] prev_value; @@ -11053,21 +11053,21 @@ namespace TL } /// Forum functionality was enabled or disabled. See [TLDef(0x02CC6383)] - public class ChannelAdminLogEventActionToggleForum : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleForum : ChannelAdminLogEventAction { /// Whether forum functionality was enabled or disabled. public bool new_value; } /// A forum topic was created See [TLDef(0x58707D28)] - public class ChannelAdminLogEventActionCreateTopic : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionCreateTopic : ChannelAdminLogEventAction { /// The forum topic that was created public ForumTopicBase topic; } /// A forum topic was edited See [TLDef(0xF06FE208)] - public class ChannelAdminLogEventActionEditTopic : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionEditTopic : ChannelAdminLogEventAction { /// Previous topic information public ForumTopicBase prev_topic; @@ -11076,14 +11076,14 @@ namespace TL } /// A forum topic was deleted See [TLDef(0xAE168909)] - public class ChannelAdminLogEventActionDeleteTopic : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionDeleteTopic : ChannelAdminLogEventAction { /// The forum topic that was deleted public ForumTopicBase topic; } /// A forum topic was pinned or unpinned See [TLDef(0x5D8D353B)] - public class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionPinTopic : ChannelAdminLogEventAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11102,14 +11102,14 @@ namespace TL } /// Native antispam functionality was enabled or disabled. See [TLDef(0x64F36DFC)] - public class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionToggleAntiSpam : ChannelAdminLogEventAction { /// Whether antispam functionality was enabled or disabled. public bool new_value; } /// The message accent color was changed See [TLDef(0x5796E780)] - public class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction + public partial class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction { /// Previous accent palette public PeerColor prev_value; @@ -11118,10 +11118,10 @@ namespace TL } /// The profile accent color was changed See [TLDef(0x5E477B25)] - public class ChannelAdminLogEventActionChangeProfilePeerColor : ChannelAdminLogEventActionChangePeerColor { } + public sealed partial class ChannelAdminLogEventActionChangeProfilePeerColor : ChannelAdminLogEventActionChangePeerColor { } /// The wallpaper was changed See [TLDef(0x31BB5D52)] - public class ChannelAdminLogEventActionChangeWallpaper : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeWallpaper : ChannelAdminLogEventAction { /// Previous wallpaper public WallPaperBase prev_value; @@ -11130,7 +11130,7 @@ namespace TL } /// The emoji status was changed See [TLDef(0x3EA9FEB1)] - public class ChannelAdminLogEventActionChangeEmojiStatus : ChannelAdminLogEventAction + public sealed partial class ChannelAdminLogEventActionChangeEmojiStatus : ChannelAdminLogEventAction { /// Previous emoji status public EmojiStatus prev_value; @@ -11139,11 +11139,11 @@ namespace TL } /// See [TLDef(0x46D840AB)] - public class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } + public sealed partial class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } /// Admin log event See [TLDef(0x1FAD68CD)] - public class ChannelAdminLogEvent : IObject + public sealed partial class ChannelAdminLogEvent : IObject { /// Event ID public long id; @@ -11157,7 +11157,7 @@ namespace TL /// Admin log events See [TLDef(0xED8AF74D)] - public class Channels_AdminLogResults : IObject, IPeerResolver + public sealed partial class Channels_AdminLogResults : IObject, IPeerResolver { /// Admin log events public ChannelAdminLogEvent[] events; @@ -11171,7 +11171,7 @@ namespace TL /// Filter only certain admin log events See [TLDef(0xEA107AE4)] - public partial class ChannelAdminLogEventsFilter : IObject + public sealed partial class ChannelAdminLogEventsFilter : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11219,7 +11219,7 @@ namespace TL /// Popular contact See [TLDef(0x5CE14175)] - public class PopularContact : IObject + public sealed partial class PopularContact : IObject { /// Contact identifier public long client_id; @@ -11230,7 +11230,7 @@ namespace TL /// Favorited stickers See /// a value means messages.favedStickersNotModified [TLDef(0x2CB51097)] - public class Messages_FavedStickers : IObject + public sealed partial class Messages_FavedStickers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -11241,38 +11241,38 @@ namespace TL } /// Recent t.me urls See Derived classes: , , , , - public abstract class RecentMeUrl : IObject + public abstract partial class RecentMeUrl : IObject { /// URL public string url; } /// Unknown t.me url See [TLDef(0x46E1D13D)] - public class RecentMeUrlUnknown : RecentMeUrl { } + public sealed partial class RecentMeUrlUnknown : RecentMeUrl { } /// Recent t.me link to a user See [TLDef(0xB92C09E2, inheritBefore = true)] - public class RecentMeUrlUser : RecentMeUrl + public sealed partial class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } /// Recent t.me link to a chat See [TLDef(0xB2DA71D2, inheritBefore = true)] - public class RecentMeUrlChat : RecentMeUrl + public sealed partial class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } /// Recent t.me invite link to a chat See [TLDef(0xEB49081D, inheritBefore = true)] - public class RecentMeUrlChatInvite : RecentMeUrl + public sealed partial class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } /// Recent t.me stickerset installation URL See [TLDef(0xBC0A57DC, inheritBefore = true)] - public class RecentMeUrlStickerSet : RecentMeUrl + public sealed partial class RecentMeUrlStickerSet : RecentMeUrl { /// Stickerset public StickerSetCoveredBase set; @@ -11280,7 +11280,7 @@ namespace TL /// Recent t.me URLs See [TLDef(0x0E0310D7)] - public class Help_RecentMeUrls : IObject, IPeerResolver + public sealed partial class Help_RecentMeUrls : IObject, IPeerResolver { /// URLs public RecentMeUrl[] urls; @@ -11294,7 +11294,7 @@ namespace TL /// A single media in an album or grouped media sent with Messages_SendMultiMedia. See [TLDef(0x1CC6E91F)] - public class InputSingleMedia : IObject + public sealed partial class InputSingleMedia : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11316,7 +11316,7 @@ namespace TL /// Represents a bot logged in using the Telegram login widget See [TLDef(0xA6F8F452)] - public class WebAuthorization : IObject + public sealed partial class WebAuthorization : IObject { /// Authorization hash public long hash; @@ -11340,7 +11340,7 @@ namespace TL /// Web authorizations See [TLDef(0xED56C9FC)] - public class Account_WebAuthorizations : IObject + public sealed partial class Account_WebAuthorizations : IObject { /// Web authorization list public WebAuthorization[] authorizations; @@ -11352,24 +11352,24 @@ namespace TL public abstract partial class InputMessage : IObject { } /// Message by ID See [TLDef(0xA676A322)] - public class InputMessageID : InputMessage + public sealed partial class InputMessageID : InputMessage { /// Message ID public int id; } /// Message to which the specified message replies to See [TLDef(0xBAD88395)] - public class InputMessageReplyTo : InputMessage + public sealed partial class InputMessageReplyTo : InputMessage { /// ID of the message that replies to the message we need public int id; } /// Pinned message See [TLDef(0x86872538)] - public class InputMessagePinned : InputMessage { } + public sealed partial class InputMessagePinned : InputMessage { } /// Used by bots for fetching information about the message that originated a callback query See [TLDef(0xACFA1A7E)] - public class InputMessageCallbackQuery : InputMessage + public sealed partial class InputMessageCallbackQuery : InputMessage { /// Message ID public int id; @@ -11381,31 +11381,31 @@ namespace TL public abstract partial class InputDialogPeerBase : IObject { } /// A peer See [TLDef(0xFCAAFEB7)] - public class InputDialogPeer : InputDialogPeerBase + public sealed partial class InputDialogPeer : InputDialogPeerBase { /// Peer public InputPeer peer; } /// All peers in a peer folder See [TLDef(0x64600527)] - public class InputDialogPeerFolder : InputDialogPeerBase + public sealed partial class InputDialogPeerFolder : InputDialogPeerBase { /// Peer folder ID, for more info click here public int folder_id; } /// Peer, or all peers in a folder See Derived classes: , - public abstract class DialogPeerBase : IObject { } + public abstract partial class DialogPeerBase : IObject { } /// Peer See [TLDef(0xE56DBF05)] - public class DialogPeer : DialogPeerBase + public sealed partial class DialogPeer : DialogPeerBase { /// Peer public Peer peer; } /// Peer folder See [TLDef(0x514519E2)] - public class DialogPeerFolder : DialogPeerBase + public sealed partial class DialogPeerFolder : DialogPeerBase { /// Peer folder ID, for more info click here public int folder_id; @@ -11414,7 +11414,7 @@ namespace TL /// Found stickersets See /// a value means messages.foundStickerSetsNotModified [TLDef(0x8AF09DD2)] - public class Messages_FoundStickerSets : IObject + public sealed partial class Messages_FoundStickerSets : IObject { /// Hash for pagination, for more info click here public long hash; @@ -11424,7 +11424,7 @@ namespace TL /// SHA256 Hash of an uploaded file, to be checked for validity after download See [TLDef(0xF39B035C)] - public class FileHash : IObject + public sealed partial class FileHash : IObject { /// Offset from where to start computing SHA-256 hash public long offset; @@ -11436,7 +11436,7 @@ namespace TL /// Info about an MTProxy used to connect. See [TLDef(0x75588B3F)] - public class InputClientProxy : IObject + public sealed partial class InputClientProxy : IObject { /// Proxy address public string address; @@ -11445,17 +11445,17 @@ namespace TL } /// Update of Telegram's terms of service See Derived classes: , - public abstract class Help_TermsOfServiceUpdateBase : IObject { } + public abstract partial class Help_TermsOfServiceUpdateBase : IObject { } /// No changes were made to telegram's terms of service See [TLDef(0xE3309F7F)] - public class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase + public sealed partial class Help_TermsOfServiceUpdateEmpty : Help_TermsOfServiceUpdateBase { /// New TOS updates will have to be queried using Help_GetTermsOfServiceUpdate in expires seconds public DateTime expires; } /// Info about an update of telegram's terms of service. If the terms of service are declined, then the Account_DeleteAccount method should be called with the reason "Decline ToS update" See [TLDef(0x28ECF961)] - public class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase + public sealed partial class Help_TermsOfServiceUpdate : Help_TermsOfServiceUpdateBase { /// New TOS updates will have to be queried using Help_GetTermsOfServiceUpdate in expires seconds public DateTime expires; @@ -11464,14 +11464,14 @@ namespace TL } /// Secure passport file, for more info see the passport docs » See Derived classes: , - public abstract class InputSecureFileBase : IObject + public abstract partial class InputSecureFileBase : IObject { /// Secure file ID public abstract long ID { get; set; } } /// Uploaded secure file, for more info see the passport docs » See [TLDef(0x3334B0F0)] - public class InputSecureFileUploaded : InputSecureFileBase + public sealed partial class InputSecureFileUploaded : InputSecureFileBase { /// Secure file ID public long id; @@ -11489,7 +11489,7 @@ namespace TL } /// Pre-uploaded passport file, for more info see the passport docs » See [TLDef(0x5367E5BE)] - public class InputSecureFile : InputSecureFileBase + public sealed partial class InputSecureFile : InputSecureFileBase { /// Secure file ID public long id; @@ -11503,7 +11503,7 @@ namespace TL /// Secure passport file, for more info see the passport docs » See /// a value means secureFileEmpty [TLDef(0x7D09C27E)] - public partial class SecureFile : IObject + public sealed partial class SecureFile : IObject { /// ID public long id; @@ -11523,7 +11523,7 @@ namespace TL /// Secure passport data, for more info see the passport docs » See [TLDef(0x8AEABEC3)] - public class SecureData : IObject + public sealed partial class SecureData : IObject { /// Data public byte[] data; @@ -11534,17 +11534,17 @@ namespace TL } /// Plaintext verified passport data. See Derived classes: , - public abstract class SecurePlainData : IObject { } + public abstract partial class SecurePlainData : IObject { } /// Phone number to use in telegram passport: it must be verified, first ». See [TLDef(0x7D6099DD)] - public class SecurePlainPhone : SecurePlainData + public sealed partial class SecurePlainPhone : SecurePlainData { /// Phone number public string phone; } /// Email address to use in telegram passport: it must be verified, first ». See [TLDef(0x21EC5A5F)] - public class SecurePlainEmail : SecurePlainData + public sealed partial class SecurePlainEmail : SecurePlainData { /// Email address public string email; @@ -11583,7 +11583,7 @@ namespace TL /// Secure value See [TLDef(0x187FA0CA)] - public class SecureValue : IObject + public sealed partial class SecureValue : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11627,7 +11627,7 @@ namespace TL /// Secure value, for more info see the passport docs » See [TLDef(0xDB21D0A7)] - public class InputSecureValue : IObject + public sealed partial class InputSecureValue : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11669,7 +11669,7 @@ namespace TL /// Secure value hash See [TLDef(0xED1ECDB0)] - public class SecureValueHash : IObject + public sealed partial class SecureValueHash : IObject { /// Secure value type public SecureValueType type; @@ -11678,7 +11678,7 @@ namespace TL } /// Secure value error See Derived classes: , , , , , , , , - public abstract class SecureValueErrorBase : IObject + public abstract partial class SecureValueErrorBase : IObject { /// The section of the user's Telegram Passport which has the error, one of , , , , , public virtual SecureValueType Type => default; @@ -11687,7 +11687,7 @@ namespace TL } /// Represents an issue in one of the data fields that was provided by the user. The error is considered resolved when the field's value changes. See [TLDef(0xE8A40BD9)] - public class SecureValueErrorData : SecureValueErrorBase + public sealed partial class SecureValueErrorData : SecureValueErrorBase { /// The section of the user's Telegram Passport which has the error, one of , , , , , public SecureValueType type; @@ -11705,7 +11705,7 @@ namespace TL } /// Represents an issue with the front side of a document. The error is considered resolved when the file with the front side of the document changes. See [TLDef(0x00BE3DFA)] - public class SecureValueErrorFrontSide : SecureValueErrorBase + public sealed partial class SecureValueErrorFrontSide : SecureValueErrorBase { /// One of , , , public SecureValueType type; @@ -11721,7 +11721,7 @@ namespace TL } /// Represents an issue with the reverse side of a document. The error is considered resolved when the file with reverse side of the document changes. See [TLDef(0x868A2AA5)] - public class SecureValueErrorReverseSide : SecureValueErrorBase + public sealed partial class SecureValueErrorReverseSide : SecureValueErrorBase { /// One of , public SecureValueType type; @@ -11737,7 +11737,7 @@ namespace TL } /// Represents an issue with the selfie with a document. The error is considered resolved when the file with the selfie changes. See [TLDef(0xE537CED6)] - public class SecureValueErrorSelfie : SecureValueErrorBase + public sealed partial class SecureValueErrorSelfie : SecureValueErrorBase { /// One of , , , public SecureValueType type; @@ -11753,7 +11753,7 @@ namespace TL } /// Represents an issue with a document scan. The error is considered resolved when the file with the document scan changes. See [TLDef(0x7A700873)] - public class SecureValueErrorFile : SecureValueErrorBase + public partial class SecureValueErrorFile : SecureValueErrorBase { /// One of , , , , public SecureValueType type; @@ -11769,7 +11769,7 @@ namespace TL } /// Represents an issue with a list of scans. The error is considered resolved when the list of files containing the scans changes. See [TLDef(0x666220E9)] - public class SecureValueErrorFiles : SecureValueErrorBase + public partial class SecureValueErrorFiles : SecureValueErrorBase { /// One of , , , , public SecureValueType type; @@ -11785,7 +11785,7 @@ namespace TL } /// Secure value error See [TLDef(0x869D758F)] - public class SecureValueError : SecureValueErrorBase + public sealed partial class SecureValueError : SecureValueErrorBase { /// Type of element which has the issue public SecureValueType type; @@ -11801,18 +11801,18 @@ namespace TL } /// Represents an issue with one of the files that constitute the translation of a document. The error is considered resolved when the file changes. See [TLDef(0xA1144770)] - public class SecureValueErrorTranslationFile : SecureValueErrorFile + public sealed partial class SecureValueErrorTranslationFile : SecureValueErrorFile { } /// Represents an issue with the translated version of a document. The error is considered resolved when a file with the document translation changes. See [TLDef(0x34636DD8)] - public class SecureValueErrorTranslationFiles : SecureValueErrorFiles + public sealed partial class SecureValueErrorTranslationFiles : SecureValueErrorFiles { } /// Encrypted credentials required to decrypt telegram passport data. See [TLDef(0x33F0EA47)] - public class SecureCredentialsEncrypted : IObject + public sealed partial class SecureCredentialsEncrypted : IObject { /// Encrypted JSON-serialized data with unique user's payload, data hashes and secrets required for EncryptedPassportElement decryption and authentication, as described in decrypting data » public byte[] data; @@ -11824,7 +11824,7 @@ namespace TL /// Telegram Passport authorization form See [TLDef(0xAD2E1CD8)] - public class Account_AuthorizationForm : IObject + public sealed partial class Account_AuthorizationForm : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11848,7 +11848,7 @@ namespace TL /// The sent email code See [TLDef(0x811F854F)] - public class Account_SentEmailCode : IObject + public sealed partial class Account_SentEmailCode : IObject { /// The email (to which the code was sent) must match this pattern public string email_pattern; @@ -11859,7 +11859,7 @@ namespace TL /// Deep link info, see the here for more details See /// a value means help.deepLinkInfoEmpty [TLDef(0x6A4EE832)] - public class Help_DeepLinkInfo : IObject + public sealed partial class Help_DeepLinkInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11878,10 +11878,10 @@ namespace TL } /// Saved contact See Derived classes: - public abstract class SavedContact : IObject { } + public abstract partial class SavedContact : IObject { } /// Saved contact See [TLDef(0x1142BD56)] - public class SavedPhoneContact : SavedContact + public sealed partial class SavedPhoneContact : SavedContact { /// Phone number public string phone; @@ -11895,7 +11895,7 @@ namespace TL /// Takeout info See [TLDef(0x4DBA4501)] - public class Account_Takeout : IObject + public sealed partial class Account_Takeout : IObject { /// Takeout ID public long id; @@ -11903,10 +11903,10 @@ namespace TL /// Key derivation function to use when generating the password hash for SRP two-factor authorization See Derived classes: /// a value means passwordKdfAlgoUnknown - public abstract class PasswordKdfAlgo : IObject { } + public abstract partial class PasswordKdfAlgo : IObject { } /// This key derivation algorithm defines that SRP 2FA login must be used See [TLDef(0x3A912D4A)] - public class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo + public sealed partial class PasswordKdfAlgoSHA256SHA256PBKDF2HMACSHA512iter100000SHA256ModPow : PasswordKdfAlgo { /// One of two salts used by the derivation function (see SRP 2FA login) public byte[] salt1; @@ -11920,21 +11920,21 @@ namespace TL /// KDF algorithm to use for computing telegram passport hash See Derived classes: , /// a value means securePasswordKdfAlgoUnknown - public abstract class SecurePasswordKdfAlgo : IObject + public abstract partial class SecurePasswordKdfAlgo : IObject { /// Salt public byte[] salt; } /// PBKDF2 with SHA512 and 100000 iterations KDF algo See [TLDef(0xBBF2DDA0)] - public class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } + public sealed partial class SecurePasswordKdfAlgoPBKDF2HMACSHA512iter100000 : SecurePasswordKdfAlgo { } /// SHA512 KDF algo See [TLDef(0x86471D92)] - public class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } + public sealed partial class SecurePasswordKdfAlgoSHA512 : SecurePasswordKdfAlgo { } /// Secure settings See [TLDef(0x1527BCAC)] - public class SecureSecretSettings : IObject + public sealed partial class SecureSecretSettings : IObject { /// Secure KDF algo public SecurePasswordKdfAlgo secure_algo; @@ -11947,7 +11947,7 @@ namespace TL /// Constructor for checking the validity of a 2FA SRP password (see SRP) See /// a value means inputCheckPasswordEmpty [TLDef(0xD27FF082)] - public class InputCheckPasswordSRP : IObject + public sealed partial class InputCheckPasswordSRP : IObject { /// SRP ID public long srp_id; @@ -11958,10 +11958,10 @@ namespace TL } /// Required secure file type See Derived classes: , - public abstract class SecureRequiredTypeBase : IObject { } + public abstract partial class SecureRequiredTypeBase : IObject { } /// Required type See [TLDef(0x829D99DA)] - public class SecureRequiredType : SecureRequiredTypeBase + public sealed partial class SecureRequiredType : SecureRequiredTypeBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -11980,7 +11980,7 @@ namespace TL } /// One of See [TLDef(0x027477B4)] - public class SecureRequiredTypeOneOf : SecureRequiredTypeBase + public sealed partial class SecureRequiredTypeOneOf : SecureRequiredTypeBase { /// Secure required value types public SecureRequiredTypeBase[] types; @@ -11989,7 +11989,7 @@ namespace TL /// Telegram passport configuration See /// a value means help.passportConfigNotModified [TLDef(0xA098D6AF)] - public class Help_PassportConfig : IObject + public sealed partial class Help_PassportConfig : IObject { /// Hash for pagination, for more info click here public int hash; @@ -11999,7 +11999,7 @@ namespace TL /// Event that occurred in the application. See [TLDef(0x1D1B1245)] - public class InputAppEvent : IObject + public sealed partial class InputAppEvent : IObject { /// Client's exact timestamp for the event public double time; @@ -12013,7 +12013,7 @@ namespace TL /// JSON key: value pair See [TLDef(0xC0DE1BD9)] - public partial class JsonObjectValue : IObject + public sealed partial class JsonObjectValue : IObject { /// Key public string key; @@ -12025,38 +12025,38 @@ namespace TL public abstract partial class JSONValue : IObject { } /// null JSON value See [TLDef(0x3F6D7B68)] - public partial class JsonNull : JSONValue { } + public sealed partial class JsonNull : JSONValue { } /// JSON boolean value See [TLDef(0xC7345E6A)] - public partial class JsonBool : JSONValue + public sealed partial class JsonBool : JSONValue { /// Value public bool value; } /// JSON numeric value See [TLDef(0x2BE0DFA4)] - public partial class JsonNumber : JSONValue + public sealed partial class JsonNumber : JSONValue { /// Value public double value; } /// JSON string See [TLDef(0xB71E767A)] - public partial class JsonString : JSONValue + public sealed partial class JsonString : JSONValue { /// Value public string value; } /// JSON array See [TLDef(0xF7444763)] - public partial class JsonArray : JSONValue + public sealed partial class JsonArray : JSONValue { /// JSON values public JSONValue[] value; } /// JSON object value See [TLDef(0x99C1D49D)] - public partial class JsonObject : JSONValue + public sealed partial class JsonObject : JSONValue { /// Values public JsonObjectValue[] value; @@ -12064,7 +12064,7 @@ namespace TL /// Table cell See [TLDef(0x34566B6A)] - public class PageTableCell : IObject + public sealed partial class PageTableCell : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12098,7 +12098,7 @@ namespace TL /// Table row See [TLDef(0xE0C0C5E5)] - public class PageTableRow : IObject + public sealed partial class PageTableRow : IObject { /// Table cells public PageTableCell[] cells; @@ -12106,7 +12106,7 @@ namespace TL /// Page caption See [TLDef(0x6F747657)] - public class PageCaption : IObject + public sealed partial class PageCaption : IObject { /// Caption public RichText text; @@ -12115,38 +12115,38 @@ namespace TL } /// Item in block list See Derived classes: , - public abstract class PageListItem : IObject { } + public abstract partial class PageListItem : IObject { } /// List item See [TLDef(0xB92FB6CD)] - public class PageListItemText : PageListItem + public sealed partial class PageListItemText : PageListItem { /// Text public RichText text; } /// List item See [TLDef(0x25E073FC)] - public class PageListItemBlocks : PageListItem + public sealed partial class PageListItemBlocks : PageListItem { /// Blocks public PageBlock[] blocks; } /// Represents an instant view ordered list See Derived classes: , - public abstract class PageListOrderedItem : IObject + public abstract partial class PageListOrderedItem : IObject { /// Number of element within ordered list public string num; } /// Ordered list of text items See [TLDef(0x5E068047, inheritBefore = true)] - public class PageListOrderedItemText : PageListOrderedItem + public sealed partial class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } /// Ordered list of IV blocks See [TLDef(0x98DD8936, inheritBefore = true)] - public class PageListOrderedItemBlocks : PageListOrderedItem + public sealed partial class PageListOrderedItemBlocks : PageListOrderedItem { /// Item contents public PageBlock[] blocks; @@ -12154,7 +12154,7 @@ namespace TL /// Related article See [TLDef(0xB390DC08)] - public class PageRelatedArticle : IObject + public sealed partial class PageRelatedArticle : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12190,7 +12190,7 @@ namespace TL /// Instant view page See [TLDef(0x98657F0D)] - public class Page : IObject + public sealed partial class Page : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12220,7 +12220,7 @@ namespace TL /// Localized name for telegram support See [TLDef(0x8C05F1C9)] - public class Help_SupportName : IObject + public sealed partial class Help_SupportName : IObject { /// Localized name public string name; @@ -12229,7 +12229,7 @@ namespace TL /// Internal use See /// a value means help.userInfoEmpty [TLDef(0x01EB3758)] - public class Help_UserInfo : IObject + public sealed partial class Help_UserInfo : IObject { /// Info public string message; @@ -12243,7 +12243,7 @@ namespace TL /// A possible answer of a poll See [TLDef(0x6CA9C2E9)] - public class PollAnswer : IObject + public sealed partial class PollAnswer : IObject { /// Textual representation of the answer public string text; @@ -12253,7 +12253,7 @@ namespace TL /// Poll See [TLDef(0x86E18161)] - public class Poll : IObject + public sealed partial class Poll : IObject { /// ID of the poll public long id; @@ -12287,7 +12287,7 @@ namespace TL /// A poll answer, and how users voted on it See [TLDef(0x3B6DDAD2)] - public class PollAnswerVoters : IObject + public sealed partial class PollAnswerVoters : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12307,7 +12307,7 @@ namespace TL /// Results of poll See [TLDef(0x7ADF2420)] - public class PollResults : IObject + public sealed partial class PollResults : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12339,7 +12339,7 @@ namespace TL /// Number of online users in a chat See [TLDef(0xF041E250)] - public class ChatOnlines : IObject + public sealed partial class ChatOnlines : IObject { /// Number of online users public int onlines; @@ -12347,7 +12347,7 @@ namespace TL /// URL with chat statistics See [TLDef(0x47A971E0)] - public class StatsURL : IObject + public sealed partial class StatsURL : IObject { /// Chat statistics public string url; @@ -12355,7 +12355,7 @@ namespace TL /// Represents the rights of an admin in a channel/supergroup. See [TLDef(0x5FB224D5)] - public class ChatAdminRights : IObject + public sealed partial class ChatAdminRights : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12397,7 +12397,7 @@ namespace TL /// Represents the rights of a normal user in a supergroup/channel/chat. In this case, the flags are inverted: if set, a flag does not allow a user to do X. See [TLDef(0x9F120418)] - public class ChatBannedRights : IObject + public sealed partial class ChatBannedRights : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12450,10 +12450,10 @@ namespace TL } /// Wallpaper See Derived classes: , , - public abstract class InputWallPaperBase : IObject { } + public abstract partial class InputWallPaperBase : IObject { } /// Wallpaper See [TLDef(0xE630B979)] - public class InputWallPaper : InputWallPaperBase + public sealed partial class InputWallPaper : InputWallPaperBase { /// Wallpaper ID public long id; @@ -12462,14 +12462,14 @@ namespace TL } /// Wallpaper by slug (a unique ID, obtained from a wallpaper link ») See [TLDef(0x72091C80)] - public class InputWallPaperSlug : InputWallPaperBase + public sealed partial class InputWallPaperSlug : InputWallPaperBase { /// Unique wallpaper ID public string slug; } /// Wallpaper with no file access hash, used for example when deleting (unsave=true) wallpapers using Account_SaveWallPaper, specifying just the wallpaper ID. See [TLDef(0x967A462E)] - public class InputWallPaperNoFile : InputWallPaperBase + public sealed partial class InputWallPaperNoFile : InputWallPaperBase { /// Wallpaper ID public long id; @@ -12478,7 +12478,7 @@ namespace TL /// Installed wallpapers See /// a value means account.wallPapersNotModified [TLDef(0xCDC3858C)] - public class Account_WallPapers : IObject + public sealed partial class Account_WallPapers : IObject { /// Hash for pagination, for more info click here public long hash; @@ -12488,7 +12488,7 @@ namespace TL /// Settings used by telegram servers for sending the confirm code. See [TLDef(0xAD253D78)] - public class CodeSettings : IObject + public sealed partial class CodeSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12520,7 +12520,7 @@ namespace TL /// Wallpaper rendering information. See [TLDef(0x372EFCD0)] - public class WallPaperSettings : IObject + public sealed partial class WallPaperSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12562,7 +12562,7 @@ namespace TL /// Autodownload settings See [TLDef(0xBAA57628)] - public class AutoDownloadSettings : IObject + public sealed partial class AutoDownloadSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12596,7 +12596,7 @@ namespace TL /// Media autodownload settings See [TLDef(0x63CACF26)] - public class Account_AutoDownloadSettings : IObject + public sealed partial class Account_AutoDownloadSettings : IObject { /// Low data usage preset public AutoDownloadSettings low; @@ -12608,7 +12608,7 @@ namespace TL /// Emoji keyword See [TLDef(0xD5B3B9F9)] - public class EmojiKeyword : IObject + public partial class EmojiKeyword : IObject { /// Keyword public string keyword; @@ -12617,11 +12617,11 @@ namespace TL } /// Deleted emoji keyword See [TLDef(0x236DF622)] - public class EmojiKeywordDeleted : EmojiKeyword { } + public sealed partial class EmojiKeywordDeleted : EmojiKeyword { } /// Changes to emoji keywords See [TLDef(0x5CC761BD)] - public class EmojiKeywordsDifference : IObject + public sealed partial class EmojiKeywordsDifference : IObject { /// Language code for keywords public string lang_code; @@ -12635,7 +12635,7 @@ namespace TL /// An HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation See [TLDef(0xA575739D)] - public class EmojiURL : IObject + public sealed partial class EmojiURL : IObject { /// An HTTP URL which can be used to automatically log in into translation platform and suggest new emoji replacements. The URL will be valid for 30 seconds after generation public string url; @@ -12643,7 +12643,7 @@ namespace TL /// Emoji language See [TLDef(0xB3FB5361)] - public class EmojiLanguage : IObject + public sealed partial class EmojiLanguage : IObject { /// Language code public string lang_code; @@ -12651,7 +12651,7 @@ namespace TL /// Folder See [TLDef(0xFF544E65)] - public class Folder : IObject + public sealed partial class Folder : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12677,7 +12677,7 @@ namespace TL /// Peer in a folder See [TLDef(0xFBD2C296)] - public class InputFolderPeer : IObject + public sealed partial class InputFolderPeer : IObject { /// Peer public InputPeer peer; @@ -12687,7 +12687,7 @@ namespace TL /// Peer in a folder See [TLDef(0xE9BAA668)] - public class FolderPeer : IObject + public sealed partial class FolderPeer : IObject { /// Folder peer info public Peer peer; @@ -12697,7 +12697,7 @@ namespace TL /// Indicates how many results would be found by a Messages_Search call with the same parameters See [TLDef(0xE844EBFF)] - public class Messages_SearchCounter : IObject + public sealed partial class Messages_SearchCounter : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12715,10 +12715,10 @@ namespace TL /// URL authorization result See Derived classes: , /// a value means urlAuthResultDefault - public abstract class UrlAuthResult : IObject { } + public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See [TLDef(0x92D33A0E)] - public class UrlAuthResultRequest : UrlAuthResult + public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12735,7 +12735,7 @@ namespace TL } /// Details about an accepted authorization request, for more info click here » See [TLDef(0x8F8C0E4E)] - public class UrlAuthResultAccepted : UrlAuthResult + public sealed partial class UrlAuthResultAccepted : UrlAuthResult { /// The URL name of the website on which the user has logged in. public string url; @@ -12744,7 +12744,7 @@ namespace TL /// Geographical location of supergroup (geogroups) See /// a value means channelLocationEmpty [TLDef(0x209B82DB)] - public class ChannelLocation : IObject + public sealed partial class ChannelLocation : IObject { /// Geographical location of supergroup public GeoPoint geo_point; @@ -12753,14 +12753,14 @@ namespace TL } /// Geolocated peer See Derived classes: , - public abstract class PeerLocatedBase : IObject + public abstract partial class PeerLocatedBase : IObject { /// Validity period of current data public virtual DateTime Expires => default; } /// Peer geolocated nearby See [TLDef(0xCA461B5D)] - public class PeerLocated : PeerLocatedBase + public sealed partial class PeerLocated : PeerLocatedBase { /// Peer public Peer peer; @@ -12774,7 +12774,7 @@ namespace TL } /// Current peer See [TLDef(0xF8EC284B)] - public class PeerSelfLocated : PeerLocatedBase + public sealed partial class PeerSelfLocated : PeerLocatedBase { /// Expiry of geolocation info for current peer public DateTime expires; @@ -12785,7 +12785,7 @@ namespace TL /// Restriction reason. See [TLDef(0xD072ACB4)] - public class RestrictionReason : IObject + public sealed partial class RestrictionReason : IObject { /// Platform identifier (ios, android, wp, all, etc.), can be concatenated with a dash as separator (android-ios, ios-wp, etc) public string platform; @@ -12796,10 +12796,10 @@ namespace TL } /// Cloud theme See Derived classes: , - public abstract class InputThemeBase : IObject { } + public abstract partial class InputThemeBase : IObject { } /// Theme See [TLDef(0x3C5693E9)] - public class InputTheme : InputThemeBase + public sealed partial class InputTheme : InputThemeBase { /// ID public long id; @@ -12808,7 +12808,7 @@ namespace TL } /// Theme by theme ID See [TLDef(0xF5890DF1)] - public class InputThemeSlug : InputThemeBase + public sealed partial class InputThemeSlug : InputThemeBase { /// Unique theme ID obtained from a theme deep link » public string slug; @@ -12816,7 +12816,7 @@ namespace TL /// Theme See [TLDef(0xA00E67D6)] - public partial class Theme : IObject + public sealed partial class Theme : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12859,7 +12859,7 @@ namespace TL /// Installed themes See /// a value means account.themesNotModified [TLDef(0x9A3D8C6D)] - public class Account_Themes : IObject + public sealed partial class Account_Themes : IObject { /// Hash for pagination, for more info click here public long hash; @@ -12868,10 +12868,10 @@ namespace TL } /// Login token (for QR code login) See Derived classes: , , - public abstract class Auth_LoginTokenBase : IObject { } + public abstract partial class Auth_LoginTokenBase : IObject { } /// Login token (for QR code login) See [TLDef(0x629F1980)] - public class Auth_LoginToken : Auth_LoginTokenBase + public sealed partial class Auth_LoginToken : Auth_LoginTokenBase { /// Expiration date of QR code public DateTime expires; @@ -12880,7 +12880,7 @@ namespace TL } /// Repeat the query to the specified DC See [TLDef(0x068E9916)] - public class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase + public sealed partial class Auth_LoginTokenMigrateTo : Auth_LoginTokenBase { /// DC ID public int dc_id; @@ -12889,7 +12889,7 @@ namespace TL } /// Login via token (QR code) succeeded! See [TLDef(0x390D5C5E)] - public class Auth_LoginTokenSuccess : Auth_LoginTokenBase + public sealed partial class Auth_LoginTokenSuccess : Auth_LoginTokenBase { /// Authorization info public Auth_AuthorizationBase authorization; @@ -12897,7 +12897,7 @@ namespace TL /// Sensitive content settings See [TLDef(0x57E28221)] - public class Account_ContentSettings : IObject + public sealed partial class Account_ContentSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12913,7 +12913,7 @@ namespace TL /// Inactive chat list See [TLDef(0xA927FEC5)] - public class Messages_InactiveChats : IObject, IPeerResolver + public sealed partial class Messages_InactiveChats : IObject, IPeerResolver { /// When was the chat last active public int[] dates; @@ -12942,7 +12942,7 @@ namespace TL /// Theme settings See [TLDef(0x8FDE504F)] - public class InputThemeSettings : IObject + public sealed partial class InputThemeSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -12974,7 +12974,7 @@ namespace TL /// Theme settings See [TLDef(0xFA58B6D4)] - public class ThemeSettings : IObject + public sealed partial class ThemeSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13003,10 +13003,10 @@ namespace TL } /// Webpage attributes See Derived classes: , - public abstract class WebPageAttribute : IObject { } + public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] - public class WebPageAttributeTheme : WebPageAttribute + public sealed partial class WebPageAttributeTheme : WebPageAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13025,7 +13025,7 @@ namespace TL } /// Webpage preview of a Telegram story See [TLDef(0x2E94C3E7)] - public class WebPageAttributeStory : WebPageAttribute + public sealed partial class WebPageAttributeStory : WebPageAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13045,7 +13045,7 @@ namespace TL /// How users voted in a poll See [TLDef(0x4899484E)] - public class Messages_VotesList : IObject, IPeerResolver + public sealed partial class Messages_VotesList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13071,7 +13071,7 @@ namespace TL /// Credit card info URL provided by the bank See [TLDef(0xF568028A)] - public class BankCardOpenUrl : IObject + public sealed partial class BankCardOpenUrl : IObject { /// Info URL public string url; @@ -13081,7 +13081,7 @@ namespace TL /// Credit card info, provided by the card's bank(s) See [TLDef(0x3E24E573)] - public class Payments_BankCardData : IObject + public sealed partial class Payments_BankCardData : IObject { /// Credit card title public string title; @@ -13091,7 +13091,7 @@ namespace TL /// Dialog filter (folder ») See Derived classes: , /// a value means dialogFilterDefault - public abstract class DialogFilterBase : IObject + public abstract partial class DialogFilterBase : IObject { /// Folder ID public virtual int ID => default; @@ -13107,7 +13107,7 @@ namespace TL } /// Dialog filter AKA folder See [TLDef(0x5FB5523B)] - public class DialogFilter : DialogFilterBase + public sealed partial class DialogFilter : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13163,7 +13163,7 @@ namespace TL } /// A folder imported using a chat folder deep link ». See [TLDef(0x9FE28EA4)] - public class DialogFilterChatlist : DialogFilterBase + public sealed partial class DialogFilterChatlist : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13204,7 +13204,7 @@ namespace TL /// Suggested folders See [TLDef(0x77744D4A)] - public class DialogFilterSuggested : IObject + public sealed partial class DialogFilterSuggested : IObject { /// Folder info public DialogFilterBase filter; @@ -13214,7 +13214,7 @@ namespace TL /// Channel statistics date range See [TLDef(0xB637EDAF)] - public class StatsDateRangeDays : IObject + public sealed partial class StatsDateRangeDays : IObject { /// Initial date public DateTime min_date; @@ -13224,7 +13224,7 @@ namespace TL /// Statistics value couple; initial and final value for period of time currently in consideration See [TLDef(0xCB43ACDE)] - public class StatsAbsValueAndPrev : IObject + public sealed partial class StatsAbsValueAndPrev : IObject { /// Current value public double current; @@ -13234,7 +13234,7 @@ namespace TL /// Channel statistics percentage.
Compute the percentage simply by doing part * total / 100 See
[TLDef(0xCBCE2FE0)] - public class StatsPercentValue : IObject + public sealed partial class StatsPercentValue : IObject { /// Partial value public double part; @@ -13243,24 +13243,24 @@ namespace TL } /// Channel statistics graph See Derived classes: , , - public abstract class StatsGraphBase : IObject { } + public abstract partial class StatsGraphBase : IObject { } /// This channel statistics graph must be generated asynchronously using Stats_LoadAsyncGraph to reduce server load See [TLDef(0x4A27EB2D)] - public class StatsGraphAsync : StatsGraphBase + public sealed partial class StatsGraphAsync : StatsGraphBase { /// Token to use for fetching the async graph public string token; } /// An error occurred while generating the statistics graph See [TLDef(0xBEDC9822)] - public class StatsGraphError : StatsGraphBase + public sealed partial class StatsGraphError : StatsGraphBase { /// The error public string error; } /// Channel statistics graph See [TLDef(0x8EA464B6)] - public class StatsGraph : StatsGraphBase + public sealed partial class StatsGraph : StatsGraphBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13278,7 +13278,7 @@ namespace TL /// Channel statistics. See [TLDef(0x396CA5FC)] - public class Stats_BroadcastStats : IObject + public sealed partial class Stats_BroadcastStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -13327,17 +13327,17 @@ namespace TL } /// Info about pinned MTProxy or Public Service Announcement peers. See Derived classes: , - public abstract class Help_PromoDataBase : IObject { } + public abstract partial class Help_PromoDataBase : IObject { } /// No PSA/MTProxy info is available See [TLDef(0x98F6AC75)] - public class Help_PromoDataEmpty : Help_PromoDataBase + public sealed partial class Help_PromoDataEmpty : Help_PromoDataBase { /// Re-fetch PSA/MTProxy info after the specified number of seconds public DateTime expires; } /// MTProxy/Public Service Announcement information See [TLDef(0x8C39793F)] - public class Help_PromoData : Help_PromoDataBase + public sealed partial class Help_PromoData : Help_PromoDataBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13368,10 +13368,10 @@ namespace TL } /// Represents an animated video thumbnail See Derived classes: , , - public abstract class VideoSizeBase : IObject { } + public abstract partial class VideoSizeBase : IObject { } /// An animated profile picture in MPEG4 format See [TLDef(0xDE33B094)] - public class VideoSize : VideoSizeBase + public sealed partial class VideoSize : VideoSizeBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13394,7 +13394,7 @@ namespace TL } /// An animated profile picture based on a custom emoji sticker. See [TLDef(0xF85C413C)] - public class VideoSizeEmojiMarkup : VideoSizeBase + public sealed partial class VideoSizeEmojiMarkup : VideoSizeBase { /// Custom emoji ID: the custom emoji sticker is shown at the center of the profile picture and occupies at most 67% of it. public long emoji_id; @@ -13403,7 +13403,7 @@ namespace TL } /// An animated profile picture based on a sticker. See [TLDef(0x0DA082FE)] - public class VideoSizeStickerMarkup : VideoSizeBase + public sealed partial class VideoSizeStickerMarkup : VideoSizeBase { /// Stickerset public InputStickerSet stickerset; @@ -13415,7 +13415,7 @@ namespace TL /// Information about an active user in a supergroup See [TLDef(0x9D04AF9B)] - public class StatsGroupTopPoster : IObject + public sealed partial class StatsGroupTopPoster : IObject { /// User ID public long user_id; @@ -13427,7 +13427,7 @@ namespace TL /// Information about an active admin in a supergroup See [TLDef(0xD7584C87)] - public class StatsGroupTopAdmin : IObject + public sealed partial class StatsGroupTopAdmin : IObject { /// User ID public long user_id; @@ -13441,7 +13441,7 @@ namespace TL /// Information about an active supergroup inviter See [TLDef(0x535F779D)] - public class StatsGroupTopInviter : IObject + public sealed partial class StatsGroupTopInviter : IObject { /// User ID public long user_id; @@ -13451,7 +13451,7 @@ namespace TL /// Supergroup statistics See [TLDef(0xEF7FF916)] - public class Stats_MegagroupStats : IObject + public sealed partial class Stats_MegagroupStats : IObject { /// Period in consideration public StatsDateRangeDays period; @@ -13491,7 +13491,7 @@ namespace TL /// Global privacy settings See [TLDef(0x734C4CCB)] - public class GlobalPrivacySettings : IObject + public sealed partial class GlobalPrivacySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13511,7 +13511,7 @@ namespace TL /// Country code and phone number pattern of a specific country See [TLDef(0x4203C5EF)] - public class Help_CountryCode : IObject + public sealed partial class Help_CountryCode : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13533,7 +13533,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of a specific country See [TLDef(0xC3878E23)] - public class Help_Country : IObject + public sealed partial class Help_Country : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13558,7 +13558,7 @@ namespace TL /// Name, ISO code, localized name and phone codes/patterns of all available countries See /// a value means help.countriesListNotModified [TLDef(0x87D0759E)] - public class Help_CountriesList : IObject + public sealed partial class Help_CountriesList : IObject { /// Name, ISO code, localized name and phone codes/patterns of all available countries public Help_Country[] countries; @@ -13568,7 +13568,7 @@ namespace TL /// View, forward counter + info about replies of a specific message See [TLDef(0x455B853D)] - public class MessageViews : IObject + public sealed partial class MessageViews : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13592,7 +13592,7 @@ namespace TL /// View, forward counter + info about replies See [TLDef(0xB6C4F543)] - public class Messages_MessageViews : IObject, IPeerResolver + public sealed partial class Messages_MessageViews : IObject, IPeerResolver { /// View, forward counter + info about replies public MessageViews[] views; @@ -13606,7 +13606,7 @@ namespace TL /// Information about a message thread See [TLDef(0xA6341782)] - public class Messages_DiscussionMessage : IObject, IPeerResolver + public sealed partial class Messages_DiscussionMessage : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13639,10 +13639,10 @@ namespace TL } /// Reply information See Derived classes: , - public abstract class MessageReplyHeaderBase : IObject { } + public abstract partial class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See [TLDef(0xAFBC09DB)] - public class MessageReplyHeader : MessageReplyHeaderBase + public sealed partial class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13691,7 +13691,7 @@ namespace TL } /// Represents a reply to a story See [TLDef(0x0E5AF939)] - public class MessageReplyStoryHeader : MessageReplyHeaderBase + public sealed partial class MessageReplyStoryHeader : MessageReplyHeaderBase { public Peer peer; /// Story ID @@ -13700,7 +13700,7 @@ namespace TL /// Info about the comment section of a channel post, or a simple message thread See [TLDef(0x83D60FC2)] - public class MessageReplies : IObject + public sealed partial class MessageReplies : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13732,7 +13732,7 @@ namespace TL /// Information about a blocked peer See [TLDef(0xE8FD8014)] - public class PeerBlocked : IObject + public sealed partial class PeerBlocked : IObject { /// Peer ID public Peer peer_id; @@ -13742,7 +13742,7 @@ namespace TL /// Message statistics See [TLDef(0x7FE91C14)] - public class Stats_MessageStats : IObject + public sealed partial class Stats_MessageStats : IObject { /// Message view graph public StatsGraphBase views_graph; @@ -13760,7 +13760,7 @@ namespace TL } /// An ended group call See [TLDef(0x7780BCB4)] - public class GroupCallDiscarded : GroupCallBase + public sealed partial class GroupCallDiscarded : GroupCallBase { /// Group call ID public long id; @@ -13776,7 +13776,7 @@ namespace TL } /// Info about a group call or livestream See [TLDef(0xD597650C)] - public class GroupCall : GroupCallBase + public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13839,7 +13839,7 @@ namespace TL /// Points to a specific group call See [TLDef(0xD8AA840F)] - public class InputGroupCall : IObject + public sealed partial class InputGroupCall : IObject { /// Group call ID public long id; @@ -13849,7 +13849,7 @@ namespace TL /// Info about a group call participant See [TLDef(0xEBA636FE)] - public class GroupCallParticipant : IObject + public sealed partial class GroupCallParticipant : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13911,7 +13911,7 @@ namespace TL /// Contains info about a group call, and partial info about its participants. See [TLDef(0x9E727AAD)] - public class Phone_GroupCall : IObject, IPeerResolver + public sealed partial class Phone_GroupCall : IObject, IPeerResolver { /// Info about the group call public GroupCallBase call; @@ -13929,7 +13929,7 @@ namespace TL /// Info about the participants of a group call or livestream See [TLDef(0xF47751B6)] - public class Phone_GroupParticipants : IObject, IPeerResolver + public sealed partial class Phone_GroupParticipants : IObject, IPeerResolver { /// Number of participants public int count; @@ -13966,7 +13966,7 @@ namespace TL /// ID of a specific chat import session, click here for more info ». See [TLDef(0x1662AF0B)] - public class Messages_HistoryImport : IObject + public sealed partial class Messages_HistoryImport : IObject { /// History import ID public long id; @@ -13974,7 +13974,7 @@ namespace TL /// Contains information about a chat export file generated by a foreign chat app, click here for more info.
If neither the pm or group flags are set, the specified chat export was generated from a chat of unknown type. See
[TLDef(0x5E0FB7B9)] - public class Messages_HistoryImportParsed : IObject + public sealed partial class Messages_HistoryImportParsed : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -13994,7 +13994,7 @@ namespace TL /// Messages found and affected by changes See [TLDef(0xEF8D3E6C, inheritBefore = true)] - public class Messages_AffectedFoundMessages : Messages_AffectedHistory + public sealed partial class Messages_AffectedFoundMessages : Messages_AffectedHistory { /// Affected message IDs public int[] messages; @@ -14002,7 +14002,7 @@ namespace TL /// When and which user joined the chat using a chat invite See [TLDef(0x8C5ADFD9)] - public class ChatInviteImporter : IObject + public sealed partial class ChatInviteImporter : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14030,7 +14030,7 @@ namespace TL /// Info about chat invites exported by a certain admin. See [TLDef(0xBDC62DCC)] - public class Messages_ExportedChatInvites : IObject + public sealed partial class Messages_ExportedChatInvites : IObject { /// Number of invites exported by the admin public int count; @@ -14041,7 +14041,7 @@ namespace TL } /// Contains info about a chat invite, and eventually a pointer to the newest chat invite. See Derived classes: , - public abstract class Messages_ExportedChatInviteBase : IObject + public abstract partial class Messages_ExportedChatInviteBase : IObject { /// Info about the chat invite public virtual ExportedChatInvite Invite => default; @@ -14050,7 +14050,7 @@ namespace TL } /// Info about a chat invite See [TLDef(0x1871BE50)] - public class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase + public sealed partial class Messages_ExportedChatInvite : Messages_ExportedChatInviteBase { /// Info about the chat invite public ExportedChatInvite invite; @@ -14064,7 +14064,7 @@ namespace TL } /// The specified chat invite was replaced with another one See [TLDef(0x222600EF)] - public class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase + public sealed partial class Messages_ExportedChatInviteReplaced : Messages_ExportedChatInviteBase { /// The replaced chat invite public ExportedChatInvite invite; @@ -14081,7 +14081,7 @@ namespace TL /// Info about the users that joined the chat using a specific chat invite See [TLDef(0x81B6B00A)] - public class Messages_ChatInviteImporters : IObject + public sealed partial class Messages_ChatInviteImporters : IObject { /// Number of users that joined public int count; @@ -14093,7 +14093,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xF2ECEF23)] - public class ChatAdminWithInvites : IObject + public sealed partial class ChatAdminWithInvites : IObject { /// The admin public long admin_id; @@ -14105,7 +14105,7 @@ namespace TL /// Info about chat invites generated by admins. See [TLDef(0xB69B72D7)] - public class Messages_ChatAdminsWithInvites : IObject + public sealed partial class Messages_ChatAdminsWithInvites : IObject { /// Info about chat invites generated by admins. public ChatAdminWithInvites[] admins; @@ -14115,7 +14115,7 @@ namespace TL /// Contains a confirmation text to be shown to the user, upon importing chat history, click here for more info ». See [TLDef(0xA24DE717)] - public class Messages_CheckedHistoryImportPeer : IObject + public sealed partial class Messages_CheckedHistoryImportPeer : IObject { /// A confirmation text to be shown to the user, upon importing chat history ». public string confirm_text; @@ -14123,7 +14123,7 @@ namespace TL /// A list of peers that can be used to join a group call, presenting yourself as a specific user/channel. See [TLDef(0xAFE5623F)] - public class Phone_JoinAsPeers : IObject, IPeerResolver + public sealed partial class Phone_JoinAsPeers : IObject, IPeerResolver { /// Peers public Peer[] peers; @@ -14137,7 +14137,7 @@ namespace TL /// An invite to a group call or livestream See [TLDef(0x204BD158)] - public class Phone_ExportedGroupCallInvite : IObject + public sealed partial class Phone_ExportedGroupCallInvite : IObject { /// Invite link public string link; @@ -14145,7 +14145,7 @@ namespace TL /// Describes a group of video synchronization source identifiers See [TLDef(0xDCB118B7)] - public class GroupCallParticipantVideoSourceGroup : IObject + public sealed partial class GroupCallParticipantVideoSourceGroup : IObject { /// SDP semantics public string semantics; @@ -14155,7 +14155,7 @@ namespace TL /// Info about a video stream See [TLDef(0x67753AC8)] - public class GroupCallParticipantVideo : IObject + public sealed partial class GroupCallParticipantVideo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14177,7 +14177,7 @@ namespace TL /// A suggested short name for a stickerpack See [TLDef(0x85FEA03F)] - public class Stickers_SuggestedShortName : IObject + public sealed partial class Stickers_SuggestedShortName : IObject { /// Suggested short name public string short_name; @@ -14185,57 +14185,57 @@ namespace TL /// Represents a scope where the bot commands, specified using Bots_SetBotCommands will be valid. See Derived classes: , , , , , /// a value means botCommandScopeDefault - public abstract class BotCommandScope : IObject { } + public abstract partial class BotCommandScope : IObject { } /// The specified bot commands will only be valid in all private chats with users. See [TLDef(0x3C4F04D8)] - public class BotCommandScopeUsers : BotCommandScope { } + public sealed partial class BotCommandScopeUsers : BotCommandScope { } /// The specified bot commands will be valid in all groups and supergroups. See [TLDef(0x6FE1A881)] - public class BotCommandScopeChats : BotCommandScope { } + public sealed partial class BotCommandScopeChats : BotCommandScope { } /// The specified bot commands will be valid only for chat administrators, in all groups and supergroups. See [TLDef(0xB9AA606A)] - public class BotCommandScopeChatAdmins : BotCommandScope { } + public sealed partial class BotCommandScopeChatAdmins : BotCommandScope { } /// The specified bot commands will be valid only in a specific dialog. See [TLDef(0xDB9D897D)] - public class BotCommandScopePeer : BotCommandScope + public partial class BotCommandScopePeer : BotCommandScope { /// The dialog public InputPeer peer; } /// The specified bot commands will be valid for all admins of the specified group or supergroup. See [TLDef(0x3FD863D1)] - public class BotCommandScopePeerAdmins : BotCommandScopePeer { } + public sealed partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } /// The specified bot commands will be valid only for a specific user in the specified group or supergroup. See [TLDef(0x0A1321F3, inheritBefore = true)] - public class BotCommandScopePeerUser : BotCommandScopePeer + public sealed partial class BotCommandScopePeerUser : BotCommandScopePeer { /// The user public InputUserBase user_id; } /// Result of an Account_ResetPassword request. See Derived classes: , , - public abstract class Account_ResetPasswordResult : IObject { } + public abstract partial class Account_ResetPasswordResult : IObject { } /// You recently requested a password reset that was canceled, please wait until the specified date before requesting another reset. See [TLDef(0xE3779861)] - public class Account_ResetPasswordFailedWait : Account_ResetPasswordResult + public sealed partial class Account_ResetPasswordFailedWait : Account_ResetPasswordResult { /// Wait until this date before requesting another reset. public DateTime retry_date; } /// You successfully requested a password reset, please wait until the specified date before finalizing the reset. See [TLDef(0xE9EFFC7D)] - public class Account_ResetPasswordRequestedWait : Account_ResetPasswordResult + public sealed partial class Account_ResetPasswordRequestedWait : Account_ResetPasswordResult { /// Wait until this date before finalizing the reset. public DateTime until_date; } /// The 2FA password was reset successfully. See [TLDef(0xE926D63E)] - public class Account_ResetPasswordOk : Account_ResetPasswordResult { } + public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See [TLDef(0xED5383F7)] - public class SponsoredMessage : IObject + public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14298,7 +14298,7 @@ namespace TL /// A set of sponsored messages associated to a channel See /// a value means messages.sponsoredMessagesEmpty [TLDef(0xC9EE1D87)] - public class Messages_SponsoredMessages : IObject, IPeerResolver + public sealed partial class Messages_SponsoredMessages : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14322,7 +14322,7 @@ namespace TL /// Information about found messages sent on a specific day, used to split the messages in s by days. See [TLDef(0xC9B0539F)] - public class SearchResultsCalendarPeriod : IObject + public sealed partial class SearchResultsCalendarPeriod : IObject { /// The day this object is referring to. public DateTime date; @@ -14336,7 +14336,7 @@ namespace TL /// Information about found messages sent on a specific day See [TLDef(0x147EE23C)] - public class Messages_SearchResultsCalendar : IObject, IPeerResolver + public sealed partial class Messages_SearchResultsCalendar : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14369,10 +14369,10 @@ namespace TL } /// Information about a message in a specific position See Derived classes: - public abstract class SearchResultsPosition : IObject { } + public abstract partial class SearchResultsPosition : IObject { } /// Information about a message in a specific position See [TLDef(0x7F648B67)] - public class SearchResultPosition : SearchResultsPosition + public sealed partial class SearchResultPosition : SearchResultsPosition { /// Message ID public int msg_id; @@ -14384,7 +14384,7 @@ namespace TL /// Information about sparse positions of messages See [TLDef(0x53B22BAF)] - public class Messages_SearchResultsPositions : IObject + public sealed partial class Messages_SearchResultsPositions : IObject { /// Total number of found messages public int count; @@ -14394,7 +14394,7 @@ namespace TL /// A list of peers that can be used to send messages in a specific group See [TLDef(0xF496B0C6)] - public class Channels_SendAsPeers : IObject, IPeerResolver + public sealed partial class Channels_SendAsPeers : IObject, IPeerResolver { /// Peers that can be used to send messages to the group public SendAsPeer[] peers; @@ -14408,7 +14408,7 @@ namespace TL /// Full user information See [TLDef(0x3B6D152E)] - public class Users_UserFull : IObject, IPeerResolver + public sealed partial class Users_UserFull : IObject, IPeerResolver { /// Full user information public UserFull full_user; @@ -14422,7 +14422,7 @@ namespace TL /// Peer settings See [TLDef(0x6880B94D)] - public class Messages_PeerSettings : IObject, IPeerResolver + public sealed partial class Messages_PeerSettings : IObject, IPeerResolver { /// Peer settings public PeerSettings settings; @@ -14436,7 +14436,7 @@ namespace TL /// Future auth token » to be used on subsequent authorizations See [TLDef(0xC3A2835F)] - public class Auth_LoggedOut : IObject + public sealed partial class Auth_LoggedOut : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14452,7 +14452,7 @@ namespace TL /// Reactions See [TLDef(0xA3D1CB80)] - public class ReactionCount : IObject + public sealed partial class ReactionCount : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14472,7 +14472,7 @@ namespace TL /// Message reactions » See [TLDef(0x4F2B9479)] - public class MessageReactions : IObject + public sealed partial class MessageReactions : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14495,7 +14495,7 @@ namespace TL /// List of peers that reacted to a specific message See [TLDef(0x31BD492D)] - public class Messages_MessageReactionsList : IObject, IPeerResolver + public sealed partial class Messages_MessageReactionsList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14521,7 +14521,7 @@ namespace TL /// Animations associated with a message reaction See [TLDef(0xC077EC01)] - public class AvailableReaction : IObject + public sealed partial class AvailableReaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14558,7 +14558,7 @@ namespace TL /// Animations and metadata associated with message reactions » See /// a value means messages.availableReactionsNotModified [TLDef(0x768E3AAD)] - public class Messages_AvailableReactions : IObject + public sealed partial class Messages_AvailableReactions : IObject { /// Hash for pagination, for more info click here public int hash; @@ -14568,7 +14568,7 @@ namespace TL /// How a certain peer reacted to the message See [TLDef(0x8C79B63C)] - public class MessagePeerReaction : IObject + public sealed partial class MessagePeerReaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14592,7 +14592,7 @@ namespace TL /// Info about an RTMP stream in a group call or livestream See [TLDef(0x80EB48AF)] - public class GroupCallStreamChannel : IObject + public sealed partial class GroupCallStreamChannel : IObject { /// Channel ID public int channel; @@ -14604,7 +14604,7 @@ namespace TL /// Info about RTMP streams in a group call or livestream See [TLDef(0xD0E482B2)] - public class Phone_GroupCallStreamChannels : IObject + public sealed partial class Phone_GroupCallStreamChannels : IObject { /// RTMP streams public GroupCallStreamChannel[] channels; @@ -14612,7 +14612,7 @@ namespace TL /// RTMP URL and stream key to be used in streaming software See [TLDef(0x2DBF3432)] - public class Phone_GroupCallStreamRtmpUrl : IObject + public sealed partial class Phone_GroupCallStreamRtmpUrl : IObject { /// RTMP URL public string url; @@ -14622,7 +14622,7 @@ namespace TL /// Represents an attachment menu icon color for bot mini apps » See [TLDef(0x4576F3F0)] - public class AttachMenuBotIconColor : IObject + public sealed partial class AttachMenuBotIconColor : IObject { /// One of the following values:
light_icon - Color of the attachment menu icon (light mode)
light_text - Color of the attachment menu label, once selected (light mode)
dark_icon - Color of the attachment menu icon (dark mode)
dark_text - Color of the attachment menu label, once selected (dark mode)
public string name; @@ -14632,7 +14632,7 @@ namespace TL ///
Represents an attachment menu icon for bot mini apps » See [TLDef(0xB2A7386B)] - public class AttachMenuBotIcon : IObject + public sealed partial class AttachMenuBotIcon : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14652,7 +14652,7 @@ namespace TL /// Represents a bot mini app that can be launched from the attachment/side menu » See [TLDef(0xD90D8DFE)] - public class AttachMenuBot : IObject + public sealed partial class AttachMenuBot : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14685,7 +14685,7 @@ namespace TL /// Represents a list of bot mini apps that can be launched from the attachment menu » See /// a value means attachMenuBotsNotModified [TLDef(0x3C4301C0)] - public class AttachMenuBots : IObject + public sealed partial class AttachMenuBots : IObject { /// Hash for pagination, for more info click here public long hash; @@ -14697,7 +14697,7 @@ namespace TL /// Represents a bot mini app that can be launched from the attachment menu » See [TLDef(0x93BF667F)] - public class AttachMenuBotsBot : IObject + public sealed partial class AttachMenuBotsBot : IObject { /// Represents a bot mini app that can be launched from the attachment menu »
public AttachMenuBot bot; @@ -14706,10 +14706,10 @@ namespace TL } /// Contains the webview URL with appropriate theme and user info parameters added See Derived classes: - public abstract class WebViewResult : IObject { } + public abstract partial class WebViewResult : IObject { } /// Contains the webview URL with appropriate theme and user info parameters added See [TLDef(0x0C14557C)] - public class WebViewResultUrl : WebViewResult + public sealed partial class WebViewResultUrl : WebViewResult { /// Webview session ID public long query_id; @@ -14718,10 +14718,10 @@ namespace TL } /// Contains the webview URL with appropriate theme parameters added See Derived classes: - public abstract class SimpleWebViewResult : IObject { } + public abstract partial class SimpleWebViewResult : IObject { } /// Contains the webview URL with appropriate theme parameters added See [TLDef(0x882F76BB)] - public class SimpleWebViewResultUrl : SimpleWebViewResult + public sealed partial class SimpleWebViewResultUrl : SimpleWebViewResult { /// URL public string url; @@ -14729,7 +14729,7 @@ namespace TL /// Info about a sent inline webview message See [TLDef(0x0C94511C)] - public class WebViewMessageSent : IObject + public sealed partial class WebViewMessageSent : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14745,13 +14745,13 @@ namespace TL /// Indicates the action to execute when pressing the in-UI menu button for bots See Derived classes: , /// a value means botMenuButtonDefault - public abstract class BotMenuButtonBase : IObject { } + public abstract partial class BotMenuButtonBase : IObject { } /// Bot menu button that opens the bot command list when clicked. See [TLDef(0x4258C205)] - public class BotMenuButtonCommands : BotMenuButtonBase { } + public sealed partial class BotMenuButtonCommands : BotMenuButtonBase { } /// Bot menu button that opens a web app when clicked. See [TLDef(0xC7B57CE6)] - public class BotMenuButton : BotMenuButtonBase + public sealed partial class BotMenuButton : BotMenuButtonBase { /// Title to be displayed on the menu button instead of 'Menu' public string text; @@ -14762,7 +14762,7 @@ namespace TL /// A list of saved notification sounds See /// a value means account.savedRingtonesNotModified [TLDef(0xC1E92CC5)] - public class Account_SavedRingtones : IObject + public sealed partial class Account_SavedRingtones : IObject { /// Hash for pagination, for more info click here public long hash; @@ -14772,13 +14772,13 @@ namespace TL /// Represents a notification sound See Derived classes: , , /// a value means notificationSoundDefault - public abstract class NotificationSound : IObject { } + public abstract partial class NotificationSound : IObject { } /// No notification sound should be used See [TLDef(0x6F0C34DF)] - public class NotificationSoundNone : NotificationSound { } + public sealed partial class NotificationSoundNone : NotificationSound { } /// Indicates a specific local notification sound should be used See [TLDef(0x830B9AE4)] - public class NotificationSoundLocal : NotificationSound + public sealed partial class NotificationSoundLocal : NotificationSound { /// Notification sound title public string title; @@ -14787,7 +14787,7 @@ namespace TL } /// A specific previously uploaded notification sound should be used See [TLDef(0xFF6C8049)] - public class NotificationSoundRingtone : NotificationSound + public sealed partial class NotificationSoundRingtone : NotificationSound { /// Document ID of notification sound uploaded using Account_UploadRingtone public long id; @@ -14795,10 +14795,10 @@ namespace TL /// The notification sound was already in MP3 format and was saved without any modification See [TLDef(0xB7263F6D)] - public class Account_SavedRingtone : IObject { } + public partial class Account_SavedRingtone : IObject { } /// The notification sound was not in MP3 format and was successfully converted and saved, use the returned to refer to the notification sound from now on See [TLDef(0x1F307EB7)] - public class Account_SavedRingtoneConverted : Account_SavedRingtone + public sealed partial class Account_SavedRingtoneConverted : Account_SavedRingtone { /// The converted notification sound public DocumentBase document; @@ -14820,10 +14820,10 @@ namespace TL } /// An invoice See Derived classes: , , - public abstract class InputInvoice : IObject { } + public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message. See [TLDef(0xC5B56859)] - public class InputInvoiceMessage : InputInvoice + public sealed partial class InputInvoiceMessage : InputInvoice { /// Chat where the invoice was sent public InputPeer peer; @@ -14832,14 +14832,14 @@ namespace TL } /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » See [TLDef(0xC326CAEF)] - public class InputInvoiceSlug : InputInvoice + public sealed partial class InputInvoiceSlug : InputInvoice { /// The invoice slug public string slug; } /// Used if the user wishes to start a channel giveaway or send some giftcodes to members of a channel, in exchange for boosts. See [TLDef(0x98986C0D)] - public class InputInvoicePremiumGiftCode : InputInvoice + public sealed partial class InputInvoicePremiumGiftCode : InputInvoice { /// Should be populated with for giveaways and for gifts. public InputStorePaymentPurpose purpose; @@ -14849,7 +14849,7 @@ namespace TL /// Exported invoice deep link See [TLDef(0xAED0CBD9)] - public class Payments_ExportedInvoice : IObject + public sealed partial class Payments_ExportedInvoice : IObject { /// Exported invoice deep link public string url; @@ -14857,7 +14857,7 @@ namespace TL /// Transcribed text from a voice message » See [TLDef(0xCFB9D957)] - public class Messages_TranscribedAudio : IObject + public sealed partial class Messages_TranscribedAudio : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14881,7 +14881,7 @@ namespace TL /// Telegram Premium promotion information See [TLDef(0x5334759C)] - public class Help_PremiumPromo : IObject + public sealed partial class Help_PremiumPromo : IObject { /// Description of the current state of the user's Telegram Premium subscription public string status_text; @@ -14898,10 +14898,10 @@ namespace TL } /// Info about a Telegram Premium purchase See Derived classes: , , , - public abstract class InputStorePaymentPurpose : IObject { } + public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] - public class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose + public sealed partial class InputStorePaymentPremiumSubscription : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14916,7 +14916,7 @@ namespace TL } /// Info about a gifted Telegram Premium purchase See [TLDef(0x616F7FE8)] - public class InputStorePaymentGiftPremium : InputStorePaymentPurpose + public sealed partial class InputStorePaymentGiftPremium : InputStorePaymentPurpose { /// The user to which the Telegram Premium subscription was gifted public InputUserBase user_id; @@ -14927,7 +14927,7 @@ namespace TL } /// Used to gift Telegram Premium subscriptions only to some specific subscribers of a channel or to some of our contacts, see here » for more info on giveaways and gifts. See [TLDef(0xA3805F3F)] - public class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose + public sealed partial class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14948,7 +14948,7 @@ namespace TL } /// Used to pay for a giveaway, see here » for more info. See [TLDef(0x160544CA)] - public class InputStorePaymentPremiumGiveaway : InputStorePaymentPurpose + public sealed partial class InputStorePaymentPremiumGiveaway : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -14986,7 +14986,7 @@ namespace TL /// Telegram Premium gift option See [TLDef(0x74C34319)] - public class PremiumGiftOption : IObject + public sealed partial class PremiumGiftOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15010,7 +15010,7 @@ namespace TL /// Represents an additional payment method See [TLDef(0x88F8F21B)] - public class PaymentFormMethod : IObject + public sealed partial class PaymentFormMethod : IObject { /// URL to open in a webview to process the payment public string url; @@ -15021,14 +15021,14 @@ namespace TL /// An emoji status See /// a value means emojiStatusEmpty [TLDef(0x929B619D)] - public class EmojiStatus : IObject + public partial class EmojiStatus : IObject { /// Custom emoji document ID public long document_id; } /// An emoji status valid until the specified date See [TLDef(0xFA30A8C7, inheritBefore = true)] - public class EmojiStatusUntil : EmojiStatus + public sealed partial class EmojiStatusUntil : EmojiStatus { /// This status is valid until this date public int until; @@ -15037,7 +15037,7 @@ namespace TL /// A list of emoji statuses See /// a value means account.emojiStatusesNotModified [TLDef(0x90C467D1)] - public class Account_EmojiStatuses : IObject + public sealed partial class Account_EmojiStatuses : IObject { /// Hash for pagination, for more info click here public long hash; @@ -15047,17 +15047,17 @@ namespace TL /// Message reaction See Derived classes: , /// a value means reactionEmpty - public abstract class Reaction : IObject { } + public abstract partial class Reaction : IObject { } /// Normal emoji message reaction See [TLDef(0x1B2286B8)] - public class ReactionEmoji : Reaction + public sealed partial class ReactionEmoji : Reaction { /// Emoji public string emoticon; } /// Custom emoji message reaction See [TLDef(0x8935FC73)] - public class ReactionCustomEmoji : Reaction + public sealed partial class ReactionCustomEmoji : Reaction { /// Custom emoji document ID public long document_id; @@ -15065,10 +15065,10 @@ namespace TL /// Available chat reactions See Derived classes: , /// a value means chatReactionsNone - public abstract class ChatReactions : IObject { } + public abstract partial class ChatReactions : IObject { } /// All reactions or all non-custom reactions are allowed See [TLDef(0x52928BCA)] - public class ChatReactionsAll : ChatReactions + public sealed partial class ChatReactionsAll : ChatReactions { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15081,7 +15081,7 @@ namespace TL } /// Some reactions are allowed See [TLDef(0x661D4037)] - public class ChatReactionsSome : ChatReactions + public sealed partial class ChatReactionsSome : ChatReactions { /// Allowed set of reactions: the reactions_in_chat_max configuration field indicates the maximum number of reactions that can be specified in this field. public Reaction[] reactions; @@ -15090,7 +15090,7 @@ namespace TL /// List of message reactions See /// a value means messages.reactionsNotModified [TLDef(0xEAFDF716)] - public class Messages_Reactions : IObject + public sealed partial class Messages_Reactions : IObject { /// Hash for pagination, for more info click here public long hash; @@ -15099,10 +15099,10 @@ namespace TL } /// Email verification purpose See Derived classes: , , - public abstract class EmailVerifyPurpose : IObject { } + public abstract partial class EmailVerifyPurpose : IObject { } /// Email verification purpose: setup login email See [TLDef(0x4345BE73)] - public class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose + public sealed partial class EmailVerifyPurposeLoginSetup : EmailVerifyPurpose { /// Phone number public string phone_number; @@ -15111,30 +15111,30 @@ namespace TL } /// Email verification purpose: change login email See [TLDef(0x527D22EB)] - public class EmailVerifyPurposeLoginChange : EmailVerifyPurpose { } + public sealed partial class EmailVerifyPurposeLoginChange : EmailVerifyPurpose { } /// Verify an email for use in telegram passport See [TLDef(0xBBF51685)] - public class EmailVerifyPurposePassport : EmailVerifyPurpose { } + public sealed partial class EmailVerifyPurposePassport : EmailVerifyPurpose { } /// Email verification code or token See Derived classes: , , - public abstract class EmailVerification : IObject { } + public abstract partial class EmailVerification : IObject { } /// Email verification code See [TLDef(0x922E55A9)] - public class EmailVerificationCode : EmailVerification + public sealed partial class EmailVerificationCode : EmailVerification { /// Received verification code public string code; } /// Google ID email verification token See [TLDef(0xDB909EC2)] - public class EmailVerificationGoogle : EmailVerification + public sealed partial class EmailVerificationGoogle : EmailVerification { /// Token public string token; } /// Apple ID email verification token See [TLDef(0x96D074FD)] - public class EmailVerificationApple : EmailVerification + public sealed partial class EmailVerificationApple : EmailVerification { /// Token public string token; @@ -15142,14 +15142,14 @@ namespace TL /// The email was verified correctly. See [TLDef(0x2B96CD1B)] - public class Account_EmailVerified : IObject + public partial class Account_EmailVerified : IObject { /// The verified email address. public string email; } /// The email was verified correctly, and a login code was just sent to it. See [TLDef(0xE1BB0D61, inheritBefore = true)] - public class Account_EmailVerifiedLogin : Account_EmailVerified + public sealed partial class Account_EmailVerifiedLogin : Account_EmailVerified { /// Info about the sent login code public Auth_SentCodeBase sent_code; @@ -15157,7 +15157,7 @@ namespace TL /// Describes a Telegram Premium subscription option See [TLDef(0x5F2D1DF2)] - public class PremiumSubscriptionOption : IObject + public sealed partial class PremiumSubscriptionOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15189,7 +15189,7 @@ namespace TL /// Indicates a peer that can be used to send messages See [TLDef(0xB81C7034)] - public class SendAsPeer : IObject + public sealed partial class SendAsPeer : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15204,10 +15204,10 @@ namespace TL } /// Extended media See Derived classes: , - public abstract class MessageExtendedMediaBase : IObject { } + public abstract partial class MessageExtendedMediaBase : IObject { } /// Extended media preview See [TLDef(0xAD628CC8)] - public class MessageExtendedMediaPreview : MessageExtendedMediaBase + public sealed partial class MessageExtendedMediaPreview : MessageExtendedMediaBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15232,7 +15232,7 @@ namespace TL } /// Extended media See [TLDef(0xEE479C64)] - public class MessageExtendedMedia : MessageExtendedMediaBase + public sealed partial class MessageExtendedMedia : MessageExtendedMediaBase { /// Media public MessageMedia media; @@ -15240,7 +15240,7 @@ namespace TL /// Keywords for a certain sticker See [TLDef(0xFCFEB29C)] - public class StickerKeyword : IObject + public sealed partial class StickerKeyword : IObject { /// Sticker ID public long document_id; @@ -15250,7 +15250,7 @@ namespace TL /// Contains information about a username. See [TLDef(0xB4073647)] - public class Username : IObject + public sealed partial class Username : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15267,14 +15267,14 @@ namespace TL } /// Contains information about a forum topic See Derived classes: , - public abstract class ForumTopicBase : IObject + public abstract partial class ForumTopicBase : IObject { /// The ID of the deleted forum topic. public virtual int ID => default; } /// Represents a deleted forum topic. See [TLDef(0x023F109B)] - public class ForumTopicDeleted : ForumTopicBase + public sealed partial class ForumTopicDeleted : ForumTopicBase { /// The ID of the deleted forum topic. public int id; @@ -15284,7 +15284,7 @@ namespace TL } /// Represents a forum topic. See [TLDef(0x71701DA9)] - public class ForumTopic : ForumTopicBase + public sealed partial class ForumTopic : ForumTopicBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15341,7 +15341,7 @@ namespace TL /// Contains information about multiple forum topics See [TLDef(0x367617D3)] - public class Messages_ForumTopics : IObject, IPeerResolver + public sealed partial class Messages_ForumTopics : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15369,7 +15369,7 @@ namespace TL /// Contains info about the default value of the Time-To-Live setting, applied to all new chats. See [TLDef(0x43B46B20)] - public class DefaultHistoryTTL : IObject + public sealed partial class DefaultHistoryTTL : IObject { /// Time-To-Live setting applied to all new chats. public int period; @@ -15377,7 +15377,7 @@ namespace TL /// Describes a temporary profile link. See [TLDef(0x41BF109B)] - public class ExportedContactToken : IObject + public sealed partial class ExportedContactToken : IObject { /// The temporary profile link. public string url; @@ -15386,10 +15386,10 @@ namespace TL } /// Filtering criteria to use for the peer selection list shown to the user. See Derived classes: , , - public abstract class RequestPeerType : IObject { } + public abstract partial class RequestPeerType : IObject { } /// Choose a user. See [TLDef(0x5F3B8A00)] - public class RequestPeerTypeUser : RequestPeerType + public sealed partial class RequestPeerTypeUser : RequestPeerType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15408,7 +15408,7 @@ namespace TL } /// Choose a chat or supergroup See [TLDef(0xC9F06E1B)] - public class RequestPeerTypeChat : RequestPeerType + public sealed partial class RequestPeerTypeChat : RequestPeerType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15439,7 +15439,7 @@ namespace TL } /// Choose a channel See [TLDef(0x339BEF6C)] - public class RequestPeerTypeBroadcast : RequestPeerType + public sealed partial class RequestPeerTypeBroadcast : RequestPeerType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15466,7 +15466,7 @@ namespace TL /// Represents a list of custom emojis. See /// a value means emojiListNotModified [TLDef(0x7A1E11D1)] - public class EmojiList : IObject + public sealed partial class EmojiList : IObject { /// Hash for pagination, for more info click here public long hash; @@ -15476,7 +15476,7 @@ namespace TL /// Represents an emoji category. See [TLDef(0x7A9ABDA9)] - public class EmojiGroup : IObject + public sealed partial class EmojiGroup : IObject { /// Category name, i.e. "Animals", "Flags", "Faces" and so on... public string title; @@ -15489,7 +15489,7 @@ namespace TL /// Represents a list of emoji categories. See /// a value means messages.emojiGroupsNotModified [TLDef(0x881FB94B)] - public class Messages_EmojiGroups : IObject + public sealed partial class Messages_EmojiGroups : IObject { /// Hash for pagination, for more info click here public int hash; @@ -15499,7 +15499,7 @@ namespace TL /// Styled text with message entities See [TLDef(0x751F3146)] - public class TextWithEntities : IObject + public sealed partial class TextWithEntities : IObject { /// Text public string text; @@ -15508,10 +15508,10 @@ namespace TL } /// Translated text with entities. See Derived classes: - public abstract class Messages_TranslatedText : IObject { } + public abstract partial class Messages_TranslatedText : IObject { } /// Translated text with entities See [TLDef(0x33DB32F8)] - public class Messages_TranslateResult : Messages_TranslatedText + public sealed partial class Messages_TranslateResult : Messages_TranslatedText { /// Text+entities, for each input message. public TextWithEntities[] result; @@ -15519,7 +15519,7 @@ namespace TL /// Media autosave settings See [TLDef(0xC84834CE)] - public class AutoSaveSettings : IObject + public sealed partial class AutoSaveSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15539,7 +15539,7 @@ namespace TL /// Peer-specific media autosave settings See [TLDef(0x81602D47)] - public class AutoSaveException : IObject + public sealed partial class AutoSaveException : IObject { /// The peer public Peer peer; @@ -15549,7 +15549,7 @@ namespace TL /// Contains media autosave settings See [TLDef(0x4C3E069D)] - public class Account_AutoSaveSettings : IObject, IPeerResolver + public sealed partial class Account_AutoSaveSettings : IObject, IPeerResolver { /// Default media autosave settings for private chats public AutoSaveSettings users_settings; @@ -15570,7 +15570,7 @@ namespace TL /// Contains various client configuration parameters See /// a value means help.appConfigNotModified [TLDef(0xDD18782E)] - public class Help_AppConfig : IObject + public sealed partial class Help_AppConfig : IObject { /// Hash for pagination, for more info click here public int hash; @@ -15579,10 +15579,10 @@ namespace TL } /// Used to fetch information about a direct link Mini App See Derived classes: , - public abstract class InputBotApp : IObject { } + public abstract partial class InputBotApp : IObject { } /// Used to fetch information about a direct link Mini App by its ID See [TLDef(0xA920BD7A)] - public class InputBotAppID : InputBotApp + public sealed partial class InputBotAppID : InputBotApp { /// direct link Mini App ID. public long id; @@ -15591,7 +15591,7 @@ namespace TL } /// Used to fetch information about a direct link Mini App by its short name See [TLDef(0x908C0407)] - public class InputBotAppShortName : InputBotApp + public sealed partial class InputBotAppShortName : InputBotApp { /// ID of the bot that owns the bot mini app public InputUserBase bot_id; @@ -15602,7 +15602,7 @@ namespace TL /// Contains information about a direct link Mini App. See /// a value means botAppNotModified [TLDef(0x95FCD1D6)] - public class BotApp : IObject + public sealed partial class BotApp : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15632,7 +15632,7 @@ namespace TL /// Contains information about a direct link Mini App See [TLDef(0xEB50ADF5)] - public class Messages_BotApp : IObject + public sealed partial class Messages_BotApp : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15651,10 +15651,10 @@ namespace TL } /// Contains the link that must be used to open a direct link Mini App. See Derived classes: - public abstract class AppWebViewResult : IObject { } + public abstract partial class AppWebViewResult : IObject { } /// Contains the link that must be used to open a direct link Mini App. See [TLDef(0x3C1B4F0D)] - public class AppWebViewResultUrl : AppWebViewResult + public sealed partial class AppWebViewResultUrl : AppWebViewResult { /// The URL to open public string url; @@ -15662,7 +15662,7 @@ namespace TL /// Specifies an inline mode mini app button, shown on top of the inline query results list. See [TLDef(0xB57295D5)] - public class InlineBotWebView : IObject + public sealed partial class InlineBotWebView : IObject { /// Text of the button public string text; @@ -15672,7 +15672,7 @@ namespace TL /// Contains info about when a certain participant has read a message See [TLDef(0x4A4FF172)] - public class ReadParticipantDate : IObject + public sealed partial class ReadParticipantDate : IObject { /// User ID public long user_id; @@ -15681,10 +15681,10 @@ namespace TL } /// Represents a folder See Derived classes: - public abstract class InputChatlist : IObject { } + public abstract partial class InputChatlist : IObject { } /// Folder ID See [TLDef(0xF3E0DA33)] - public class InputChatlistDialogFilter : InputChatlist + public sealed partial class InputChatlistDialogFilter : InputChatlist { /// Folder ID public int filter_id; @@ -15692,7 +15692,7 @@ namespace TL /// Exported chat folder deep link ». See [TLDef(0x0C5181AC)] - public class ExportedChatlistInvite : IObject + public sealed partial class ExportedChatlistInvite : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15710,7 +15710,7 @@ namespace TL /// Info about an exported chat folder deep link ». See [TLDef(0x10E6E3A6)] - public class Chatlists_ExportedChatlistInvite : IObject + public sealed partial class Chatlists_ExportedChatlistInvite : IObject { /// Folder ID public DialogFilterBase filter; @@ -15720,7 +15720,7 @@ namespace TL /// Info about multiple chat folder deep links ». See [TLDef(0x10AB6DC7)] - public class Chatlists_ExportedInvites : IObject, IPeerResolver + public sealed partial class Chatlists_ExportedInvites : IObject, IPeerResolver { /// The chat folder deep links ». public ExportedChatlistInvite[] invites; @@ -15733,7 +15733,7 @@ namespace TL } /// Info about a chat folder deep link ». See Derived classes: , - public abstract class Chatlists_ChatlistInviteBase : IObject + public abstract partial class Chatlists_ChatlistInviteBase : IObject { /// Related chat information public virtual Dictionary Chats => default; @@ -15742,7 +15742,7 @@ namespace TL } /// Updated info about a chat folder deep link » we already imported. See [TLDef(0xFA87F659)] - public class Chatlists_ChatlistInviteAlready : Chatlists_ChatlistInviteBase, IPeerResolver + public sealed partial class Chatlists_ChatlistInviteAlready : Chatlists_ChatlistInviteBase, IPeerResolver { /// ID of the imported folder public int filter_id; @@ -15764,7 +15764,7 @@ namespace TL } /// Info about a chat folder deep link ». See [TLDef(0x1DCD839D)] - public class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver + public sealed partial class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15795,7 +15795,7 @@ namespace TL /// Updated information about a chat folder deep link ». See [TLDef(0x93BD878D)] - public class Chatlists_ChatlistUpdates : IObject, IPeerResolver + public sealed partial class Chatlists_ChatlistUpdates : IObject, IPeerResolver { /// New peers to join public Peer[] missing_peers; @@ -15809,7 +15809,7 @@ namespace TL /// Localized information about a bot. See [TLDef(0xE8A775B0)] - public class Bots_BotInfo : IObject + public sealed partial class Bots_BotInfo : IObject { /// Bot name public string name; @@ -15820,7 +15820,7 @@ namespace TL } /// How a user voted in a poll See Derived classes: , , - public abstract class MessagePeerVoteBase : IObject + public abstract partial class MessagePeerVoteBase : IObject { /// Peer ID public virtual Peer Peer => default; @@ -15829,7 +15829,7 @@ namespace TL } /// How a peer voted in a poll See [TLDef(0xB6CC2D5C)] - public class MessagePeerVote : MessagePeerVoteBase + public sealed partial class MessagePeerVote : MessagePeerVoteBase { /// Peer ID public Peer peer; @@ -15845,7 +15845,7 @@ namespace TL } /// How a peer voted in a poll (reduced constructor, returned if an option was provided to Messages_GetPollVotes) See [TLDef(0x74CDA504)] - public class MessagePeerVoteInputOption : MessagePeerVoteBase + public sealed partial class MessagePeerVoteInputOption : MessagePeerVoteBase { /// The peer that voted for the queried option public Peer peer; @@ -15859,7 +15859,7 @@ namespace TL } /// How a peer voted in a multiple-choice poll See [TLDef(0x4628F6E6)] - public class MessagePeerVoteMultiple : MessagePeerVoteBase + public sealed partial class MessagePeerVoteMultiple : MessagePeerVoteBase { /// Peer ID public Peer peer; @@ -15876,7 +15876,7 @@ namespace TL /// Represents a sponsored website. See [TLDef(0x3DB8EC63)] - public class SponsoredWebPage : IObject + public sealed partial class SponsoredWebPage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15896,7 +15896,7 @@ namespace TL /// Aggregated view and reaction information of a story. See [TLDef(0x8D595CD6)] - public class StoryViews : IObject + public sealed partial class StoryViews : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15927,14 +15927,14 @@ namespace TL } /// Represents a Telegram Story See Derived classes: , , - public abstract class StoryItemBase : IObject + public abstract partial class StoryItemBase : IObject { /// Story ID public virtual int ID => default; } /// Represents a previously active story, that was deleted See [TLDef(0x51E6EE4F)] - public class StoryItemDeleted : StoryItemBase + public sealed partial class StoryItemDeleted : StoryItemBase { /// Story ID public int id; @@ -15944,7 +15944,7 @@ namespace TL } /// Represents an active story, whose full information was omitted for space and performance reasons; use Stories_GetStoriesByID to fetch full info about the skipped story when and if needed. See [TLDef(0xFFADC913)] - public class StoryItemSkipped : StoryItemBase + public sealed partial class StoryItemSkipped : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -15966,7 +15966,7 @@ namespace TL } /// Represents a story. See [TLDef(0x79B26A24)] - public class StoryItem : StoryItemBase + public sealed partial class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16037,10 +16037,10 @@ namespace TL } /// Full list of active (or active and hidden) stories. See Derived classes: , - public abstract class Stories_AllStoriesBase : IObject { } + public abstract partial class Stories_AllStoriesBase : IObject { } /// The list of active (or active and hidden) stories has not changed. See [TLDef(0x1158FE3E)] - public class Stories_AllStoriesNotModified : Stories_AllStoriesBase + public sealed partial class Stories_AllStoriesNotModified : Stories_AllStoriesBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16055,7 +16055,7 @@ namespace TL } /// Full list of active (or active and hidden) stories. See [TLDef(0x6EFC5E81)] - public class Stories_AllStories : Stories_AllStoriesBase, IPeerResolver + public sealed partial class Stories_AllStories : Stories_AllStoriesBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16083,7 +16083,7 @@ namespace TL /// List of stories See [TLDef(0x5DD8C3C8)] - public class Stories_Stories : IObject, IPeerResolver + public sealed partial class Stories_Stories : IObject, IPeerResolver { /// Total number of stories that can be fetched public int count; @@ -16098,10 +16098,10 @@ namespace TL } /// Story view date and reaction information See Derived classes: , , - public abstract class StoryViewBase : IObject { } + public abstract partial class StoryViewBase : IObject { } /// Story view date and reaction information See [TLDef(0xB0BDEAC5)] - public class StoryView : StoryViewBase + public sealed partial class StoryView : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16124,7 +16124,7 @@ namespace TL } /// A certain peer has forwarded the story as a message to a public chat or channel. See [TLDef(0x9083670B)] - public class StoryViewPublicForward : StoryViewBase + public sealed partial class StoryViewPublicForward : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16141,7 +16141,7 @@ namespace TL } /// A certain peer has reposted the story. See [TLDef(0xBD74CF49)] - public class StoryViewPublicRepost : StoryViewBase + public sealed partial class StoryViewPublicRepost : StoryViewBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16161,7 +16161,7 @@ namespace TL /// Reaction and view counters for a story See [TLDef(0x59D78FC5)] - public class Stories_StoryViewsList : IObject, IPeerResolver + public sealed partial class Stories_StoryViewsList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16193,7 +16193,7 @@ namespace TL /// Reaction and view counters for a list of stories See [TLDef(0xDE9EED1D)] - public class Stories_StoryViews : IObject + public sealed partial class Stories_StoryViews : IObject { /// View date and reaction information of multiple stories public StoryViews[] views; @@ -16202,10 +16202,10 @@ namespace TL } /// Contains info about a message or story to reply to. See Derived classes: , - public abstract class InputReplyTo : IObject { } + public abstract partial class InputReplyTo : IObject { } /// Reply to a message. See [TLDef(0x22C0F6D5)] - public class InputReplyToMessage : InputReplyTo + public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16238,7 +16238,7 @@ namespace TL } /// Reply to a story. See [TLDef(0x5881323A)] - public class InputReplyToStory : InputReplyTo + public sealed partial class InputReplyToStory : InputReplyTo { public InputPeer peer; /// ID of the story to reply to. @@ -16247,7 +16247,7 @@ namespace TL /// Represents a story deep link. See [TLDef(0x3FC9053B)] - public class ExportedStoryLink : IObject + public sealed partial class ExportedStoryLink : IObject { /// The story deep link. public string link; @@ -16255,7 +16255,7 @@ namespace TL /// Information about the current stealth mode session. See [TLDef(0x712E27FD)] - public class StoriesStealthMode : IObject + public sealed partial class StoriesStealthMode : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16275,7 +16275,7 @@ namespace TL /// Coordinates and size of a clicable rectangular area on top of a story. See [TLDef(0x03D1EA4E)] - public class MediaAreaCoordinates : IObject + public sealed partial class MediaAreaCoordinates : IObject { /// The abscissa of the rectangle's center, as a percentage of the media width (0-100). public double x; @@ -16290,10 +16290,10 @@ namespace TL } /// Represents a story media area » See Derived classes: , , , , , - public abstract class MediaArea : IObject { } + public abstract partial class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] - public class MediaAreaVenue : MediaArea + public sealed partial class MediaAreaVenue : MediaArea { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; @@ -16312,7 +16312,7 @@ namespace TL } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xB282217F)] - public class InputMediaAreaVenue : MediaArea + public sealed partial class InputMediaAreaVenue : MediaArea { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; @@ -16323,7 +16323,7 @@ namespace TL } /// Represents a geolocation tag attached to a story. See [TLDef(0xDF8B3B22)] - public class MediaAreaGeoPoint : MediaArea + public sealed partial class MediaAreaGeoPoint : MediaArea { /// The size and position of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; @@ -16332,7 +16332,7 @@ namespace TL } /// Represents a reaction bubble. See [TLDef(0x14455871)] - public class MediaAreaSuggestedReaction : MediaArea + public sealed partial class MediaAreaSuggestedReaction : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16351,7 +16351,7 @@ namespace TL } /// Represents a channel post. See [TLDef(0x770416AF)] - public class MediaAreaChannelPost : MediaArea + public sealed partial class MediaAreaChannelPost : MediaArea { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; @@ -16362,7 +16362,7 @@ namespace TL } /// Represents a channel post See [TLDef(0x2271F2BF)] - public class InputMediaAreaChannelPost : MediaArea + public sealed partial class InputMediaAreaChannelPost : MediaArea { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; @@ -16374,7 +16374,7 @@ namespace TL /// Stories associated to a peer See [TLDef(0x9A35E999)] - public class PeerStories : IObject + public sealed partial class PeerStories : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16394,7 +16394,7 @@ namespace TL /// Active story list of a specific peer. See [TLDef(0xCAE68768)] - public class Stories_PeerStories : IObject, IPeerResolver + public sealed partial class Stories_PeerStories : IObject, IPeerResolver { /// Stories public PeerStories stories; @@ -16408,7 +16408,7 @@ namespace TL /// Represents an Instant View webpage. See [TLDef(0xFD5E12BD)] - public class Messages_WebPage : IObject, IPeerResolver + public sealed partial class Messages_WebPage : IObject, IPeerResolver { /// The instant view webpage. public WebPageBase webpage; @@ -16422,7 +16422,7 @@ namespace TL /// Contains info about a giveaway/gift option. See [TLDef(0x257E962B)] - public class PremiumGiftCodeOption : IObject + public sealed partial class PremiumGiftCodeOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16450,7 +16450,7 @@ namespace TL /// Contains info about a Telegram Premium giftcode link. See [TLDef(0x284A1096)] - public class Payments_CheckedGiftCode : IObject, IPeerResolver + public sealed partial class Payments_CheckedGiftCode : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16489,14 +16489,14 @@ namespace TL } /// Info about a Telegram Premium Giveaway. See Derived classes: , - public abstract class Payments_GiveawayInfoBase : IObject + public abstract partial class Payments_GiveawayInfoBase : IObject { /// When was the giveaway started public virtual DateTime StartDate => default; } /// Contains info about an ongoing giveaway. See [TLDef(0x4367DAA0)] - public class Payments_GiveawayInfo : Payments_GiveawayInfoBase + public sealed partial class Payments_GiveawayInfo : Payments_GiveawayInfoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16528,7 +16528,7 @@ namespace TL } /// A giveaway has ended. See [TLDef(0x00CD5570)] - public class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase + public sealed partial class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16557,7 +16557,7 @@ namespace TL /// Contains info about a prepaid giveaway ». See [TLDef(0xB2539D54)] - public class PrepaidGiveaway : IObject + public sealed partial class PrepaidGiveaway : IObject { /// Prepaid giveaway ID. public long id; @@ -16571,7 +16571,7 @@ namespace TL /// Info about one or more boosts applied by a specific user. See [TLDef(0x2A1C8C71)] - public class Boost : IObject + public sealed partial class Boost : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16609,7 +16609,7 @@ namespace TL /// List of boosts that were applied to a peer by multiple users. See [TLDef(0x86F8613C)] - public class Premium_BoostsList : IObject + public sealed partial class Premium_BoostsList : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16631,7 +16631,7 @@ namespace TL /// Contains information about a single boost slot ». See [TLDef(0xC448415C)] - public class MyBoost : IObject + public sealed partial class MyBoost : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16657,7 +16657,7 @@ namespace TL /// A list of peers we are currently boosting, and how many boost slots we have left. See [TLDef(0x9AE228E2)] - public class Premium_MyBoosts : IObject, IPeerResolver + public sealed partial class Premium_MyBoosts : IObject, IPeerResolver { /// Info about boosted peers and remaining boost slots. public MyBoost[] my_boosts; @@ -16671,7 +16671,7 @@ namespace TL /// Contains info about the current boost status of a peer. See [TLDef(0x4959427A)] - public class Premium_BoostsStatus : IObject + public sealed partial class Premium_BoostsStatus : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16711,7 +16711,7 @@ namespace TL /// Contains info about the original poster of a reposted story. See [TLDef(0xB826E150)] - public class StoryFwdHeader : IObject + public sealed partial class StoryFwdHeader : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16736,7 +16736,7 @@ namespace TL } /// Interaction counters See Derived classes: , - public abstract class PostInteractionCounters : IObject + public abstract partial class PostInteractionCounters : IObject { /// Number of views public int views; @@ -16747,14 +16747,14 @@ namespace TL } /// Interaction counters for a message. See [TLDef(0xE7058E7F)] - public class PostInteractionCountersMessage : PostInteractionCounters + public sealed partial class PostInteractionCountersMessage : PostInteractionCounters { /// Message ID public int msg_id; } /// Interaction counters for a story. See [TLDef(0x8A480E27)] - public class PostInteractionCountersStory : PostInteractionCounters + public sealed partial class PostInteractionCountersStory : PostInteractionCounters { /// Story ID public int story_id; @@ -16762,7 +16762,7 @@ namespace TL /// Contains statistics about a story. See [TLDef(0x50CD067C)] - public class Stats_StoryStats : IObject + public sealed partial class Stats_StoryStats : IObject { /// A graph containing the number of story views and shares public StatsGraphBase views_graph; @@ -16771,17 +16771,17 @@ namespace TL } /// Contains info about the forwards of a story as a message to public chats and reposts by public channels. See Derived classes: , - public abstract class PublicForward : IObject { } + public abstract partial class PublicForward : IObject { } /// Contains info about a forward of a story as a message. See [TLDef(0x01F2BF4A)] - public class PublicForwardMessage : PublicForward + public sealed partial class PublicForwardMessage : PublicForward { /// Info about the message with the reposted story. public MessageBase message; } /// Contains info about a forward of a story as a repost by a public channel. See [TLDef(0xEDF3ADD0)] - public class PublicForwardStory : PublicForward + public sealed partial class PublicForwardStory : PublicForward { /// The channel that reposted the story. public Peer peer; @@ -16791,7 +16791,7 @@ namespace TL /// Contains info about the forwards of a story as a message to public chats and reposts by public channels. See [TLDef(0x93037E20)] - public class Stats_PublicForwards : IObject, IPeerResolver + public sealed partial class Stats_PublicForwards : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16817,7 +16817,7 @@ namespace TL /// Represents a color palette ». See [TLDef(0xB54B5ACF)] - public class PeerColor : IObject + public sealed partial class PeerColor : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16836,17 +16836,17 @@ namespace TL } /// Contains info about a color palette ». See Derived classes: , - public abstract class Help_PeerColorSetBase : IObject { } + public abstract partial class Help_PeerColorSetBase : IObject { } /// Represents a color palette that can be used in message accents ». See [TLDef(0x26219A58)] - public class Help_PeerColorSet : Help_PeerColorSetBase + public sealed partial class Help_PeerColorSet : Help_PeerColorSetBase { /// A list of 1-3 colors in RGB format, describing the accent color. public int[] colors; } /// Represents a color palette that can be used in profile pages ». See [TLDef(0x767D61EB)] - public class Help_PeerColorProfileSet : Help_PeerColorSetBase + public sealed partial class Help_PeerColorProfileSet : Help_PeerColorSetBase { /// A list of 1-2 colors in RGB format, shown in the color palette settings to describe the current palette. public int[] palette_colors; @@ -16858,7 +16858,7 @@ namespace TL /// Contains info about a color palette ». See [TLDef(0xADEC6EBE)] - public class Help_PeerColorOption : IObject + public sealed partial class Help_PeerColorOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16890,7 +16890,7 @@ namespace TL /// Contains info about multiple color palettes ». See /// a value means help.peerColorsNotModified [TLDef(0x00F8ED08)] - public class Help_PeerColors : IObject + public sealed partial class Help_PeerColors : IObject { /// Hash for pagination, for more info click here public int hash; @@ -16899,10 +16899,10 @@ namespace TL } /// How a certain peer reacted to or interacted with a story See Derived classes: , , - public abstract class StoryReactionBase : IObject { } + public abstract partial class StoryReactionBase : IObject { } /// How a certain peer reacted to a story See [TLDef(0x6090D6D5)] - public class StoryReaction : StoryReactionBase + public sealed partial class StoryReaction : StoryReactionBase { /// The peer public Peer peer_id; @@ -16913,14 +16913,14 @@ namespace TL } /// A certain peer has forwarded the story as a message to a public chat or channel. See [TLDef(0xBBAB2643)] - public class StoryReactionPublicForward : StoryReactionBase + public sealed partial class StoryReactionPublicForward : StoryReactionBase { /// The message with the forwarded story. public MessageBase message; } /// A certain peer has reposted the story. See [TLDef(0xCFCD0F13)] - public class StoryReactionPublicRepost : StoryReactionBase + public sealed partial class StoryReactionPublicRepost : StoryReactionBase { /// The peer that reposted the story. public Peer peer_id; @@ -16930,7 +16930,7 @@ namespace TL /// List of peers that reacted to or intercated with a specific story See [TLDef(0xAA5F789C)] - public class Stories_StoryReactionsList : IObject, IPeerResolver + public sealed partial class Stories_StoryReactionsList : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16956,7 +16956,7 @@ namespace TL /// Represents a saved dialog ». See [TLDef(0xBD87CB6C)] - public class SavedDialog : IObject + public sealed partial class SavedDialog : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -16973,7 +16973,7 @@ namespace TL } /// Represents some saved message dialogs ». See Derived classes: , , - public abstract class Messages_SavedDialogsBase : IObject + public abstract partial class Messages_SavedDialogsBase : IObject { /// Saved message dialogs ». public virtual SavedDialog[] Dialogs => default; @@ -16986,7 +16986,7 @@ namespace TL } /// Represents some saved message dialogs ». See [TLDef(0xF83AE221)] - public class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver + public partial class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver { /// Saved message dialogs ». public SavedDialog[] dialogs; @@ -17010,14 +17010,14 @@ namespace TL } /// Incomplete list of saved message dialogs » with messages and auxiliary data. See [TLDef(0x44BA9DD9)] - public class Messages_SavedDialogsSlice : Messages_SavedDialogs + public sealed partial class Messages_SavedDialogsSlice : Messages_SavedDialogs { /// Total number of saved message dialogs public int count; } /// The saved dialogs haven't changed See [TLDef(0xC01F6FE8)] - public class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase + public sealed partial class Messages_SavedDialogsNotModified : Messages_SavedDialogsBase { /// Number of saved dialogs found server-side by the query public int count; @@ -17025,7 +17025,7 @@ namespace TL /// See [TLDef(0xCB6FF828)] - public class SavedReactionTag : IObject + public sealed partial class SavedReactionTag : IObject { public Flags flags; public Reaction reaction; @@ -17041,7 +17041,7 @@ namespace TL /// See /// a value means messages.savedReactionTagsNotModified [TLDef(0x3259950A)] - public class Messages_SavedReactionTags : IObject + public sealed partial class Messages_SavedReactionTags : IObject { public SavedReactionTag[] tags; public long hash; @@ -17049,16 +17049,16 @@ namespace TL /// See [TLDef(0x3BB842AC)] - public class OutboxReadDate : IObject + public sealed partial class OutboxReadDate : IObject { public DateTime date; } /// See - public abstract class Smsjobs_EligibilityToJoin : IObject { } + public abstract partial class Smsjobs_EligibilityToJoin : IObject { } /// See [TLDef(0xDC8B44CF)] - public class Smsjobs_EligibleToJoin : Smsjobs_EligibilityToJoin + public sealed partial class Smsjobs_EligibleToJoin : Smsjobs_EligibilityToJoin { public string terms_url; public int monthly_sent_sms; @@ -17066,7 +17066,7 @@ namespace TL /// See [TLDef(0x2AEE9191)] - public class Smsjobs_Status : IObject + public sealed partial class Smsjobs_Status : IObject { public Flags flags; public int recent_sent; @@ -17086,7 +17086,7 @@ namespace TL /// See [TLDef(0xE6A1EEB8)] - public class SmsJob : IObject + public sealed partial class SmsJob : IObject { public string job_id; public string phone_number; @@ -17095,7 +17095,7 @@ namespace TL /// See [TLDef(0x120B1AB9)] - public class BusinessWeeklyOpen : IObject + public sealed partial class BusinessWeeklyOpen : IObject { public int start_minute; public int end_minute; @@ -17103,7 +17103,7 @@ namespace TL /// See [TLDef(0x8C92B098)] - public class BusinessWorkHours : IObject + public sealed partial class BusinessWorkHours : IObject { public Flags flags; public string timezone_id; @@ -17117,7 +17117,7 @@ namespace TL /// See [TLDef(0xAC5C1AF7)] - public class BusinessLocation : IObject + public sealed partial class BusinessLocation : IObject { public Flags flags; [IfFlag(0)] public GeoPoint geo_point; @@ -17131,7 +17131,7 @@ namespace TL /// See [TLDef(0x6F8B32AA)] - public class InputBusinessRecipients : IObject + public sealed partial class InputBusinessRecipients : IObject { public Flags flags; [IfFlag(4)] public InputUserBase[] users; @@ -17149,7 +17149,7 @@ namespace TL /// See [TLDef(0x21108FF7)] - public class BusinessRecipients : IObject + public sealed partial class BusinessRecipients : IObject { public Flags flags; [IfFlag(4)] public long[] users; @@ -17166,16 +17166,16 @@ namespace TL } /// See - public abstract class BusinessAwayMessageSchedule : IObject { } + public abstract partial class BusinessAwayMessageSchedule : IObject { } /// See [TLDef(0xC9B9E2B9)] - public class BusinessAwayMessageScheduleAlways : BusinessAwayMessageSchedule { } + public sealed partial class BusinessAwayMessageScheduleAlways : BusinessAwayMessageSchedule { } /// See [TLDef(0xC3F2F501)] - public class BusinessAwayMessageScheduleOutsideWorkHours : BusinessAwayMessageSchedule { } + public sealed partial class BusinessAwayMessageScheduleOutsideWorkHours : BusinessAwayMessageSchedule { } /// See [TLDef(0xCC4D9ECC)] - public class BusinessAwayMessageScheduleCustom : BusinessAwayMessageSchedule + public sealed partial class BusinessAwayMessageScheduleCustom : BusinessAwayMessageSchedule { public DateTime start_date; public DateTime end_date; @@ -17183,7 +17183,7 @@ namespace TL /// See [TLDef(0x0194CB3B)] - public class InputBusinessGreetingMessage : IObject + public sealed partial class InputBusinessGreetingMessage : IObject { public int shortcut_id; public InputBusinessRecipients recipients; @@ -17192,7 +17192,7 @@ namespace TL /// See [TLDef(0xE519ABAB)] - public class BusinessGreetingMessage : IObject + public sealed partial class BusinessGreetingMessage : IObject { public int shortcut_id; public BusinessRecipients recipients; @@ -17201,7 +17201,7 @@ namespace TL /// See [TLDef(0x832175E0)] - public class InputBusinessAwayMessage : IObject + public sealed partial class InputBusinessAwayMessage : IObject { public Flags flags; public int shortcut_id; @@ -17216,7 +17216,7 @@ namespace TL /// See [TLDef(0xEF156A5C)] - public class BusinessAwayMessage : IObject + public sealed partial class BusinessAwayMessage : IObject { public Flags flags; public int shortcut_id; @@ -17231,7 +17231,7 @@ namespace TL /// See [TLDef(0xFF9289F5)] - public class Timezone : IObject + public sealed partial class Timezone : IObject { public string id; public string name; @@ -17241,7 +17241,7 @@ namespace TL /// See /// a value means help.timezonesListNotModified [TLDef(0x7B74ED71)] - public class Help_TimezonesList : IObject + public sealed partial class Help_TimezonesList : IObject { public Timezone[] timezones; public int hash; @@ -17249,7 +17249,7 @@ namespace TL /// See [TLDef(0x0697102B)] - public class QuickReply : IObject + public sealed partial class QuickReply : IObject { public int shortcut_id; public string shortcut; @@ -17258,16 +17258,16 @@ namespace TL } /// See - public abstract class InputQuickReplyShortcutBase : IObject { } + public abstract partial class InputQuickReplyShortcutBase : IObject { } /// See [TLDef(0x24596D41)] - public class InputQuickReplyShortcut : InputQuickReplyShortcutBase + public sealed partial class InputQuickReplyShortcut : InputQuickReplyShortcutBase { public string shortcut; } /// See [TLDef(0x01190CF1)] - public class InputQuickReplyShortcutId : InputQuickReplyShortcutBase + public sealed partial class InputQuickReplyShortcutId : InputQuickReplyShortcutBase { public int shortcut_id; } @@ -17275,7 +17275,7 @@ namespace TL /// See /// a value means messages.quickRepliesNotModified [TLDef(0xC68D6695)] - public class Messages_QuickReplies : IObject, IPeerResolver + public sealed partial class Messages_QuickReplies : IObject, IPeerResolver { public QuickReply[] quick_replies; public MessageBase[] messages; @@ -17287,7 +17287,7 @@ namespace TL /// See [TLDef(0xE7E999E7)] - public class ConnectedBot : IObject + public sealed partial class ConnectedBot : IObject { public Flags flags; public long bot_id; @@ -17301,7 +17301,7 @@ namespace TL /// See [TLDef(0x17D7F87B)] - public class Account_ConnectedBots : IObject + public sealed partial class Account_ConnectedBots : IObject { public ConnectedBot[] connected_bots; public Dictionary users; @@ -17309,7 +17309,7 @@ namespace TL /// See [TLDef(0x2AD93719)] - public class Messages_DialogFilters : IObject + public sealed partial class Messages_DialogFilters : IObject { public Flags flags; public DialogFilterBase[] filters; diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ad0376d..8240551 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -6514,21 +6514,21 @@ namespace TL.Methods { #pragma warning disable IDE1006 [TLDef(0xCB9F372D)] - public class InvokeAfterMsg : IMethod + public sealed partial class InvokeAfterMsg : IMethod { public long msg_id; public IMethod query; } [TLDef(0x3DC4B4F0)] - public class InvokeAfterMsgs : IMethod + public sealed partial class InvokeAfterMsgs : IMethod { public long[] msg_ids; public IMethod query; } [TLDef(0xC1CD5EA9)] - public class InitConnection : IMethod + public sealed partial class InitConnection : IMethod { public Flags flags; public int api_id; @@ -6550,34 +6550,34 @@ namespace TL.Methods } [TLDef(0xDA9B0D0D)] - public class InvokeWithLayer : IMethod + public sealed partial class InvokeWithLayer : IMethod { public int layer; public IMethod query; } [TLDef(0xBF9459B7)] - public class InvokeWithoutUpdates : IMethod + public sealed partial class InvokeWithoutUpdates : IMethod { public IMethod query; } [TLDef(0x365275F2)] - public class InvokeWithMessagesRange : IMethod + public sealed partial class InvokeWithMessagesRange : IMethod { public MessageRange range; public IMethod query; } [TLDef(0xACA9FD2E)] - public class InvokeWithTakeout : IMethod + public sealed partial class InvokeWithTakeout : IMethod { public long takeout_id; public IMethod query; } [TLDef(0xA677244F)] - public class Auth_SendCode : IMethod + public sealed partial class Auth_SendCode : IMethod { public string phone_number; public int api_id; @@ -6586,7 +6586,7 @@ namespace TL.Methods } [TLDef(0xAAC7B717)] - public class Auth_SignUp : IMethod + public sealed partial class Auth_SignUp : IMethod { public Flags flags; public string phone_number; @@ -6601,7 +6601,7 @@ namespace TL.Methods } [TLDef(0x8D52A951)] - public class Auth_SignIn : IMethod + public sealed partial class Auth_SignIn : IMethod { public Flags flags; public string phone_number; @@ -6617,26 +6617,26 @@ namespace TL.Methods } [TLDef(0x3E72BA19)] - public class Auth_LogOut : IMethod { } + public sealed partial class Auth_LogOut : IMethod { } [TLDef(0x9FAB0D1A)] - public class Auth_ResetAuthorizations : IMethod { } + public sealed partial class Auth_ResetAuthorizations : IMethod { } [TLDef(0xE5BFFFCD)] - public class Auth_ExportAuthorization : IMethod + public sealed partial class Auth_ExportAuthorization : IMethod { public int dc_id; } [TLDef(0xA57A7DAD)] - public class Auth_ImportAuthorization : IMethod + public sealed partial class Auth_ImportAuthorization : IMethod { public long id; public byte[] bytes; } [TLDef(0xCDD42A05)] - public class Auth_BindTempAuthKey : IMethod + public sealed partial class Auth_BindTempAuthKey : IMethod { public long perm_auth_key_id; public long nonce; @@ -6645,7 +6645,7 @@ namespace TL.Methods } [TLDef(0x67A3FF2C)] - public class Auth_ImportBotAuthorization : IMethod + public sealed partial class Auth_ImportBotAuthorization : IMethod { public int flags; public int api_id; @@ -6654,16 +6654,16 @@ namespace TL.Methods } [TLDef(0xD18B4D16)] - public class Auth_CheckPassword : IMethod + public sealed partial class Auth_CheckPassword : IMethod { public InputCheckPasswordSRP password; } [TLDef(0xD897BC66)] - public class Auth_RequestPasswordRecovery : IMethod { } + public sealed partial class Auth_RequestPasswordRecovery : IMethod { } [TLDef(0x37096C70)] - public class Auth_RecoverPassword : IMethod + public sealed partial class Auth_RecoverPassword : IMethod { public Flags flags; public string code; @@ -6676,27 +6676,27 @@ namespace TL.Methods } [TLDef(0x3EF1A9BF)] - public class Auth_ResendCode : IMethod + public sealed partial class Auth_ResendCode : IMethod { public string phone_number; public string phone_code_hash; } [TLDef(0x1F040578)] - public class Auth_CancelCode : IMethod + public sealed partial class Auth_CancelCode : IMethod { public string phone_number; public string phone_code_hash; } [TLDef(0x8E48A188)] - public class Auth_DropTempAuthKeys : IMethod + public sealed partial class Auth_DropTempAuthKeys : IMethod { public long[] except_auth_keys; } [TLDef(0xB7E085FE)] - public class Auth_ExportLoginToken : IMethod + public sealed partial class Auth_ExportLoginToken : IMethod { public int api_id; public string api_hash; @@ -6704,25 +6704,25 @@ namespace TL.Methods } [TLDef(0x95AC5CE4)] - public class Auth_ImportLoginToken : IMethod + public sealed partial class Auth_ImportLoginToken : IMethod { public byte[] token; } [TLDef(0xE894AD4D)] - public class Auth_AcceptLoginToken : IMethod + public sealed partial class Auth_AcceptLoginToken : IMethod { public byte[] token; } [TLDef(0x0D36BF79)] - public class Auth_CheckRecoveryPassword : IMethod + public sealed partial class Auth_CheckRecoveryPassword : IMethod { public string code; } [TLDef(0x2DB873A9)] - public class Auth_ImportWebTokenAuthorization : IMethod + public sealed partial class Auth_ImportWebTokenAuthorization : IMethod { public int api_id; public string api_hash; @@ -6730,7 +6730,7 @@ namespace TL.Methods } [TLDef(0x89464B50)] - public class Auth_RequestFirebaseSms : IMethod + public sealed partial class Auth_RequestFirebaseSms : IMethod { public Flags flags; public string phone_number; @@ -6746,14 +6746,14 @@ namespace TL.Methods } [TLDef(0x7E960193)] - public class Auth_ResetLoginEmail : IMethod + public sealed partial class Auth_ResetLoginEmail : IMethod { public string phone_number; public string phone_code_hash; } [TLDef(0xEC86017A)] - public class Account_RegisterDevice : IMethod + public sealed partial class Account_RegisterDevice : IMethod { public Flags flags; public int token_type; @@ -6769,7 +6769,7 @@ namespace TL.Methods } [TLDef(0x6A0D3206)] - public class Account_UnregisterDevice : IMethod + public sealed partial class Account_UnregisterDevice : IMethod { public int token_type; public string token; @@ -6777,23 +6777,23 @@ namespace TL.Methods } [TLDef(0x84BE5B93)] - public class Account_UpdateNotifySettings : IMethod + public sealed partial class Account_UpdateNotifySettings : IMethod { public InputNotifyPeerBase peer; public InputPeerNotifySettings settings; } [TLDef(0x12B3AD31)] - public class Account_GetNotifySettings : IMethod + public sealed partial class Account_GetNotifySettings : IMethod { public InputNotifyPeerBase peer; } [TLDef(0xDB7E1747)] - public class Account_ResetNotifySettings : IMethod { } + public sealed partial class Account_ResetNotifySettings : IMethod { } [TLDef(0x78515775)] - public class Account_UpdateProfile : IMethod + public sealed partial class Account_UpdateProfile : IMethod { public Flags flags; [IfFlag(0)] public string first_name; @@ -6809,19 +6809,19 @@ namespace TL.Methods } [TLDef(0x6628562C)] - public class Account_UpdateStatus : IMethod + public sealed partial class Account_UpdateStatus : IMethod { public bool offline; } [TLDef(0x07967D36)] - public class Account_GetWallPapers : IMethod + public sealed partial class Account_GetWallPapers : IMethod { public long hash; } [TLDef(0xC5BA3D86)] - public class Account_ReportPeer : IMethod + public sealed partial class Account_ReportPeer : IMethod { public InputPeer peer; public ReportReason reason; @@ -6829,32 +6829,32 @@ namespace TL.Methods } [TLDef(0x2714D86C)] - public class Account_CheckUsername : IMethod + public sealed partial class Account_CheckUsername : IMethod { public string username; } [TLDef(0x3E0BDD7C)] - public class Account_UpdateUsername : IMethod + public sealed partial class Account_UpdateUsername : IMethod { public string username; } [TLDef(0xDADBC950)] - public class Account_GetPrivacy : IMethod + public sealed partial class Account_GetPrivacy : IMethod { public InputPrivacyKey key; } [TLDef(0xC9F81CE8)] - public class Account_SetPrivacy : IMethod + public sealed partial class Account_SetPrivacy : IMethod { public InputPrivacyKey key; public InputPrivacyRule[] rules; } [TLDef(0xA2C0CF74)] - public class Account_DeleteAccount : IMethod + public sealed partial class Account_DeleteAccount : IMethod { public Flags flags; public string reason; @@ -6867,23 +6867,23 @@ namespace TL.Methods } [TLDef(0x08FC711D)] - public class Account_GetAccountTTL : IMethod { } + public sealed partial class Account_GetAccountTTL : IMethod { } [TLDef(0x2442485E)] - public class Account_SetAccountTTL : IMethod + public sealed partial class Account_SetAccountTTL : IMethod { public AccountDaysTTL ttl; } [TLDef(0x82574AE5)] - public class Account_SendChangePhoneCode : IMethod + public sealed partial class Account_SendChangePhoneCode : IMethod { public string phone_number; public CodeSettings settings; } [TLDef(0x70C32EDB)] - public class Account_ChangePhone : IMethod + public sealed partial class Account_ChangePhone : IMethod { public string phone_number; public string phone_code_hash; @@ -6891,93 +6891,93 @@ namespace TL.Methods } [TLDef(0x38DF3532)] - public class Account_UpdateDeviceLocked : IMethod + public sealed partial class Account_UpdateDeviceLocked : IMethod { public int period; } [TLDef(0xE320C158)] - public class Account_GetAuthorizations : IMethod { } + public sealed partial class Account_GetAuthorizations : IMethod { } [TLDef(0xDF77F3BC)] - public class Account_ResetAuthorization : IMethod + public sealed partial class Account_ResetAuthorization : IMethod { public long hash; } [TLDef(0x548A30F5)] - public class Account_GetPassword : IMethod { } + public sealed partial class Account_GetPassword : IMethod { } [TLDef(0x9CD4EAF9)] - public class Account_GetPasswordSettings : IMethod + public sealed partial class Account_GetPasswordSettings : IMethod { public InputCheckPasswordSRP password; } [TLDef(0xA59B102F)] - public class Account_UpdatePasswordSettings : IMethod + public sealed partial class Account_UpdatePasswordSettings : IMethod { public InputCheckPasswordSRP password; public Account_PasswordInputSettings new_settings; } [TLDef(0x1B3FAA88)] - public class Account_SendConfirmPhoneCode : IMethod + public sealed partial class Account_SendConfirmPhoneCode : IMethod { public string hash; public CodeSettings settings; } [TLDef(0x5F2178C3)] - public class Account_ConfirmPhone : IMethod + public sealed partial class Account_ConfirmPhone : IMethod { public string phone_code_hash; public string phone_code; } [TLDef(0x449E0B51)] - public class Account_GetTmpPassword : IMethod + public sealed partial class Account_GetTmpPassword : IMethod { public InputCheckPasswordSRP password; public int period; } [TLDef(0x182E6D6F)] - public class Account_GetWebAuthorizations : IMethod { } + public sealed partial class Account_GetWebAuthorizations : IMethod { } [TLDef(0x2D01B9EF)] - public class Account_ResetWebAuthorization : IMethod + public sealed partial class Account_ResetWebAuthorization : IMethod { public long hash; } [TLDef(0x682D2594)] - public class Account_ResetWebAuthorizations : IMethod { } + public sealed partial class Account_ResetWebAuthorizations : IMethod { } [TLDef(0xB288BC7D)] - public class Account_GetAllSecureValues : IMethod { } + public sealed partial class Account_GetAllSecureValues : IMethod { } [TLDef(0x73665BC2)] - public class Account_GetSecureValue : IMethod + public sealed partial class Account_GetSecureValue : IMethod { public SecureValueType[] types; } [TLDef(0x899FE31D)] - public class Account_SaveSecureValue : IMethod + public sealed partial class Account_SaveSecureValue : IMethod { public InputSecureValue value; public long secure_secret_id; } [TLDef(0xB880BC4B)] - public class Account_DeleteSecureValue : IMethod + public sealed partial class Account_DeleteSecureValue : IMethod { public SecureValueType[] types; } [TLDef(0xA929597A)] - public class Account_GetAuthorizationForm : IMethod + public sealed partial class Account_GetAuthorizationForm : IMethod { public long bot_id; public string scope; @@ -6985,7 +6985,7 @@ namespace TL.Methods } [TLDef(0xF3ED4C73)] - public class Account_AcceptAuthorization : IMethod + public sealed partial class Account_AcceptAuthorization : IMethod { public long bot_id; public string scope; @@ -6995,14 +6995,14 @@ namespace TL.Methods } [TLDef(0xA5A356F9)] - public class Account_SendVerifyPhoneCode : IMethod + public sealed partial class Account_SendVerifyPhoneCode : IMethod { public string phone_number; public CodeSettings settings; } [TLDef(0x4DD3A7F6)] - public class Account_VerifyPhone : IMethod + public sealed partial class Account_VerifyPhone : IMethod { public string phone_number; public string phone_code_hash; @@ -7010,21 +7010,21 @@ namespace TL.Methods } [TLDef(0x98E037BB)] - public class Account_SendVerifyEmailCode : IMethod + public sealed partial class Account_SendVerifyEmailCode : IMethod { public EmailVerifyPurpose purpose; public string email; } [TLDef(0x032DA4CF)] - public class Account_VerifyEmail : IMethod + public sealed partial class Account_VerifyEmail : IMethod { public EmailVerifyPurpose purpose; public EmailVerification verification; } [TLDef(0x8EF3EAB0)] - public class Account_InitTakeoutSession : IMethod + public sealed partial class Account_InitTakeoutSession : IMethod { public Flags flags; [IfFlag(5)] public long file_max_size; @@ -7041,7 +7041,7 @@ namespace TL.Methods } [TLDef(0x1D2652EE)] - public class Account_FinishTakeoutSession : IMethod + public sealed partial class Account_FinishTakeoutSession : IMethod { public Flags flags; @@ -7052,28 +7052,28 @@ namespace TL.Methods } [TLDef(0x8FDF1920)] - public class Account_ConfirmPasswordEmail : IMethod + public sealed partial class Account_ConfirmPasswordEmail : IMethod { public string code; } [TLDef(0x7A7F2A15)] - public class Account_ResendPasswordEmail : IMethod { } + public sealed partial class Account_ResendPasswordEmail : IMethod { } [TLDef(0xC1CBD5B6)] - public class Account_CancelPasswordEmail : IMethod { } + public sealed partial class Account_CancelPasswordEmail : IMethod { } [TLDef(0x9F07C728)] - public class Account_GetContactSignUpNotification : IMethod { } + public sealed partial class Account_GetContactSignUpNotification : IMethod { } [TLDef(0xCFF43F61)] - public class Account_SetContactSignUpNotification : IMethod + public sealed partial class Account_SetContactSignUpNotification : IMethod { public bool silent; } [TLDef(0x53577479)] - public class Account_GetNotifyExceptions : IMethod + public sealed partial class Account_GetNotifyExceptions : IMethod { public Flags flags; [IfFlag(0)] public InputNotifyPeerBase peer; @@ -7087,13 +7087,13 @@ namespace TL.Methods } [TLDef(0xFC8DDBEA)] - public class Account_GetWallPaper : IMethod + public sealed partial class Account_GetWallPaper : IMethod { public InputWallPaperBase wallpaper; } [TLDef(0xE39A8F03)] - public class Account_UploadWallPaper : IMethod + public sealed partial class Account_UploadWallPaper : IMethod { public Flags flags; public InputFileBase file; @@ -7107,7 +7107,7 @@ namespace TL.Methods } [TLDef(0x6C5A5B37)] - public class Account_SaveWallPaper : IMethod + public sealed partial class Account_SaveWallPaper : IMethod { public InputWallPaperBase wallpaper; public bool unsave; @@ -7115,20 +7115,20 @@ namespace TL.Methods } [TLDef(0xFEED5769)] - public class Account_InstallWallPaper : IMethod + public sealed partial class Account_InstallWallPaper : IMethod { public InputWallPaperBase wallpaper; public WallPaperSettings settings; } [TLDef(0xBB3B9804)] - public class Account_ResetWallPapers : IMethod { } + public sealed partial class Account_ResetWallPapers : IMethod { } [TLDef(0x56DA0B3F)] - public class Account_GetAutoDownloadSettings : IMethod { } + public sealed partial class Account_GetAutoDownloadSettings : IMethod { } [TLDef(0x76F36233)] - public class Account_SaveAutoDownloadSettings : IMethod + public sealed partial class Account_SaveAutoDownloadSettings : IMethod { public Flags flags; public AutoDownloadSettings settings; @@ -7141,7 +7141,7 @@ namespace TL.Methods } [TLDef(0x1C3DB333)] - public class Account_UploadTheme : IMethod + public sealed partial class Account_UploadTheme : IMethod { public Flags flags; public InputFileBase file; @@ -7156,7 +7156,7 @@ namespace TL.Methods } [TLDef(0x652E4400)] - public class Account_CreateTheme : IMethod + public sealed partial class Account_CreateTheme : IMethod { public Flags flags; public string slug; @@ -7172,7 +7172,7 @@ namespace TL.Methods } [TLDef(0x2BF40CCC)] - public class Account_UpdateTheme : IMethod + public sealed partial class Account_UpdateTheme : IMethod { public Flags flags; public string format; @@ -7192,14 +7192,14 @@ namespace TL.Methods } [TLDef(0xF257106C)] - public class Account_SaveTheme : IMethod + public sealed partial class Account_SaveTheme : IMethod { public InputThemeBase theme; public bool unsave; } [TLDef(0xC727BB3B)] - public class Account_InstallTheme : IMethod + public sealed partial class Account_InstallTheme : IMethod { public Flags flags; [IfFlag(1)] public InputThemeBase theme; @@ -7216,21 +7216,21 @@ namespace TL.Methods } [TLDef(0x3A5869EC)] - public class Account_GetTheme : IMethod + public sealed partial class Account_GetTheme : IMethod { public string format; public InputThemeBase theme; } [TLDef(0x7206E458)] - public class Account_GetThemes : IMethod + public sealed partial class Account_GetThemes : IMethod { public string format; public long hash; } [TLDef(0xB574B16B)] - public class Account_SetContentSettings : IMethod + public sealed partial class Account_SetContentSettings : IMethod { public Flags flags; @@ -7241,25 +7241,25 @@ namespace TL.Methods } [TLDef(0x8B9B4DAE)] - public class Account_GetContentSettings : IMethod { } + public sealed partial class Account_GetContentSettings : IMethod { } [TLDef(0x65AD71DC)] - public class Account_GetMultiWallPapers : IMethod + public sealed partial class Account_GetMultiWallPapers : IMethod { public InputWallPaperBase[] wallpapers; } [TLDef(0xEB2B4CF6)] - public class Account_GetGlobalPrivacySettings : IMethod { } + public sealed partial class Account_GetGlobalPrivacySettings : IMethod { } [TLDef(0x1EDAAAC2)] - public class Account_SetGlobalPrivacySettings : IMethod + public sealed partial class Account_SetGlobalPrivacySettings : IMethod { public GlobalPrivacySettings settings; } [TLDef(0xFA8CC6F5)] - public class Account_ReportProfilePhoto : IMethod + public sealed partial class Account_ReportProfilePhoto : IMethod { public InputPeer peer; public InputPhoto photo_id; @@ -7268,25 +7268,25 @@ namespace TL.Methods } [TLDef(0x9308CE1B)] - public class Account_ResetPassword : IMethod { } + public sealed partial class Account_ResetPassword : IMethod { } [TLDef(0x4C9409F6)] - public class Account_DeclinePasswordReset : IMethod { } + public sealed partial class Account_DeclinePasswordReset : IMethod { } [TLDef(0xD638DE89)] - public class Account_GetChatThemes : IMethod + public sealed partial class Account_GetChatThemes : IMethod { public long hash; } [TLDef(0xBF899AA0)] - public class Account_SetAuthorizationTTL : IMethod + public sealed partial class Account_SetAuthorizationTTL : IMethod { public int authorization_ttl_days; } [TLDef(0x40F48462)] - public class Account_ChangeAuthorizationSettings : IMethod + public sealed partial class Account_ChangeAuthorizationSettings : IMethod { public Flags flags; public long hash; @@ -7302,20 +7302,20 @@ namespace TL.Methods } [TLDef(0xE1902288)] - public class Account_GetSavedRingtones : IMethod + public sealed partial class Account_GetSavedRingtones : IMethod { public long hash; } [TLDef(0x3DEA5B03)] - public class Account_SaveRingtone : IMethod + public sealed partial class Account_SaveRingtone : IMethod { public InputDocument id; public bool unsave; } [TLDef(0x831A83A2)] - public class Account_UploadRingtone : IMethod + public sealed partial class Account_UploadRingtone : IMethod { public InputFileBase file; public string file_name; @@ -7323,56 +7323,56 @@ namespace TL.Methods } [TLDef(0xFBD3DE6B)] - public class Account_UpdateEmojiStatus : IMethod + public sealed partial class Account_UpdateEmojiStatus : IMethod { public EmojiStatus emoji_status; } [TLDef(0xD6753386)] - public class Account_GetDefaultEmojiStatuses : IMethod + public sealed partial class Account_GetDefaultEmojiStatuses : IMethod { public long hash; } [TLDef(0x0F578105)] - public class Account_GetRecentEmojiStatuses : IMethod + public sealed partial class Account_GetRecentEmojiStatuses : IMethod { public long hash; } [TLDef(0x18201AAE)] - public class Account_ClearRecentEmojiStatuses : IMethod { } + public sealed partial class Account_ClearRecentEmojiStatuses : IMethod { } [TLDef(0xEF500EAB)] - public class Account_ReorderUsernames : IMethod + public sealed partial class Account_ReorderUsernames : IMethod { public string[] order; } [TLDef(0x58D6B376)] - public class Account_ToggleUsername : IMethod + public sealed partial class Account_ToggleUsername : IMethod { public string username; public bool active; } [TLDef(0xE2750328)] - public class Account_GetDefaultProfilePhotoEmojis : IMethod + public sealed partial class Account_GetDefaultProfilePhotoEmojis : IMethod { public long hash; } [TLDef(0x915860AE)] - public class Account_GetDefaultGroupPhotoEmojis : IMethod + public sealed partial class Account_GetDefaultGroupPhotoEmojis : IMethod { public long hash; } [TLDef(0xADCBBCDA)] - public class Account_GetAutoSaveSettings : IMethod { } + public sealed partial class Account_GetAutoSaveSettings : IMethod { } [TLDef(0xD69B8361)] - public class Account_SaveAutoSaveSettings : IMethod + public sealed partial class Account_SaveAutoSaveSettings : IMethod { public Flags flags; [IfFlag(3)] public InputPeer peer; @@ -7388,16 +7388,16 @@ namespace TL.Methods } [TLDef(0x53BC0020)] - public class Account_DeleteAutoSaveExceptions : IMethod { } + public sealed partial class Account_DeleteAutoSaveExceptions : IMethod { } [TLDef(0xCA8AE8BA)] - public class Account_InvalidateSignInCodes : IMethod + public sealed partial class Account_InvalidateSignInCodes : IMethod { public string[] codes; } [TLDef(0x7CEFA15D)] - public class Account_UpdateColor : IMethod + public sealed partial class Account_UpdateColor : IMethod { public Flags flags; [IfFlag(2)] public int color; @@ -7412,25 +7412,25 @@ namespace TL.Methods } [TLDef(0xA60AB9CE)] - public class Account_GetDefaultBackgroundEmojis : IMethod + public sealed partial class Account_GetDefaultBackgroundEmojis : IMethod { public long hash; } [TLDef(0x7727A7D5)] - public class Account_GetChannelDefaultEmojiStatuses : IMethod + public sealed partial class Account_GetChannelDefaultEmojiStatuses : IMethod { public long hash; } [TLDef(0x35A9E0D5)] - public class Account_GetChannelRestrictedStatusEmojis : IMethod + public sealed partial class Account_GetChannelRestrictedStatusEmojis : IMethod { public long hash; } [TLDef(0x4B00E066)] - public class Account_UpdateBusinessWorkHours : IMethod + public sealed partial class Account_UpdateBusinessWorkHours : IMethod { public Flags flags; [IfFlag(0)] public BusinessWorkHours business_work_hours; @@ -7442,7 +7442,7 @@ namespace TL.Methods } [TLDef(0x9E6B131A)] - public class Account_UpdateBusinessLocation : IMethod + public sealed partial class Account_UpdateBusinessLocation : IMethod { public Flags flags; [IfFlag(1)] public InputGeoPoint geo_point; @@ -7456,7 +7456,7 @@ namespace TL.Methods } [TLDef(0x66CDAFC4)] - public class Account_UpdateBusinessGreetingMessage : IMethod + public sealed partial class Account_UpdateBusinessGreetingMessage : IMethod { public Flags flags; [IfFlag(0)] public InputBusinessGreetingMessage message; @@ -7468,7 +7468,7 @@ namespace TL.Methods } [TLDef(0xA26A7FA5)] - public class Account_UpdateBusinessAwayMessage : IMethod + public sealed partial class Account_UpdateBusinessAwayMessage : IMethod { public Flags flags; [IfFlag(0)] public InputBusinessAwayMessage message; @@ -7480,7 +7480,7 @@ namespace TL.Methods } [TLDef(0x9C2D527D)] - public class Account_UpdateConnectedBot : IMethod + public sealed partial class Account_UpdateConnectedBot : IMethod { public Flags flags; public InputUserBase bot; @@ -7494,68 +7494,68 @@ namespace TL.Methods } [TLDef(0x4EA4C80F)] - public class Account_GetConnectedBots : IMethod { } + public sealed partial class Account_GetConnectedBots : IMethod { } [TLDef(0x0D91A548)] - public class Users_GetUsers : IMethod + public sealed partial class Users_GetUsers : IMethod { public InputUserBase[] id; } [TLDef(0xB60F5918)] - public class Users_GetFullUser : IMethod + public sealed partial class Users_GetFullUser : IMethod { public InputUserBase id; } [TLDef(0x90C894B5)] - public class Users_SetSecureValueErrors : IMethod + public sealed partial class Users_SetSecureValueErrors : IMethod { public InputUserBase id; public SecureValueErrorBase[] errors; } [TLDef(0xA622AA10)] - public class Users_GetIsPremiumRequiredToContact : IMethod + public sealed partial class Users_GetIsPremiumRequiredToContact : IMethod { public InputUserBase[] id; } [TLDef(0x7ADC669D)] - public class Contacts_GetContactIDs : IMethod + public sealed partial class Contacts_GetContactIDs : IMethod { public long hash; } [TLDef(0xC4A353EE)] - public class Contacts_GetStatuses : IMethod { } + public sealed partial class Contacts_GetStatuses : IMethod { } [TLDef(0x5DD69E12)] - public class Contacts_GetContacts : IMethod + public sealed partial class Contacts_GetContacts : IMethod { public long hash; } [TLDef(0x2C800BE5)] - public class Contacts_ImportContacts : IMethod + public sealed partial class Contacts_ImportContacts : IMethod { public InputContact[] contacts; } [TLDef(0x096A0E00)] - public class Contacts_DeleteContacts : IMethod + public sealed partial class Contacts_DeleteContacts : IMethod { public InputUserBase[] id; } [TLDef(0x1013FD9E)] - public class Contacts_DeleteByPhones : IMethod + public sealed partial class Contacts_DeleteByPhones : IMethod { public string[] phones; } [TLDef(0x2E2E8734)] - public class Contacts_Block : IMethod + public sealed partial class Contacts_Block : IMethod { public Flags flags; public InputPeer id; @@ -7567,7 +7567,7 @@ namespace TL.Methods } [TLDef(0xB550D328)] - public class Contacts_Unblock : IMethod + public sealed partial class Contacts_Unblock : IMethod { public Flags flags; public InputPeer id; @@ -7579,7 +7579,7 @@ namespace TL.Methods } [TLDef(0x9A868F80)] - public class Contacts_GetBlocked : IMethod + public sealed partial class Contacts_GetBlocked : IMethod { public Flags flags; public int offset; @@ -7592,20 +7592,20 @@ namespace TL.Methods } [TLDef(0x11F812D8)] - public class Contacts_Search : IMethod + public sealed partial class Contacts_Search : IMethod { public string q; public int limit; } [TLDef(0xF93CCBA3)] - public class Contacts_ResolveUsername : IMethod + public sealed partial class Contacts_ResolveUsername : IMethod { public string username; } [TLDef(0x973478B6)] - public class Contacts_GetTopPeers : IMethod + public sealed partial class Contacts_GetTopPeers : IMethod { public Flags flags; public int offset; @@ -7626,26 +7626,26 @@ namespace TL.Methods } [TLDef(0x1AE373AC)] - public class Contacts_ResetTopPeerRating : IMethod + public sealed partial class Contacts_ResetTopPeerRating : IMethod { public TopPeerCategory category; public InputPeer peer; } [TLDef(0x879537F1)] - public class Contacts_ResetSaved : IMethod { } + public sealed partial class Contacts_ResetSaved : IMethod { } [TLDef(0x82F1E39F)] - public class Contacts_GetSaved : IMethod { } + public sealed partial class Contacts_GetSaved : IMethod { } [TLDef(0x8514BDDA)] - public class Contacts_ToggleTopPeers : IMethod + public sealed partial class Contacts_ToggleTopPeers : IMethod { public bool enabled; } [TLDef(0xE8F463D0)] - public class Contacts_AddContact : IMethod + public sealed partial class Contacts_AddContact : IMethod { public Flags flags; public InputUserBase id; @@ -7660,13 +7660,13 @@ namespace TL.Methods } [TLDef(0xF831A20F)] - public class Contacts_AcceptContact : IMethod + public sealed partial class Contacts_AcceptContact : IMethod { public InputUserBase id; } [TLDef(0xD348BC44)] - public class Contacts_GetLocated : IMethod + public sealed partial class Contacts_GetLocated : IMethod { public Flags flags; public InputGeoPoint geo_point; @@ -7680,7 +7680,7 @@ namespace TL.Methods } [TLDef(0x29A8962C)] - public class Contacts_BlockFromReplies : IMethod + public sealed partial class Contacts_BlockFromReplies : IMethod { public Flags flags; public int msg_id; @@ -7694,28 +7694,28 @@ namespace TL.Methods } [TLDef(0x8AF94344)] - public class Contacts_ResolvePhone : IMethod + public sealed partial class Contacts_ResolvePhone : IMethod { public string phone; } [TLDef(0xF8654027)] - public class Contacts_ExportContactToken : IMethod { } + public sealed partial class Contacts_ExportContactToken : IMethod { } [TLDef(0x13005788)] - public class Contacts_ImportContactToken : IMethod + public sealed partial class Contacts_ImportContactToken : IMethod { public string token; } [TLDef(0xBA6705F0)] - public class Contacts_EditCloseFriends : IMethod + public sealed partial class Contacts_EditCloseFriends : IMethod { public long[] id; } [TLDef(0x94C65C76)] - public class Contacts_SetBlocked : IMethod + public sealed partial class Contacts_SetBlocked : IMethod { public Flags flags; public InputPeer[] id; @@ -7728,13 +7728,13 @@ namespace TL.Methods } [TLDef(0x63C66506)] - public class Messages_GetMessages : IMethod + public sealed partial class Messages_GetMessages : IMethod { public InputMessage[] id; } [TLDef(0xA0F4CB4F)] - public class Messages_GetDialogs : IMethod + public sealed partial class Messages_GetDialogs : IMethod { public Flags flags; [IfFlag(1)] public int folder_id; @@ -7752,7 +7752,7 @@ namespace TL.Methods } [TLDef(0x4423E6C5)] - public class Messages_GetHistory : IMethod + public sealed partial class Messages_GetHistory : IMethod { public InputPeer peer; public int offset_id; @@ -7765,7 +7765,7 @@ namespace TL.Methods } [TLDef(0x29EE847A)] - public class Messages_Search : IMethod + public sealed partial class Messages_Search : IMethod { public Flags flags; public InputPeer peer; @@ -7794,14 +7794,14 @@ namespace TL.Methods } [TLDef(0x0E306D3A)] - public class Messages_ReadHistory : IMethod + public sealed partial class Messages_ReadHistory : IMethod { public InputPeer peer; public int max_id; } [TLDef(0xB08F922A)] - public class Messages_DeleteHistory : IMethod + public sealed partial class Messages_DeleteHistory : IMethod { public Flags flags; public InputPeer peer; @@ -7819,7 +7819,7 @@ namespace TL.Methods } [TLDef(0xE58E95D2)] - public class Messages_DeleteMessages : IMethod + public sealed partial class Messages_DeleteMessages : IMethod { public Flags flags; public int[] id; @@ -7831,13 +7831,13 @@ namespace TL.Methods } [TLDef(0x05A954C0)] - public class Messages_ReceivedMessages : IMethod + public sealed partial class Messages_ReceivedMessages : IMethod { public int max_id; } [TLDef(0x58943EE2)] - public class Messages_SetTyping : IMethod + public sealed partial class Messages_SetTyping : IMethod { public Flags flags; public InputPeer peer; @@ -7851,7 +7851,7 @@ namespace TL.Methods } [TLDef(0xDFF8042C)] - public class Messages_SendMessage : IMethod + public sealed partial class Messages_SendMessage : IMethod { public Flags flags; public InputPeer peer; @@ -7883,7 +7883,7 @@ namespace TL.Methods } [TLDef(0x7BD66041)] - public class Messages_SendMedia : IMethod + public sealed partial class Messages_SendMedia : IMethod { public Flags flags; public InputPeer peer; @@ -7915,7 +7915,7 @@ namespace TL.Methods } [TLDef(0xD5039208)] - public class Messages_ForwardMessages : IMethod + public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; public InputPeer from_peer; @@ -7943,19 +7943,19 @@ namespace TL.Methods } [TLDef(0xCF1592DB)] - public class Messages_ReportSpam : IMethod + public sealed partial class Messages_ReportSpam : IMethod { public InputPeer peer; } [TLDef(0xEFD9A6A2)] - public class Messages_GetPeerSettings : IMethod + public sealed partial class Messages_GetPeerSettings : IMethod { public InputPeer peer; } [TLDef(0x8953AB4E)] - public class Messages_Report : IMethod + public sealed partial class Messages_Report : IMethod { public InputPeer peer; public int[] id; @@ -7964,33 +7964,33 @@ namespace TL.Methods } [TLDef(0x49E9528F)] - public class Messages_GetChats : IMethod + public sealed partial class Messages_GetChats : IMethod { public long[] id; } [TLDef(0xAEB00B34)] - public class Messages_GetFullChat : IMethod + public sealed partial class Messages_GetFullChat : IMethod { public long chat_id; } [TLDef(0x73783FFD)] - public class Messages_EditChatTitle : IMethod + public sealed partial class Messages_EditChatTitle : IMethod { public long chat_id; public string title; } [TLDef(0x35DDD674)] - public class Messages_EditChatPhoto : IMethod + public sealed partial class Messages_EditChatPhoto : IMethod { public long chat_id; public InputChatPhotoBase photo; } [TLDef(0xF24753E3)] - public class Messages_AddChatUser : IMethod + public sealed partial class Messages_AddChatUser : IMethod { public long chat_id; public InputUserBase user_id; @@ -7998,7 +7998,7 @@ namespace TL.Methods } [TLDef(0xA2185CAB)] - public class Messages_DeleteChatUser : IMethod + public sealed partial class Messages_DeleteChatUser : IMethod { public Flags flags; public long chat_id; @@ -8011,7 +8011,7 @@ namespace TL.Methods } [TLDef(0x0034A818)] - public class Messages_CreateChat : IMethod + public sealed partial class Messages_CreateChat : IMethod { public Flags flags; public InputUserBase[] users; @@ -8025,14 +8025,14 @@ namespace TL.Methods } [TLDef(0x26CF8950)] - public class Messages_GetDhConfig : IMethod + public sealed partial class Messages_GetDhConfig : IMethod { public int version; public int random_length; } [TLDef(0xF64DAF43)] - public class Messages_RequestEncryption : IMethod + public sealed partial class Messages_RequestEncryption : IMethod { public InputUserBase user_id; public int random_id; @@ -8040,7 +8040,7 @@ namespace TL.Methods } [TLDef(0x3DBC0415)] - public class Messages_AcceptEncryption : IMethod + public sealed partial class Messages_AcceptEncryption : IMethod { public InputEncryptedChat peer; public byte[] g_b; @@ -8048,7 +8048,7 @@ namespace TL.Methods } [TLDef(0xF393AEA0)] - public class Messages_DiscardEncryption : IMethod + public sealed partial class Messages_DiscardEncryption : IMethod { public Flags flags; public int chat_id; @@ -8060,21 +8060,21 @@ namespace TL.Methods } [TLDef(0x791451ED)] - public class Messages_SetEncryptedTyping : IMethod + public sealed partial class Messages_SetEncryptedTyping : IMethod { public InputEncryptedChat peer; public bool typing; } [TLDef(0x7F4B690A)] - public class Messages_ReadEncryptedHistory : IMethod + public sealed partial class Messages_ReadEncryptedHistory : IMethod { public InputEncryptedChat peer; public DateTime max_date; } [TLDef(0x44FA7A15)] - public class Messages_SendEncrypted : IMethod + public sealed partial class Messages_SendEncrypted : IMethod { public Flags flags; public InputEncryptedChat peer; @@ -8088,7 +8088,7 @@ namespace TL.Methods } [TLDef(0x5559481D)] - public class Messages_SendEncryptedFile : IMethod + public sealed partial class Messages_SendEncryptedFile : IMethod { public Flags flags; public InputEncryptedChat peer; @@ -8103,7 +8103,7 @@ namespace TL.Methods } [TLDef(0x32D439A4)] - public class Messages_SendEncryptedService : IMethod + public sealed partial class Messages_SendEncryptedService : IMethod { public InputEncryptedChat peer; public long random_id; @@ -8111,38 +8111,38 @@ namespace TL.Methods } [TLDef(0x55A5BB66)] - public class Messages_ReceivedQueue : IMethod + public sealed partial class Messages_ReceivedQueue : IMethod { public int max_qts; } [TLDef(0x4B0C8C0F)] - public class Messages_ReportEncryptedSpam : IMethod + public sealed partial class Messages_ReportEncryptedSpam : IMethod { public InputEncryptedChat peer; } [TLDef(0x36A73F77)] - public class Messages_ReadMessageContents : IMethod + public sealed partial class Messages_ReadMessageContents : IMethod { public int[] id; } [TLDef(0xD5A5D3A1)] - public class Messages_GetStickers : IMethod + public sealed partial class Messages_GetStickers : IMethod { public string emoticon; public long hash; } [TLDef(0xB8A0A1A8)] - public class Messages_GetAllStickers : IMethod + public sealed partial class Messages_GetAllStickers : IMethod { public long hash; } [TLDef(0x8B68B0CC)] - public class Messages_GetWebPagePreview : IMethod + public sealed partial class Messages_GetWebPagePreview : IMethod { public Flags flags; public string message; @@ -8155,7 +8155,7 @@ namespace TL.Methods } [TLDef(0xA02CE5D5)] - public class Messages_ExportChatInvite : IMethod + public sealed partial class Messages_ExportChatInvite : IMethod { public Flags flags; public InputPeer peer; @@ -8174,39 +8174,39 @@ namespace TL.Methods } [TLDef(0x3EADB1BB)] - public class Messages_CheckChatInvite : IMethod + public sealed partial class Messages_CheckChatInvite : IMethod { public string hash; } [TLDef(0x6C50051C)] - public class Messages_ImportChatInvite : IMethod + public sealed partial class Messages_ImportChatInvite : IMethod { public string hash; } [TLDef(0xC8A0EC74)] - public class Messages_GetStickerSet : IMethod + public sealed partial class Messages_GetStickerSet : IMethod { public InputStickerSet stickerset; public int hash; } [TLDef(0xC78FE460)] - public class Messages_InstallStickerSet : IMethod + public sealed partial class Messages_InstallStickerSet : IMethod { public InputStickerSet stickerset; public bool archived; } [TLDef(0xF96E55DE)] - public class Messages_UninstallStickerSet : IMethod + public sealed partial class Messages_UninstallStickerSet : IMethod { public InputStickerSet stickerset; } [TLDef(0xE6DF7378)] - public class Messages_StartBot : IMethod + public sealed partial class Messages_StartBot : IMethod { public InputUserBase bot; public InputPeer peer; @@ -8215,7 +8215,7 @@ namespace TL.Methods } [TLDef(0x5784D3E1)] - public class Messages_GetMessagesViews : IMethod + public sealed partial class Messages_GetMessagesViews : IMethod { public InputPeer peer; public int[] id; @@ -8223,7 +8223,7 @@ namespace TL.Methods } [TLDef(0xA85BD1C2)] - public class Messages_EditChatAdmin : IMethod + public sealed partial class Messages_EditChatAdmin : IMethod { public long chat_id; public InputUserBase user_id; @@ -8231,13 +8231,13 @@ namespace TL.Methods } [TLDef(0xA2875319)] - public class Messages_MigrateChat : IMethod + public sealed partial class Messages_MigrateChat : IMethod { public long chat_id; } [TLDef(0x4BC6589A)] - public class Messages_SearchGlobal : IMethod + public sealed partial class Messages_SearchGlobal : IMethod { public Flags flags; [IfFlag(0)] public int folder_id; @@ -8257,7 +8257,7 @@ namespace TL.Methods } [TLDef(0x78337739)] - public class Messages_ReorderStickerSets : IMethod + public sealed partial class Messages_ReorderStickerSets : IMethod { public Flags flags; public long[] order; @@ -8270,7 +8270,7 @@ namespace TL.Methods } [TLDef(0xB1F2061F)] - public class Messages_GetDocumentByHash : IMethod + public sealed partial class Messages_GetDocumentByHash : IMethod { public byte[] sha256; public long size; @@ -8278,20 +8278,20 @@ namespace TL.Methods } [TLDef(0x5CF09635)] - public class Messages_GetSavedGifs : IMethod + public sealed partial class Messages_GetSavedGifs : IMethod { public long hash; } [TLDef(0x327A30CB)] - public class Messages_SaveGif : IMethod + public sealed partial class Messages_SaveGif : IMethod { public InputDocument id; public bool unsave; } [TLDef(0x514E999D)] - public class Messages_GetInlineBotResults : IMethod + public sealed partial class Messages_GetInlineBotResults : IMethod { public Flags flags; public InputUserBase bot; @@ -8307,7 +8307,7 @@ namespace TL.Methods } [TLDef(0xBB12A419)] - public class Messages_SetInlineBotResults : IMethod + public sealed partial class Messages_SetInlineBotResults : IMethod { public Flags flags; public long query_id; @@ -8328,7 +8328,7 @@ namespace TL.Methods } [TLDef(0x3EBEE86A)] - public class Messages_SendInlineBotResult : IMethod + public sealed partial class Messages_SendInlineBotResult : IMethod { public Flags flags; public InputPeer peer; @@ -8354,14 +8354,14 @@ namespace TL.Methods } [TLDef(0xFDA68D36)] - public class Messages_GetMessageEditData : IMethod + public sealed partial class Messages_GetMessageEditData : IMethod { public InputPeer peer; public int id; } [TLDef(0xDFD14005)] - public class Messages_EditMessage : IMethod + public sealed partial class Messages_EditMessage : IMethod { public Flags flags; public InputPeer peer; @@ -8387,7 +8387,7 @@ namespace TL.Methods } [TLDef(0x83557DBA)] - public class Messages_EditInlineBotMessage : IMethod + public sealed partial class Messages_EditInlineBotMessage : IMethod { public Flags flags; public InputBotInlineMessageIDBase id; @@ -8408,7 +8408,7 @@ namespace TL.Methods } [TLDef(0x9342CA07)] - public class Messages_GetBotCallbackAnswer : IMethod + public sealed partial class Messages_GetBotCallbackAnswer : IMethod { public Flags flags; public InputPeer peer; @@ -8425,7 +8425,7 @@ namespace TL.Methods } [TLDef(0xD58F130A)] - public class Messages_SetBotCallbackAnswer : IMethod + public sealed partial class Messages_SetBotCallbackAnswer : IMethod { public Flags flags; public long query_id; @@ -8442,13 +8442,13 @@ namespace TL.Methods } [TLDef(0xE470BCFD)] - public class Messages_GetPeerDialogs : IMethod + public sealed partial class Messages_GetPeerDialogs : IMethod { public InputDialogPeerBase[] peers; } [TLDef(0x7FF3B806)] - public class Messages_SaveDraft : IMethod + public sealed partial class Messages_SaveDraft : IMethod { public Flags flags; [IfFlag(4)] public InputReplyTo reply_to; @@ -8468,22 +8468,22 @@ namespace TL.Methods } [TLDef(0x6A3F8D65)] - public class Messages_GetAllDrafts : IMethod { } + public sealed partial class Messages_GetAllDrafts : IMethod { } [TLDef(0x64780B14)] - public class Messages_GetFeaturedStickers : IMethod + public sealed partial class Messages_GetFeaturedStickers : IMethod { public long hash; } [TLDef(0x5B118126)] - public class Messages_ReadFeaturedStickers : IMethod + public sealed partial class Messages_ReadFeaturedStickers : IMethod { public long[] id; } [TLDef(0x9DA9403B)] - public class Messages_GetRecentStickers : IMethod + public sealed partial class Messages_GetRecentStickers : IMethod { public Flags flags; public long hash; @@ -8495,7 +8495,7 @@ namespace TL.Methods } [TLDef(0x392718F8)] - public class Messages_SaveRecentSticker : IMethod + public sealed partial class Messages_SaveRecentSticker : IMethod { public Flags flags; public InputDocument id; @@ -8508,7 +8508,7 @@ namespace TL.Methods } [TLDef(0x8999602D)] - public class Messages_ClearRecentStickers : IMethod + public sealed partial class Messages_ClearRecentStickers : IMethod { public Flags flags; @@ -8519,7 +8519,7 @@ namespace TL.Methods } [TLDef(0x57F17692)] - public class Messages_GetArchivedStickers : IMethod + public sealed partial class Messages_GetArchivedStickers : IMethod { public Flags flags; public long offset_id; @@ -8533,19 +8533,19 @@ namespace TL.Methods } [TLDef(0x640F82B8)] - public class Messages_GetMaskStickers : IMethod + public sealed partial class Messages_GetMaskStickers : IMethod { public long hash; } [TLDef(0xCC5B67CC)] - public class Messages_GetAttachedStickers : IMethod + public sealed partial class Messages_GetAttachedStickers : IMethod { public InputStickeredMedia media; } [TLDef(0x8EF8ECC0)] - public class Messages_SetGameScore : IMethod + public sealed partial class Messages_SetGameScore : IMethod { public Flags flags; public InputPeer peer; @@ -8561,7 +8561,7 @@ namespace TL.Methods } [TLDef(0x15AD9F64)] - public class Messages_SetInlineGameScore : IMethod + public sealed partial class Messages_SetInlineGameScore : IMethod { public Flags flags; public InputBotInlineMessageIDBase id; @@ -8576,7 +8576,7 @@ namespace TL.Methods } [TLDef(0xE822649D)] - public class Messages_GetGameHighScores : IMethod + public sealed partial class Messages_GetGameHighScores : IMethod { public InputPeer peer; public int id; @@ -8584,14 +8584,14 @@ namespace TL.Methods } [TLDef(0x0F635E1B)] - public class Messages_GetInlineGameHighScores : IMethod + public sealed partial class Messages_GetInlineGameHighScores : IMethod { public InputBotInlineMessageIDBase id; public InputUserBase user_id; } [TLDef(0xE40CA104)] - public class Messages_GetCommonChats : IMethod + public sealed partial class Messages_GetCommonChats : IMethod { public InputUserBase user_id; public long max_id; @@ -8599,14 +8599,14 @@ namespace TL.Methods } [TLDef(0x8D9692A3)] - public class Messages_GetWebPage : IMethod + public sealed partial class Messages_GetWebPage : IMethod { public string url; public int hash; } [TLDef(0xA731E257)] - public class Messages_ToggleDialogPin : IMethod + public sealed partial class Messages_ToggleDialogPin : IMethod { public Flags flags; public InputDialogPeerBase peer; @@ -8618,7 +8618,7 @@ namespace TL.Methods } [TLDef(0x3B1ADF37)] - public class Messages_ReorderPinnedDialogs : IMethod + public sealed partial class Messages_ReorderPinnedDialogs : IMethod { public Flags flags; public int folder_id; @@ -8631,13 +8631,13 @@ namespace TL.Methods } [TLDef(0xD6B94DF2)] - public class Messages_GetPinnedDialogs : IMethod + public sealed partial class Messages_GetPinnedDialogs : IMethod { public int folder_id; } [TLDef(0xE5F672FA)] - public class Messages_SetBotShippingResults : IMethod + public sealed partial class Messages_SetBotShippingResults : IMethod { public Flags flags; public long query_id; @@ -8652,7 +8652,7 @@ namespace TL.Methods } [TLDef(0x09C2DD95)] - public class Messages_SetBotPrecheckoutResults : IMethod + public sealed partial class Messages_SetBotPrecheckoutResults : IMethod { public Flags flags; public long query_id; @@ -8666,14 +8666,14 @@ namespace TL.Methods } [TLDef(0x519BC2B1)] - public class Messages_UploadMedia : IMethod + public sealed partial class Messages_UploadMedia : IMethod { public InputPeer peer; public InputMedia media; } [TLDef(0xA1405817)] - public class Messages_SendScreenshotNotification : IMethod + public sealed partial class Messages_SendScreenshotNotification : IMethod { public InputPeer peer; public InputReplyTo reply_to; @@ -8681,20 +8681,20 @@ namespace TL.Methods } [TLDef(0x04F1AAA9)] - public class Messages_GetFavedStickers : IMethod + public sealed partial class Messages_GetFavedStickers : IMethod { public long hash; } [TLDef(0xB9FFC55B)] - public class Messages_FaveSticker : IMethod + public sealed partial class Messages_FaveSticker : IMethod { public InputDocument id; public bool unfave; } [TLDef(0xF107E790)] - public class Messages_GetUnreadMentions : IMethod + public sealed partial class Messages_GetUnreadMentions : IMethod { public Flags flags; public InputPeer peer; @@ -8712,7 +8712,7 @@ namespace TL.Methods } [TLDef(0x36E5BF4D)] - public class Messages_ReadMentions : IMethod + public sealed partial class Messages_ReadMentions : IMethod { public Flags flags; public InputPeer peer; @@ -8725,7 +8725,7 @@ namespace TL.Methods } [TLDef(0x702A40E0)] - public class Messages_GetRecentLocations : IMethod + public sealed partial class Messages_GetRecentLocations : IMethod { public InputPeer peer; public int limit; @@ -8733,7 +8733,7 @@ namespace TL.Methods } [TLDef(0x0C964709)] - public class Messages_SendMultiMedia : IMethod + public sealed partial class Messages_SendMultiMedia : IMethod { public Flags flags; public InputPeer peer; @@ -8759,14 +8759,14 @@ namespace TL.Methods } [TLDef(0x5057C497)] - public class Messages_UploadEncryptedFile : IMethod + public sealed partial class Messages_UploadEncryptedFile : IMethod { public InputEncryptedChat peer; public InputEncryptedFileBase file; } [TLDef(0x35705B8A)] - public class Messages_SearchStickerSets : IMethod + public sealed partial class Messages_SearchStickerSets : IMethod { public Flags flags; public string q; @@ -8779,10 +8779,10 @@ namespace TL.Methods } [TLDef(0x1CFF7E08)] - public class Messages_GetSplitRanges : IMethod { } + public sealed partial class Messages_GetSplitRanges : IMethod { } [TLDef(0xC286D98F)] - public class Messages_MarkDialogUnread : IMethod + public sealed partial class Messages_MarkDialogUnread : IMethod { public Flags flags; public InputDialogPeerBase peer; @@ -8794,13 +8794,13 @@ namespace TL.Methods } [TLDef(0x22E24E22)] - public class Messages_GetDialogUnreadMarks : IMethod { } + public sealed partial class Messages_GetDialogUnreadMarks : IMethod { } [TLDef(0x7E58EE9C)] - public class Messages_ClearAllDrafts : IMethod { } + public sealed partial class Messages_ClearAllDrafts : IMethod { } [TLDef(0xD2AAF7EC)] - public class Messages_UpdatePinnedMessage : IMethod + public sealed partial class Messages_UpdatePinnedMessage : IMethod { public Flags flags; public InputPeer peer; @@ -8815,7 +8815,7 @@ namespace TL.Methods } [TLDef(0x10EA6184)] - public class Messages_SendVote : IMethod + public sealed partial class Messages_SendVote : IMethod { public InputPeer peer; public int msg_id; @@ -8823,59 +8823,59 @@ namespace TL.Methods } [TLDef(0x73BB643B)] - public class Messages_GetPollResults : IMethod + public sealed partial class Messages_GetPollResults : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0x6E2BE050)] - public class Messages_GetOnlines : IMethod + public sealed partial class Messages_GetOnlines : IMethod { public InputPeer peer; } [TLDef(0xDEF60797)] - public class Messages_EditChatAbout : IMethod + public sealed partial class Messages_EditChatAbout : IMethod { public InputPeer peer; public string about; } [TLDef(0xA5866B41)] - public class Messages_EditChatDefaultBannedRights : IMethod + public sealed partial class Messages_EditChatDefaultBannedRights : IMethod { public InputPeer peer; public ChatBannedRights banned_rights; } [TLDef(0x35A0E062)] - public class Messages_GetEmojiKeywords : IMethod + public sealed partial class Messages_GetEmojiKeywords : IMethod { public string lang_code; } [TLDef(0x1508B6AF)] - public class Messages_GetEmojiKeywordsDifference : IMethod + public sealed partial class Messages_GetEmojiKeywordsDifference : IMethod { public string lang_code; public int from_version; } [TLDef(0x4E9963B2)] - public class Messages_GetEmojiKeywordsLanguages : IMethod + public sealed partial class Messages_GetEmojiKeywordsLanguages : IMethod { public string[] lang_codes; } [TLDef(0xD5B10C26)] - public class Messages_GetEmojiURL : IMethod + public sealed partial class Messages_GetEmojiURL : IMethod { public string lang_code; } [TLDef(0x1BBCF300)] - public class Messages_GetSearchCounters : IMethod + public sealed partial class Messages_GetSearchCounters : IMethod { public Flags flags; public InputPeer peer; @@ -8891,7 +8891,7 @@ namespace TL.Methods } [TLDef(0x198FB446)] - public class Messages_RequestUrlAuth : IMethod + public sealed partial class Messages_RequestUrlAuth : IMethod { public Flags flags; [IfFlag(1)] public InputPeer peer; @@ -8907,7 +8907,7 @@ namespace TL.Methods } [TLDef(0xB12C7125)] - public class Messages_AcceptUrlAuth : IMethod + public sealed partial class Messages_AcceptUrlAuth : IMethod { public Flags flags; [IfFlag(1)] public InputPeer peer; @@ -8924,41 +8924,41 @@ namespace TL.Methods } [TLDef(0x4FACB138)] - public class Messages_HidePeerSettingsBar : IMethod + public sealed partial class Messages_HidePeerSettingsBar : IMethod { public InputPeer peer; } [TLDef(0xF516760B)] - public class Messages_GetScheduledHistory : IMethod + public sealed partial class Messages_GetScheduledHistory : IMethod { public InputPeer peer; public long hash; } [TLDef(0xBDBB0464)] - public class Messages_GetScheduledMessages : IMethod + public sealed partial class Messages_GetScheduledMessages : IMethod { public InputPeer peer; public int[] id; } [TLDef(0xBD38850A)] - public class Messages_SendScheduledMessages : IMethod + public sealed partial class Messages_SendScheduledMessages : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x59AE2B16)] - public class Messages_DeleteScheduledMessages : IMethod + public sealed partial class Messages_DeleteScheduledMessages : IMethod { public InputPeer peer; public int[] id; } [TLDef(0xB86E380E)] - public class Messages_GetPollVotes : IMethod + public sealed partial class Messages_GetPollVotes : IMethod { public Flags flags; public InputPeer peer; @@ -8975,7 +8975,7 @@ namespace TL.Methods } [TLDef(0xB5052FEA)] - public class Messages_ToggleStickerSets : IMethod + public sealed partial class Messages_ToggleStickerSets : IMethod { public Flags flags; public InputStickerSet[] stickersets; @@ -8989,13 +8989,13 @@ namespace TL.Methods } [TLDef(0xEFD48C89)] - public class Messages_GetDialogFilters : IMethod { } + public sealed partial class Messages_GetDialogFilters : IMethod { } [TLDef(0xA29CD42C)] - public class Messages_GetSuggestedDialogFilters : IMethod { } + public sealed partial class Messages_GetSuggestedDialogFilters : IMethod { } [TLDef(0x1AD4A04A)] - public class Messages_UpdateDialogFilter : IMethod + public sealed partial class Messages_UpdateDialogFilter : IMethod { public Flags flags; public int id; @@ -9008,13 +9008,13 @@ namespace TL.Methods } [TLDef(0xC563C1E4)] - public class Messages_UpdateDialogFiltersOrder : IMethod + public sealed partial class Messages_UpdateDialogFiltersOrder : IMethod { public int[] order; } [TLDef(0x7ED094A1)] - public class Messages_GetOldFeaturedStickers : IMethod + public sealed partial class Messages_GetOldFeaturedStickers : IMethod { public int offset; public int limit; @@ -9022,7 +9022,7 @@ namespace TL.Methods } [TLDef(0x22DDD30C)] - public class Messages_GetReplies : IMethod + public sealed partial class Messages_GetReplies : IMethod { public InputPeer peer; public int msg_id; @@ -9036,14 +9036,14 @@ namespace TL.Methods } [TLDef(0x446972FD)] - public class Messages_GetDiscussionMessage : IMethod + public sealed partial class Messages_GetDiscussionMessage : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0xF731A9F4)] - public class Messages_ReadDiscussion : IMethod + public sealed partial class Messages_ReadDiscussion : IMethod { public InputPeer peer; public int msg_id; @@ -9051,7 +9051,7 @@ namespace TL.Methods } [TLDef(0xEE22B9A8)] - public class Messages_UnpinAllMessages : IMethod + public sealed partial class Messages_UnpinAllMessages : IMethod { public Flags flags; public InputPeer peer; @@ -9064,13 +9064,13 @@ namespace TL.Methods } [TLDef(0x5BD0EE50)] - public class Messages_DeleteChat : IMethod + public sealed partial class Messages_DeleteChat : IMethod { public long chat_id; } [TLDef(0xF9CBE409)] - public class Messages_DeletePhoneCallHistory : IMethod + public sealed partial class Messages_DeletePhoneCallHistory : IMethod { public Flags flags; @@ -9081,13 +9081,13 @@ namespace TL.Methods } [TLDef(0x43FE19F3)] - public class Messages_CheckHistoryImport : IMethod + public sealed partial class Messages_CheckHistoryImport : IMethod { public string import_head; } [TLDef(0x34090C3B)] - public class Messages_InitHistoryImport : IMethod + public sealed partial class Messages_InitHistoryImport : IMethod { public InputPeer peer; public InputFileBase file; @@ -9095,7 +9095,7 @@ namespace TL.Methods } [TLDef(0x2A862092)] - public class Messages_UploadImportedMedia : IMethod + public sealed partial class Messages_UploadImportedMedia : IMethod { public InputPeer peer; public long import_id; @@ -9104,14 +9104,14 @@ namespace TL.Methods } [TLDef(0xB43DF344)] - public class Messages_StartHistoryImport : IMethod + public sealed partial class Messages_StartHistoryImport : IMethod { public InputPeer peer; public long import_id; } [TLDef(0xA2B5A3F6)] - public class Messages_GetExportedChatInvites : IMethod + public sealed partial class Messages_GetExportedChatInvites : IMethod { public Flags flags; public InputPeer peer; @@ -9128,14 +9128,14 @@ namespace TL.Methods } [TLDef(0x73746F5C)] - public class Messages_GetExportedChatInvite : IMethod + public sealed partial class Messages_GetExportedChatInvite : IMethod { public InputPeer peer; public string link; } [TLDef(0xBDCA2F75)] - public class Messages_EditExportedChatInvite : IMethod + public sealed partial class Messages_EditExportedChatInvite : IMethod { public Flags flags; public InputPeer peer; @@ -9156,27 +9156,27 @@ namespace TL.Methods } [TLDef(0x56987BD5)] - public class Messages_DeleteRevokedExportedChatInvites : IMethod + public sealed partial class Messages_DeleteRevokedExportedChatInvites : IMethod { public InputPeer peer; public InputUserBase admin_id; } [TLDef(0xD464A42B)] - public class Messages_DeleteExportedChatInvite : IMethod + public sealed partial class Messages_DeleteExportedChatInvite : IMethod { public InputPeer peer; public string link; } [TLDef(0x3920E6EF)] - public class Messages_GetAdminsWithInvites : IMethod + public sealed partial class Messages_GetAdminsWithInvites : IMethod { public InputPeer peer; } [TLDef(0xDF04DD4E)] - public class Messages_GetChatInviteImporters : IMethod + public sealed partial class Messages_GetChatInviteImporters : IMethod { public Flags flags; public InputPeer peer; @@ -9195,34 +9195,34 @@ namespace TL.Methods } [TLDef(0xB80E5FE4)] - public class Messages_SetHistoryTTL : IMethod + public sealed partial class Messages_SetHistoryTTL : IMethod { public InputPeer peer; public int period; } [TLDef(0x5DC60F03)] - public class Messages_CheckHistoryImportPeer : IMethod + public sealed partial class Messages_CheckHistoryImportPeer : IMethod { public InputPeer peer; } [TLDef(0xE63BE13F)] - public class Messages_SetChatTheme : IMethod + public sealed partial class Messages_SetChatTheme : IMethod { public InputPeer peer; public string emoticon; } [TLDef(0x31C1C44F)] - public class Messages_GetMessageReadParticipants : IMethod + public sealed partial class Messages_GetMessageReadParticipants : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0x6AA3F6BD)] - public class Messages_GetSearchResultsCalendar : IMethod + public sealed partial class Messages_GetSearchResultsCalendar : IMethod { public Flags flags; public InputPeer peer; @@ -9238,7 +9238,7 @@ namespace TL.Methods } [TLDef(0x9C7F2F10)] - public class Messages_GetSearchResultsPositions : IMethod + public sealed partial class Messages_GetSearchResultsPositions : IMethod { public Flags flags; public InputPeer peer; @@ -9254,7 +9254,7 @@ namespace TL.Methods } [TLDef(0x7FE7E815)] - public class Messages_HideChatJoinRequest : IMethod + public sealed partial class Messages_HideChatJoinRequest : IMethod { public Flags flags; public InputPeer peer; @@ -9267,7 +9267,7 @@ namespace TL.Methods } [TLDef(0xE085F4EA)] - public class Messages_HideAllChatJoinRequests : IMethod + public sealed partial class Messages_HideAllChatJoinRequests : IMethod { public Flags flags; public InputPeer peer; @@ -9281,21 +9281,21 @@ namespace TL.Methods } [TLDef(0xB11EAFA2)] - public class Messages_ToggleNoForwards : IMethod + public sealed partial class Messages_ToggleNoForwards : IMethod { public InputPeer peer; public bool enabled; } [TLDef(0xCCFDDF96)] - public class Messages_SaveDefaultSendAs : IMethod + public sealed partial class Messages_SaveDefaultSendAs : IMethod { public InputPeer peer; public InputPeer send_as; } [TLDef(0xD30D78D4)] - public class Messages_SendReaction : IMethod + public sealed partial class Messages_SendReaction : IMethod { public Flags flags; public InputPeer peer; @@ -9311,14 +9311,14 @@ namespace TL.Methods } [TLDef(0x8BBA90E6)] - public class Messages_GetMessagesReactions : IMethod + public sealed partial class Messages_GetMessagesReactions : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x461B3F48)] - public class Messages_GetMessageReactionsList : IMethod + public sealed partial class Messages_GetMessageReactionsList : IMethod { public Flags flags; public InputPeer peer; @@ -9335,26 +9335,26 @@ namespace TL.Methods } [TLDef(0xFEB16771)] - public class Messages_SetChatAvailableReactions : IMethod + public sealed partial class Messages_SetChatAvailableReactions : IMethod { public InputPeer peer; public ChatReactions available_reactions; } [TLDef(0x18DEA0AC)] - public class Messages_GetAvailableReactions : IMethod + public sealed partial class Messages_GetAvailableReactions : IMethod { public int hash; } [TLDef(0x4F47A016)] - public class Messages_SetDefaultReaction : IMethod + public sealed partial class Messages_SetDefaultReaction : IMethod { public Reaction reaction; } [TLDef(0x63183030)] - public class Messages_TranslateText : IMethod + public sealed partial class Messages_TranslateText : IMethod { public Flags flags; [IfFlag(0)] public InputPeer peer; @@ -9370,7 +9370,7 @@ namespace TL.Methods } [TLDef(0x3223495B)] - public class Messages_GetUnreadReactions : IMethod + public sealed partial class Messages_GetUnreadReactions : IMethod { public Flags flags; public InputPeer peer; @@ -9388,7 +9388,7 @@ namespace TL.Methods } [TLDef(0x54AA7F8E)] - public class Messages_ReadReactions : IMethod + public sealed partial class Messages_ReadReactions : IMethod { public Flags flags; public InputPeer peer; @@ -9401,7 +9401,7 @@ namespace TL.Methods } [TLDef(0x107E31A0)] - public class Messages_SearchSentMedia : IMethod + public sealed partial class Messages_SearchSentMedia : IMethod { public string q; public MessagesFilter filter; @@ -9409,19 +9409,19 @@ namespace TL.Methods } [TLDef(0x16FCC2CB)] - public class Messages_GetAttachMenuBots : IMethod + public sealed partial class Messages_GetAttachMenuBots : IMethod { public long hash; } [TLDef(0x77216192)] - public class Messages_GetAttachMenuBot : IMethod + public sealed partial class Messages_GetAttachMenuBot : IMethod { public InputUserBase bot; } [TLDef(0x69F59D69)] - public class Messages_ToggleBotInAttachMenu : IMethod + public sealed partial class Messages_ToggleBotInAttachMenu : IMethod { public Flags flags; public InputUserBase bot; @@ -9434,7 +9434,7 @@ namespace TL.Methods } [TLDef(0x269DC2C1)] - public class Messages_RequestWebView : IMethod + public sealed partial class Messages_RequestWebView : IMethod { public Flags flags; public InputPeer peer; @@ -9459,7 +9459,7 @@ namespace TL.Methods } [TLDef(0xB0D81A83)] - public class Messages_ProlongWebView : IMethod + public sealed partial class Messages_ProlongWebView : IMethod { public Flags flags; public InputPeer peer; @@ -9477,7 +9477,7 @@ namespace TL.Methods } [TLDef(0x1A46500A)] - public class Messages_RequestSimpleWebView : IMethod + public sealed partial class Messages_RequestSimpleWebView : IMethod { public Flags flags; public InputUserBase bot; @@ -9497,14 +9497,14 @@ namespace TL.Methods } [TLDef(0x0A4314F5)] - public class Messages_SendWebViewResultMessage : IMethod + public sealed partial class Messages_SendWebViewResultMessage : IMethod { public string bot_query_id; public InputBotInlineResultBase result; } [TLDef(0xDC0242C8)] - public class Messages_SendWebViewData : IMethod + public sealed partial class Messages_SendWebViewData : IMethod { public InputUserBase bot; public long random_id; @@ -9513,14 +9513,14 @@ namespace TL.Methods } [TLDef(0x269E9A49)] - public class Messages_TranscribeAudio : IMethod + public sealed partial class Messages_TranscribeAudio : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0x7F1D072F)] - public class Messages_RateTranscribedAudio : IMethod + public sealed partial class Messages_RateTranscribedAudio : IMethod { public InputPeer peer; public int msg_id; @@ -9529,25 +9529,25 @@ namespace TL.Methods } [TLDef(0xD9AB0F54)] - public class Messages_GetCustomEmojiDocuments : IMethod + public sealed partial class Messages_GetCustomEmojiDocuments : IMethod { public long[] document_id; } [TLDef(0xFBFCA18F)] - public class Messages_GetEmojiStickers : IMethod + public sealed partial class Messages_GetEmojiStickers : IMethod { public long hash; } [TLDef(0x0ECF6736)] - public class Messages_GetFeaturedEmojiStickers : IMethod + public sealed partial class Messages_GetFeaturedEmojiStickers : IMethod { public long hash; } [TLDef(0x3F64C076)] - public class Messages_ReportReaction : IMethod + public sealed partial class Messages_ReportReaction : IMethod { public InputPeer peer; public int id; @@ -9555,40 +9555,40 @@ namespace TL.Methods } [TLDef(0xBB8125BA)] - public class Messages_GetTopReactions : IMethod + public sealed partial class Messages_GetTopReactions : IMethod { public int limit; public long hash; } [TLDef(0x39461DB2)] - public class Messages_GetRecentReactions : IMethod + public sealed partial class Messages_GetRecentReactions : IMethod { public int limit; public long hash; } [TLDef(0x9DFEEFB4)] - public class Messages_ClearRecentReactions : IMethod { } + public sealed partial class Messages_ClearRecentReactions : IMethod { } [TLDef(0x84F80814)] - public class Messages_GetExtendedMedia : IMethod + public sealed partial class Messages_GetExtendedMedia : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x9EB51445)] - public class Messages_SetDefaultHistoryTTL : IMethod + public sealed partial class Messages_SetDefaultHistoryTTL : IMethod { public int period; } [TLDef(0x658B7188)] - public class Messages_GetDefaultHistoryTTL : IMethod { } + public sealed partial class Messages_GetDefaultHistoryTTL : IMethod { } [TLDef(0x91B2D060)] - public class Messages_SendBotRequestedPeer : IMethod + public sealed partial class Messages_SendBotRequestedPeer : IMethod { public InputPeer peer; public int msg_id; @@ -9597,32 +9597,32 @@ namespace TL.Methods } [TLDef(0x7488CE5B)] - public class Messages_GetEmojiGroups : IMethod + public sealed partial class Messages_GetEmojiGroups : IMethod { public int hash; } [TLDef(0x2ECD56CD)] - public class Messages_GetEmojiStatusGroups : IMethod + public sealed partial class Messages_GetEmojiStatusGroups : IMethod { public int hash; } [TLDef(0x21A548F3)] - public class Messages_GetEmojiProfilePhotoGroups : IMethod + public sealed partial class Messages_GetEmojiProfilePhotoGroups : IMethod { public int hash; } [TLDef(0x2C11C0D7)] - public class Messages_SearchCustomEmoji : IMethod + public sealed partial class Messages_SearchCustomEmoji : IMethod { public string emoticon; public long hash; } [TLDef(0xE47CB579)] - public class Messages_TogglePeerTranslations : IMethod + public sealed partial class Messages_TogglePeerTranslations : IMethod { public Flags flags; public InputPeer peer; @@ -9634,14 +9634,14 @@ namespace TL.Methods } [TLDef(0x34FDC5C3)] - public class Messages_GetBotApp : IMethod + public sealed partial class Messages_GetBotApp : IMethod { public InputBotApp app; public long hash; } [TLDef(0x8C5A3B3C)] - public class Messages_RequestAppWebView : IMethod + public sealed partial class Messages_RequestAppWebView : IMethod { public Flags flags; public InputPeer peer; @@ -9659,7 +9659,7 @@ namespace TL.Methods } [TLDef(0x8FFACAE1)] - public class Messages_SetChatWallPaper : IMethod + public sealed partial class Messages_SetChatWallPaper : IMethod { public Flags flags; public InputPeer peer; @@ -9678,7 +9678,7 @@ namespace TL.Methods } [TLDef(0x92B4494C)] - public class Messages_SearchEmojiStickerSets : IMethod + public sealed partial class Messages_SearchEmojiStickerSets : IMethod { public Flags flags; public string q; @@ -9691,7 +9691,7 @@ namespace TL.Methods } [TLDef(0x5381D21A)] - public class Messages_GetSavedDialogs : IMethod + public sealed partial class Messages_GetSavedDialogs : IMethod { public Flags flags; public DateTime offset_date; @@ -9707,7 +9707,7 @@ namespace TL.Methods } [TLDef(0x3D9A414D)] - public class Messages_GetSavedHistory : IMethod + public sealed partial class Messages_GetSavedHistory : IMethod { public InputPeer peer; public int offset_id; @@ -9720,7 +9720,7 @@ namespace TL.Methods } [TLDef(0x6E98102B)] - public class Messages_DeleteSavedHistory : IMethod + public sealed partial class Messages_DeleteSavedHistory : IMethod { public Flags flags; public InputPeer peer; @@ -9736,10 +9736,10 @@ namespace TL.Methods } [TLDef(0xD63D94E0)] - public class Messages_GetPinnedSavedDialogs : IMethod { } + public sealed partial class Messages_GetPinnedSavedDialogs : IMethod { } [TLDef(0xAC81BBDE)] - public class Messages_ToggleSavedDialogPin : IMethod + public sealed partial class Messages_ToggleSavedDialogPin : IMethod { public Flags flags; public InputDialogPeerBase peer; @@ -9751,7 +9751,7 @@ namespace TL.Methods } [TLDef(0x8B716587)] - public class Messages_ReorderPinnedSavedDialogs : IMethod + public sealed partial class Messages_ReorderPinnedSavedDialogs : IMethod { public Flags flags; public InputDialogPeerBase[] order; @@ -9763,7 +9763,7 @@ namespace TL.Methods } [TLDef(0x3637E05B)] - public class Messages_GetSavedReactionTags : IMethod + public sealed partial class Messages_GetSavedReactionTags : IMethod { public Flags flags; [IfFlag(0)] public InputPeer peer; @@ -9776,7 +9776,7 @@ namespace TL.Methods } [TLDef(0x60297DEC)] - public class Messages_UpdateSavedReactionTag : IMethod + public sealed partial class Messages_UpdateSavedReactionTag : IMethod { public Flags flags; public Reaction reaction; @@ -9789,51 +9789,51 @@ namespace TL.Methods } [TLDef(0xBDF93428)] - public class Messages_GetDefaultTagReactions : IMethod + public sealed partial class Messages_GetDefaultTagReactions : IMethod { public long hash; } [TLDef(0x8C4BFE5D)] - public class Messages_GetOutboxReadDate : IMethod + public sealed partial class Messages_GetOutboxReadDate : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0xD483F2A8)] - public class Messages_GetQuickReplies : IMethod + public sealed partial class Messages_GetQuickReplies : IMethod { public long hash; } [TLDef(0x60331907)] - public class Messages_ReorderQuickReplies : IMethod + public sealed partial class Messages_ReorderQuickReplies : IMethod { public int[] order; } [TLDef(0xF1D0FBD3)] - public class Messages_CheckQuickReplyShortcut : IMethod + public sealed partial class Messages_CheckQuickReplyShortcut : IMethod { public string shortcut; } [TLDef(0x5C003CEF)] - public class Messages_EditQuickReplyShortcut : IMethod + public sealed partial class Messages_EditQuickReplyShortcut : IMethod { public int shortcut_id; public string shortcut; } [TLDef(0x3CC04740)] - public class Messages_DeleteQuickReplyShortcut : IMethod + public sealed partial class Messages_DeleteQuickReplyShortcut : IMethod { public int shortcut_id; } [TLDef(0x94A495C3)] - public class Messages_GetQuickReplyMessages : IMethod + public sealed partial class Messages_GetQuickReplyMessages : IMethod { public Flags flags; public int shortcut_id; @@ -9847,30 +9847,30 @@ namespace TL.Methods } [TLDef(0x33153AD4)] - public class Messages_SendQuickReplyMessages : IMethod + public sealed partial class Messages_SendQuickReplyMessages : IMethod { public InputPeer peer; public int shortcut_id; } [TLDef(0xE105E910)] - public class Messages_DeleteQuickReplyMessages : IMethod + public sealed partial class Messages_DeleteQuickReplyMessages : IMethod { public int shortcut_id; public int[] id; } [TLDef(0xFD2DDA49)] - public class Messages_ToggleDialogFilterTags : IMethod + public sealed partial class Messages_ToggleDialogFilterTags : IMethod { public bool enabled; } [TLDef(0xEDD4882A)] - public class Updates_GetState : IMethod { } + public sealed partial class Updates_GetState : IMethod { } [TLDef(0x19C2F763)] - public class Updates_GetDifference : IMethod + public sealed partial class Updates_GetDifference : IMethod { public Flags flags; public int pts; @@ -9889,7 +9889,7 @@ namespace TL.Methods } [TLDef(0x03173D78)] - public class Updates_GetChannelDifference : IMethod + public sealed partial class Updates_GetChannelDifference : IMethod { public Flags flags; public InputChannelBase channel; @@ -9904,7 +9904,7 @@ namespace TL.Methods } [TLDef(0x09E82039)] - public class Photos_UpdateProfilePhoto : IMethod + public sealed partial class Photos_UpdateProfilePhoto : IMethod { public Flags flags; [IfFlag(1)] public InputUserBase bot; @@ -9918,7 +9918,7 @@ namespace TL.Methods } [TLDef(0x0388A3B5)] - public class Photos_UploadProfilePhoto : IMethod + public sealed partial class Photos_UploadProfilePhoto : IMethod { public Flags flags; [IfFlag(5)] public InputUserBase bot; @@ -9939,13 +9939,13 @@ namespace TL.Methods } [TLDef(0x87CF7F2F)] - public class Photos_DeletePhotos : IMethod + public sealed partial class Photos_DeletePhotos : IMethod { public InputPhoto[] id; } [TLDef(0x91CD32A8)] - public class Photos_GetUserPhotos : IMethod + public sealed partial class Photos_GetUserPhotos : IMethod { public InputUserBase user_id; public int offset; @@ -9954,7 +9954,7 @@ namespace TL.Methods } [TLDef(0xE14C4A71)] - public class Photos_UploadContactProfilePhoto : IMethod + public sealed partial class Photos_UploadContactProfilePhoto : IMethod { public Flags flags; public InputUserBase user_id; @@ -9975,7 +9975,7 @@ namespace TL.Methods } [TLDef(0xB304A621)] - public class Upload_SaveFilePart : IMethod + public sealed partial class Upload_SaveFilePart : IMethod { public long file_id; public int file_part; @@ -9983,7 +9983,7 @@ namespace TL.Methods } [TLDef(0xBE5335BE)] - public class Upload_GetFile : IMethod + public sealed partial class Upload_GetFile : IMethod { public Flags flags; public InputFileLocationBase location; @@ -9998,7 +9998,7 @@ namespace TL.Methods } [TLDef(0xDE7B673D)] - public class Upload_SaveBigFilePart : IMethod + public sealed partial class Upload_SaveBigFilePart : IMethod { public long file_id; public int file_part; @@ -10007,7 +10007,7 @@ namespace TL.Methods } [TLDef(0x24E6818D)] - public class Upload_GetWebFile : IMethod + public sealed partial class Upload_GetWebFile : IMethod { public InputWebFileLocationBase location; public int offset; @@ -10015,7 +10015,7 @@ namespace TL.Methods } [TLDef(0x395F69DA)] - public class Upload_GetCdnFile : IMethod + public sealed partial class Upload_GetCdnFile : IMethod { public byte[] file_token; public long offset; @@ -10023,104 +10023,104 @@ namespace TL.Methods } [TLDef(0x9B2754A8)] - public class Upload_ReuploadCdnFile : IMethod + public sealed partial class Upload_ReuploadCdnFile : IMethod { public byte[] file_token; public byte[] request_token; } [TLDef(0x91DC3F31)] - public class Upload_GetCdnFileHashes : IMethod + public sealed partial class Upload_GetCdnFileHashes : IMethod { public byte[] file_token; public long offset; } [TLDef(0x9156982A)] - public class Upload_GetFileHashes : IMethod + public sealed partial class Upload_GetFileHashes : IMethod { public InputFileLocationBase location; public long offset; } [TLDef(0xC4F9186B)] - public class Help_GetConfig : IMethod { } + public sealed partial class Help_GetConfig : IMethod { } [TLDef(0x1FB33026)] - public class Help_GetNearestDc : IMethod { } + public sealed partial class Help_GetNearestDc : IMethod { } [TLDef(0x522D5A7D)] - public class Help_GetAppUpdate : IMethod + public sealed partial class Help_GetAppUpdate : IMethod { public string source; } [TLDef(0x4D392343)] - public class Help_GetInviteText : IMethod { } + public sealed partial class Help_GetInviteText : IMethod { } [TLDef(0x9CDF08CD)] - public class Help_GetSupport : IMethod { } + public sealed partial class Help_GetSupport : IMethod { } [TLDef(0xEC22CFCD)] - public class Help_SetBotUpdatesStatus : IMethod + public sealed partial class Help_SetBotUpdatesStatus : IMethod { public int pending_updates_count; public string message; } [TLDef(0x52029342)] - public class Help_GetCdnConfig : IMethod { } + public sealed partial class Help_GetCdnConfig : IMethod { } [TLDef(0x3DC0F114)] - public class Help_GetRecentMeUrls : IMethod + public sealed partial class Help_GetRecentMeUrls : IMethod { public string referer; } [TLDef(0x2CA51FD1)] - public class Help_GetTermsOfServiceUpdate : IMethod { } + public sealed partial class Help_GetTermsOfServiceUpdate : IMethod { } [TLDef(0xEE72F79A)] - public class Help_AcceptTermsOfService : IMethod + public sealed partial class Help_AcceptTermsOfService : IMethod { public DataJSON id; } [TLDef(0x3FEDC75F)] - public class Help_GetDeepLinkInfo : IMethod + public sealed partial class Help_GetDeepLinkInfo : IMethod { public string path; } [TLDef(0x61E3F854)] - public class Help_GetAppConfig : IMethod + public sealed partial class Help_GetAppConfig : IMethod { public int hash; } [TLDef(0x6F02F748)] - public class Help_SaveAppLog : IMethod + public sealed partial class Help_SaveAppLog : IMethod { public InputAppEvent[] events; } [TLDef(0xC661AD08)] - public class Help_GetPassportConfig : IMethod + public sealed partial class Help_GetPassportConfig : IMethod { public int hash; } [TLDef(0xD360E72C)] - public class Help_GetSupportName : IMethod { } + public sealed partial class Help_GetSupportName : IMethod { } [TLDef(0x038A08D3)] - public class Help_GetUserInfo : IMethod + public sealed partial class Help_GetUserInfo : IMethod { public InputUserBase user_id; } [TLDef(0x66B91B70)] - public class Help_EditUserInfo : IMethod + public sealed partial class Help_EditUserInfo : IMethod { public InputUserBase user_id; public string message; @@ -10128,65 +10128,65 @@ namespace TL.Methods } [TLDef(0xC0977421)] - public class Help_GetPromoData : IMethod { } + public sealed partial class Help_GetPromoData : IMethod { } [TLDef(0x1E251C95)] - public class Help_HidePromoData : IMethod + public sealed partial class Help_HidePromoData : IMethod { public InputPeer peer; } [TLDef(0xF50DBAA1)] - public class Help_DismissSuggestion : IMethod + public sealed partial class Help_DismissSuggestion : IMethod { public InputPeer peer; public string suggestion; } [TLDef(0x735787A8)] - public class Help_GetCountriesList : IMethod + public sealed partial class Help_GetCountriesList : IMethod { public string lang_code; public int hash; } [TLDef(0xB81B93D4)] - public class Help_GetPremiumPromo : IMethod { } + public sealed partial class Help_GetPremiumPromo : IMethod { } [TLDef(0xDA80F42F)] - public class Help_GetPeerColors : IMethod + public sealed partial class Help_GetPeerColors : IMethod { public int hash; } [TLDef(0xABCFA9FD)] - public class Help_GetPeerProfileColors : IMethod + public sealed partial class Help_GetPeerProfileColors : IMethod { public int hash; } [TLDef(0x49B30240)] - public class Help_GetTimezonesList : IMethod + public sealed partial class Help_GetTimezonesList : IMethod { public int hash; } [TLDef(0xCC104937)] - public class Channels_ReadHistory : IMethod + public sealed partial class Channels_ReadHistory : IMethod { public InputChannelBase channel; public int max_id; } [TLDef(0x84C1FD4E)] - public class Channels_DeleteMessages : IMethod + public sealed partial class Channels_DeleteMessages : IMethod { public InputChannelBase channel; public int[] id; } [TLDef(0xF44A8315)] - public class Channels_ReportSpam : IMethod + public sealed partial class Channels_ReportSpam : IMethod { public InputChannelBase channel; public InputPeer participant; @@ -10194,14 +10194,14 @@ namespace TL.Methods } [TLDef(0xAD8C9A23)] - public class Channels_GetMessages : IMethod + public sealed partial class Channels_GetMessages : IMethod { public InputChannelBase channel; public InputMessage[] id; } [TLDef(0x77CED9D0)] - public class Channels_GetParticipants : IMethod + public sealed partial class Channels_GetParticipants : IMethod { public InputChannelBase channel; public ChannelParticipantsFilter filter; @@ -10211,26 +10211,26 @@ namespace TL.Methods } [TLDef(0xA0AB6CC6)] - public class Channels_GetParticipant : IMethod + public sealed partial class Channels_GetParticipant : IMethod { public InputChannelBase channel; public InputPeer participant; } [TLDef(0x0A7F6BBB)] - public class Channels_GetChannels : IMethod + public sealed partial class Channels_GetChannels : IMethod { public InputChannelBase[] id; } [TLDef(0x08736A09)] - public class Channels_GetFullChannel : IMethod + public sealed partial class Channels_GetFullChannel : IMethod { public InputChannelBase channel; } [TLDef(0x91006707)] - public class Channels_CreateChannel : IMethod + public sealed partial class Channels_CreateChannel : IMethod { public Flags flags; public string title; @@ -10251,7 +10251,7 @@ namespace TL.Methods } [TLDef(0xD33C8902)] - public class Channels_EditAdmin : IMethod + public sealed partial class Channels_EditAdmin : IMethod { public InputChannelBase channel; public InputUserBase user_id; @@ -10260,60 +10260,60 @@ namespace TL.Methods } [TLDef(0x566DECD0)] - public class Channels_EditTitle : IMethod + public sealed partial class Channels_EditTitle : IMethod { public InputChannelBase channel; public string title; } [TLDef(0xF12E57C9)] - public class Channels_EditPhoto : IMethod + public sealed partial class Channels_EditPhoto : IMethod { public InputChannelBase channel; public InputChatPhotoBase photo; } [TLDef(0x10E6BD2C)] - public class Channels_CheckUsername : IMethod + public sealed partial class Channels_CheckUsername : IMethod { public InputChannelBase channel; public string username; } [TLDef(0x3514B3DE)] - public class Channels_UpdateUsername : IMethod + public sealed partial class Channels_UpdateUsername : IMethod { public InputChannelBase channel; public string username; } [TLDef(0x24B524C5)] - public class Channels_JoinChannel : IMethod + public sealed partial class Channels_JoinChannel : IMethod { public InputChannelBase channel; } [TLDef(0xF836AA95)] - public class Channels_LeaveChannel : IMethod + public sealed partial class Channels_LeaveChannel : IMethod { public InputChannelBase channel; } [TLDef(0x199F3A6C)] - public class Channels_InviteToChannel : IMethod + public sealed partial class Channels_InviteToChannel : IMethod { public InputChannelBase channel; public InputUserBase[] users; } [TLDef(0xC0111FE3)] - public class Channels_DeleteChannel : IMethod + public sealed partial class Channels_DeleteChannel : IMethod { public InputChannelBase channel; } [TLDef(0xE63FADEB)] - public class Channels_ExportMessageLink : IMethod + public sealed partial class Channels_ExportMessageLink : IMethod { public Flags flags; public InputChannelBase channel; @@ -10327,14 +10327,14 @@ namespace TL.Methods } [TLDef(0x1F69B606)] - public class Channels_ToggleSignatures : IMethod + public sealed partial class Channels_ToggleSignatures : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0xF8B036AF)] - public class Channels_GetAdminedPublicChannels : IMethod + public sealed partial class Channels_GetAdminedPublicChannels : IMethod { public Flags flags; @@ -10346,7 +10346,7 @@ namespace TL.Methods } [TLDef(0x96E6CD81)] - public class Channels_EditBanned : IMethod + public sealed partial class Channels_EditBanned : IMethod { public InputChannelBase channel; public InputPeer participant; @@ -10354,7 +10354,7 @@ namespace TL.Methods } [TLDef(0x33DDF480)] - public class Channels_GetAdminLog : IMethod + public sealed partial class Channels_GetAdminLog : IMethod { public Flags flags; public InputChannelBase channel; @@ -10373,21 +10373,21 @@ namespace TL.Methods } [TLDef(0xEA8CA4F9)] - public class Channels_SetStickers : IMethod + public sealed partial class Channels_SetStickers : IMethod { public InputChannelBase channel; public InputStickerSet stickerset; } [TLDef(0xEAB5DC38)] - public class Channels_ReadMessageContents : IMethod + public sealed partial class Channels_ReadMessageContents : IMethod { public InputChannelBase channel; public int[] id; } [TLDef(0x9BAA9647)] - public class Channels_DeleteHistory : IMethod + public sealed partial class Channels_DeleteHistory : IMethod { public Flags flags; public InputChannelBase channel; @@ -10400,30 +10400,30 @@ namespace TL.Methods } [TLDef(0xEABBB94C)] - public class Channels_TogglePreHistoryHidden : IMethod + public sealed partial class Channels_TogglePreHistoryHidden : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0x8341ECC0)] - public class Channels_GetLeftChannels : IMethod + public sealed partial class Channels_GetLeftChannels : IMethod { public int offset; } [TLDef(0xF5DAD378)] - public class Channels_GetGroupsForDiscussion : IMethod { } + public sealed partial class Channels_GetGroupsForDiscussion : IMethod { } [TLDef(0x40582BB2)] - public class Channels_SetDiscussionGroup : IMethod + public sealed partial class Channels_SetDiscussionGroup : IMethod { public InputChannelBase broadcast; public InputChannelBase group; } [TLDef(0x8F38CD1F)] - public class Channels_EditCreator : IMethod + public sealed partial class Channels_EditCreator : IMethod { public InputChannelBase channel; public InputUserBase user_id; @@ -10431,7 +10431,7 @@ namespace TL.Methods } [TLDef(0x58E63F6D)] - public class Channels_EditLocation : IMethod + public sealed partial class Channels_EditLocation : IMethod { public InputChannelBase channel; public InputGeoPoint geo_point; @@ -10439,70 +10439,70 @@ namespace TL.Methods } [TLDef(0xEDD49EF0)] - public class Channels_ToggleSlowMode : IMethod + public sealed partial class Channels_ToggleSlowMode : IMethod { public InputChannelBase channel; public int seconds; } [TLDef(0x11E831EE)] - public class Channels_GetInactiveChannels : IMethod { } + public sealed partial class Channels_GetInactiveChannels : IMethod { } [TLDef(0x0B290C69)] - public class Channels_ConvertToGigagroup : IMethod + public sealed partial class Channels_ConvertToGigagroup : IMethod { public InputChannelBase channel; } [TLDef(0xBEAEDB94)] - public class Channels_ViewSponsoredMessage : IMethod + public sealed partial class Channels_ViewSponsoredMessage : IMethod { public InputChannelBase channel; public byte[] random_id; } [TLDef(0xEC210FBF)] - public class Channels_GetSponsoredMessages : IMethod + public sealed partial class Channels_GetSponsoredMessages : IMethod { public InputChannelBase channel; } [TLDef(0x0DC770EE)] - public class Channels_GetSendAs : IMethod + public sealed partial class Channels_GetSendAs : IMethod { public InputPeer peer; } [TLDef(0x367544DB)] - public class Channels_DeleteParticipantHistory : IMethod + public sealed partial class Channels_DeleteParticipantHistory : IMethod { public InputChannelBase channel; public InputPeer participant; } [TLDef(0xE4CB9580)] - public class Channels_ToggleJoinToSend : IMethod + public sealed partial class Channels_ToggleJoinToSend : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0x4C2985B6)] - public class Channels_ToggleJoinRequest : IMethod + public sealed partial class Channels_ToggleJoinRequest : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0xB45CED1D)] - public class Channels_ReorderUsernames : IMethod + public sealed partial class Channels_ReorderUsernames : IMethod { public InputChannelBase channel; public string[] order; } [TLDef(0x50F24105)] - public class Channels_ToggleUsername : IMethod + public sealed partial class Channels_ToggleUsername : IMethod { public InputChannelBase channel; public string username; @@ -10510,20 +10510,20 @@ namespace TL.Methods } [TLDef(0x0A245DD3)] - public class Channels_DeactivateAllUsernames : IMethod + public sealed partial class Channels_DeactivateAllUsernames : IMethod { public InputChannelBase channel; } [TLDef(0xA4298B29)] - public class Channels_ToggleForum : IMethod + public sealed partial class Channels_ToggleForum : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0xF40C0224)] - public class Channels_CreateForumTopic : IMethod + public sealed partial class Channels_CreateForumTopic : IMethod { public Flags flags; public InputChannelBase channel; @@ -10542,7 +10542,7 @@ namespace TL.Methods } [TLDef(0x0DE560D1)] - public class Channels_GetForumTopics : IMethod + public sealed partial class Channels_GetForumTopics : IMethod { public Flags flags; public InputChannelBase channel; @@ -10559,14 +10559,14 @@ namespace TL.Methods } [TLDef(0xB0831EB9)] - public class Channels_GetForumTopicsByID : IMethod + public sealed partial class Channels_GetForumTopicsByID : IMethod { public InputChannelBase channel; public int[] topics; } [TLDef(0xF4DFA185)] - public class Channels_EditForumTopic : IMethod + public sealed partial class Channels_EditForumTopic : IMethod { public Flags flags; public InputChannelBase channel; @@ -10586,7 +10586,7 @@ namespace TL.Methods } [TLDef(0x6C2D9026)] - public class Channels_UpdatePinnedForumTopic : IMethod + public sealed partial class Channels_UpdatePinnedForumTopic : IMethod { public InputChannelBase channel; public int topic_id; @@ -10594,14 +10594,14 @@ namespace TL.Methods } [TLDef(0x34435F2D)] - public class Channels_DeleteTopicHistory : IMethod + public sealed partial class Channels_DeleteTopicHistory : IMethod { public InputChannelBase channel; public int top_msg_id; } [TLDef(0x2950A18F)] - public class Channels_ReorderPinnedForumTopics : IMethod + public sealed partial class Channels_ReorderPinnedForumTopics : IMethod { public Flags flags; public InputChannelBase channel; @@ -10614,35 +10614,35 @@ namespace TL.Methods } [TLDef(0x68F3E4EB)] - public class Channels_ToggleAntiSpam : IMethod + public sealed partial class Channels_ToggleAntiSpam : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0xA850A693)] - public class Channels_ReportAntiSpamFalsePositive : IMethod + public sealed partial class Channels_ReportAntiSpamFalsePositive : IMethod { public InputChannelBase channel; public int msg_id; } [TLDef(0x6A6E7854)] - public class Channels_ToggleParticipantsHidden : IMethod + public sealed partial class Channels_ToggleParticipantsHidden : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0x18AFBC93)] - public class Channels_ClickSponsoredMessage : IMethod + public sealed partial class Channels_ClickSponsoredMessage : IMethod { public InputChannelBase channel; public byte[] random_id; } [TLDef(0xD8AA3671)] - public class Channels_UpdateColor : IMethod + public sealed partial class Channels_UpdateColor : IMethod { public Flags flags; public InputChannelBase channel; @@ -10658,55 +10658,55 @@ namespace TL.Methods } [TLDef(0x9738BB15)] - public class Channels_ToggleViewForumAsMessages : IMethod + public sealed partial class Channels_ToggleViewForumAsMessages : IMethod { public InputChannelBase channel; public bool enabled; } [TLDef(0x83B70D97)] - public class Channels_GetChannelRecommendations : IMethod + public sealed partial class Channels_GetChannelRecommendations : IMethod { public InputChannelBase channel; } [TLDef(0xF0D3E6A8)] - public class Channels_UpdateEmojiStatus : IMethod + public sealed partial class Channels_UpdateEmojiStatus : IMethod { public InputChannelBase channel; public EmojiStatus emoji_status; } [TLDef(0xAD399CEE)] - public class Channels_SetBoostsToUnblockRestrictions : IMethod + public sealed partial class Channels_SetBoostsToUnblockRestrictions : IMethod { public InputChannelBase channel; public int boosts; } [TLDef(0x3CD930B7)] - public class Channels_SetEmojiStickers : IMethod + public sealed partial class Channels_SetEmojiStickers : IMethod { public InputChannelBase channel; public InputStickerSet stickerset; } [TLDef(0xAA2769ED)] - public class Bots_SendCustomRequest : IMethod + public sealed partial class Bots_SendCustomRequest : IMethod { public string custom_method; public DataJSON params_; } [TLDef(0xE6213F4D)] - public class Bots_AnswerWebhookJSONQuery : IMethod + public sealed partial class Bots_AnswerWebhookJSONQuery : IMethod { public long query_id; public DataJSON data; } [TLDef(0x0517165A)] - public class Bots_SetBotCommands : IMethod + public sealed partial class Bots_SetBotCommands : IMethod { public BotCommandScope scope; public string lang_code; @@ -10714,46 +10714,46 @@ namespace TL.Methods } [TLDef(0x3D8DE0F9)] - public class Bots_ResetBotCommands : IMethod + public sealed partial class Bots_ResetBotCommands : IMethod { public BotCommandScope scope; public string lang_code; } [TLDef(0xE34C0DD6)] - public class Bots_GetBotCommands : IMethod + public sealed partial class Bots_GetBotCommands : IMethod { public BotCommandScope scope; public string lang_code; } [TLDef(0x4504D54F)] - public class Bots_SetBotMenuButton : IMethod + public sealed partial class Bots_SetBotMenuButton : IMethod { public InputUserBase user_id; public BotMenuButtonBase button; } [TLDef(0x9C60EB28)] - public class Bots_GetBotMenuButton : IMethod + public sealed partial class Bots_GetBotMenuButton : IMethod { public InputUserBase user_id; } [TLDef(0x788464E1)] - public class Bots_SetBotBroadcastDefaultAdminRights : IMethod + public sealed partial class Bots_SetBotBroadcastDefaultAdminRights : IMethod { public ChatAdminRights admin_rights; } [TLDef(0x925EC9EA)] - public class Bots_SetBotGroupDefaultAdminRights : IMethod + public sealed partial class Bots_SetBotGroupDefaultAdminRights : IMethod { public ChatAdminRights admin_rights; } [TLDef(0x10CF3123)] - public class Bots_SetBotInfo : IMethod + public sealed partial class Bots_SetBotInfo : IMethod { public Flags flags; [IfFlag(2)] public InputUserBase bot; @@ -10772,7 +10772,7 @@ namespace TL.Methods } [TLDef(0xDCD914FD)] - public class Bots_GetBotInfo : IMethod + public sealed partial class Bots_GetBotInfo : IMethod { public Flags flags; [IfFlag(0)] public InputUserBase bot; @@ -10785,14 +10785,14 @@ namespace TL.Methods } [TLDef(0x9709B1C2)] - public class Bots_ReorderUsernames : IMethod + public sealed partial class Bots_ReorderUsernames : IMethod { public InputUserBase bot; public string[] order; } [TLDef(0x053CA973)] - public class Bots_ToggleUsername : IMethod + public sealed partial class Bots_ToggleUsername : IMethod { public InputUserBase bot; public string username; @@ -10800,19 +10800,19 @@ namespace TL.Methods } [TLDef(0x1359F4E6)] - public class Bots_CanSendMessage : IMethod + public sealed partial class Bots_CanSendMessage : IMethod { public InputUserBase bot; } [TLDef(0xF132E3EF)] - public class Bots_AllowSendMessage : IMethod + public sealed partial class Bots_AllowSendMessage : IMethod { public InputUserBase bot; } [TLDef(0x087FC5E7)] - public class Bots_InvokeWebViewCustomMethod : IMethod + public sealed partial class Bots_InvokeWebViewCustomMethod : IMethod { public InputUserBase bot; public string custom_method; @@ -10820,7 +10820,7 @@ namespace TL.Methods } [TLDef(0x37148DBB)] - public class Payments_GetPaymentForm : IMethod + public sealed partial class Payments_GetPaymentForm : IMethod { public Flags flags; public InputInvoice invoice; @@ -10833,14 +10833,14 @@ namespace TL.Methods } [TLDef(0x2478D1CC)] - public class Payments_GetPaymentReceipt : IMethod + public sealed partial class Payments_GetPaymentReceipt : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0xB6C8F12B)] - public class Payments_ValidateRequestedInfo : IMethod + public sealed partial class Payments_ValidateRequestedInfo : IMethod { public Flags flags; public InputInvoice invoice; @@ -10853,7 +10853,7 @@ namespace TL.Methods } [TLDef(0x2D03522F)] - public class Payments_SendPaymentForm : IMethod + public sealed partial class Payments_SendPaymentForm : IMethod { public Flags flags; public long form_id; @@ -10872,10 +10872,10 @@ namespace TL.Methods } [TLDef(0x227D824B)] - public class Payments_GetSavedInfo : IMethod { } + public sealed partial class Payments_GetSavedInfo : IMethod { } [TLDef(0xD83D70C1)] - public class Payments_ClearSavedInfo : IMethod + public sealed partial class Payments_ClearSavedInfo : IMethod { public Flags flags; @@ -10887,39 +10887,39 @@ namespace TL.Methods } [TLDef(0x2E79D779)] - public class Payments_GetBankCardData : IMethod + public sealed partial class Payments_GetBankCardData : IMethod { public string number; } [TLDef(0x0F91B065)] - public class Payments_ExportInvoice : IMethod + public sealed partial class Payments_ExportInvoice : IMethod { public InputMedia invoice_media; } [TLDef(0x80ED747D)] - public class Payments_AssignAppStoreTransaction : IMethod + public sealed partial class Payments_AssignAppStoreTransaction : IMethod { public byte[] receipt; public InputStorePaymentPurpose purpose; } [TLDef(0xDFFD50D3)] - public class Payments_AssignPlayMarketTransaction : IMethod + public sealed partial class Payments_AssignPlayMarketTransaction : IMethod { public DataJSON receipt; public InputStorePaymentPurpose purpose; } [TLDef(0x9FC19EB6)] - public class Payments_CanPurchasePremium : IMethod + public sealed partial class Payments_CanPurchasePremium : IMethod { public InputStorePaymentPurpose purpose; } [TLDef(0x2757BA54)] - public class Payments_GetPremiumGiftCodeOptions : IMethod + public sealed partial class Payments_GetPremiumGiftCodeOptions : IMethod { public Flags flags; [IfFlag(0)] public InputPeer boost_peer; @@ -10931,26 +10931,26 @@ namespace TL.Methods } [TLDef(0x8E51B4C1)] - public class Payments_CheckGiftCode : IMethod + public sealed partial class Payments_CheckGiftCode : IMethod { public string slug; } [TLDef(0xF6E26854)] - public class Payments_ApplyGiftCode : IMethod + public sealed partial class Payments_ApplyGiftCode : IMethod { public string slug; } [TLDef(0xF4239425)] - public class Payments_GetGiveawayInfo : IMethod + public sealed partial class Payments_GetGiveawayInfo : IMethod { public InputPeer peer; public int msg_id; } [TLDef(0x5FF58F20)] - public class Payments_LaunchPrepaidGiveaway : IMethod + public sealed partial class Payments_LaunchPrepaidGiveaway : IMethod { public InputPeer peer; public long giveaway_id; @@ -10958,7 +10958,7 @@ namespace TL.Methods } [TLDef(0x9021AB67)] - public class Stickers_CreateStickerSet : IMethod + public sealed partial class Stickers_CreateStickerSet : IMethod { public Flags flags; public InputUserBase user_id; @@ -10981,27 +10981,27 @@ namespace TL.Methods } [TLDef(0xF7760F51)] - public class Stickers_RemoveStickerFromSet : IMethod + public sealed partial class Stickers_RemoveStickerFromSet : IMethod { public InputDocument sticker; } [TLDef(0xFFB6D4CA)] - public class Stickers_ChangeStickerPosition : IMethod + public sealed partial class Stickers_ChangeStickerPosition : IMethod { public InputDocument sticker; public int position; } [TLDef(0x8653FEBE)] - public class Stickers_AddStickerToSet : IMethod + public sealed partial class Stickers_AddStickerToSet : IMethod { public InputStickerSet stickerset; public InputStickerSetItem sticker; } [TLDef(0xA76A5392)] - public class Stickers_SetStickerSetThumb : IMethod + public sealed partial class Stickers_SetStickerSetThumb : IMethod { public Flags flags; public InputStickerSet stickerset; @@ -11016,19 +11016,19 @@ namespace TL.Methods } [TLDef(0x284B3639)] - public class Stickers_CheckShortName : IMethod + public sealed partial class Stickers_CheckShortName : IMethod { public string short_name; } [TLDef(0x4DAFC503)] - public class Stickers_SuggestShortName : IMethod + public sealed partial class Stickers_SuggestShortName : IMethod { public string title; } [TLDef(0xF5537EBC)] - public class Stickers_ChangeSticker : IMethod + public sealed partial class Stickers_ChangeSticker : IMethod { public Flags flags; public InputDocument sticker; @@ -11045,23 +11045,23 @@ namespace TL.Methods } [TLDef(0x124B1C00)] - public class Stickers_RenameStickerSet : IMethod + public sealed partial class Stickers_RenameStickerSet : IMethod { public InputStickerSet stickerset; public string title; } [TLDef(0x87704394)] - public class Stickers_DeleteStickerSet : IMethod + public sealed partial class Stickers_DeleteStickerSet : IMethod { public InputStickerSet stickerset; } [TLDef(0x55451FA9)] - public class Phone_GetCallConfig : IMethod { } + public sealed partial class Phone_GetCallConfig : IMethod { } [TLDef(0x42FF96ED)] - public class Phone_RequestCall : IMethod + public sealed partial class Phone_RequestCall : IMethod { public Flags flags; public InputUserBase user_id; @@ -11076,7 +11076,7 @@ namespace TL.Methods } [TLDef(0x3BD2B4A0)] - public class Phone_AcceptCall : IMethod + public sealed partial class Phone_AcceptCall : IMethod { public InputPhoneCall peer; public byte[] g_b; @@ -11084,7 +11084,7 @@ namespace TL.Methods } [TLDef(0x2EFE1722)] - public class Phone_ConfirmCall : IMethod + public sealed partial class Phone_ConfirmCall : IMethod { public InputPhoneCall peer; public byte[] g_a; @@ -11093,13 +11093,13 @@ namespace TL.Methods } [TLDef(0x17D54F61)] - public class Phone_ReceivedCall : IMethod + public sealed partial class Phone_ReceivedCall : IMethod { public InputPhoneCall peer; } [TLDef(0xB2CBC1C0)] - public class Phone_DiscardCall : IMethod + public sealed partial class Phone_DiscardCall : IMethod { public Flags flags; public InputPhoneCall peer; @@ -11114,7 +11114,7 @@ namespace TL.Methods } [TLDef(0x59EAD627)] - public class Phone_SetCallRating : IMethod + public sealed partial class Phone_SetCallRating : IMethod { public Flags flags; public InputPhoneCall peer; @@ -11128,21 +11128,21 @@ namespace TL.Methods } [TLDef(0x277ADD7E)] - public class Phone_SaveCallDebug : IMethod + public sealed partial class Phone_SaveCallDebug : IMethod { public InputPhoneCall peer; public DataJSON debug; } [TLDef(0xFF7A9383)] - public class Phone_SendSignalingData : IMethod + public sealed partial class Phone_SendSignalingData : IMethod { public InputPhoneCall peer; public byte[] data; } [TLDef(0x48CDC6D8)] - public class Phone_CreateGroupCall : IMethod + public sealed partial class Phone_CreateGroupCall : IMethod { public Flags flags; public InputPeer peer; @@ -11159,7 +11159,7 @@ namespace TL.Methods } [TLDef(0xB132FF7B)] - public class Phone_JoinGroupCall : IMethod + public sealed partial class Phone_JoinGroupCall : IMethod { public Flags flags; public InputGroupCall call; @@ -11176,27 +11176,27 @@ namespace TL.Methods } [TLDef(0x500377F9)] - public class Phone_LeaveGroupCall : IMethod + public sealed partial class Phone_LeaveGroupCall : IMethod { public InputGroupCall call; public int source; } [TLDef(0x7B393160)] - public class Phone_InviteToGroupCall : IMethod + public sealed partial class Phone_InviteToGroupCall : IMethod { public InputGroupCall call; public InputUserBase[] users; } [TLDef(0x7A777135)] - public class Phone_DiscardGroupCall : IMethod + public sealed partial class Phone_DiscardGroupCall : IMethod { public InputGroupCall call; } [TLDef(0x74BBB43D)] - public class Phone_ToggleGroupCallSettings : IMethod + public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; public InputGroupCall call; @@ -11210,14 +11210,14 @@ namespace TL.Methods } [TLDef(0x041845DB)] - public class Phone_GetGroupCall : IMethod + public sealed partial class Phone_GetGroupCall : IMethod { public InputGroupCall call; public int limit; } [TLDef(0xC558D8AB)] - public class Phone_GetGroupParticipants : IMethod + public sealed partial class Phone_GetGroupParticipants : IMethod { public InputGroupCall call; public InputPeer[] ids; @@ -11227,14 +11227,14 @@ namespace TL.Methods } [TLDef(0xB59CF977)] - public class Phone_CheckGroupCall : IMethod + public sealed partial class Phone_CheckGroupCall : IMethod { public InputGroupCall call; public int[] sources; } [TLDef(0xF128C708)] - public class Phone_ToggleGroupCallRecord : IMethod + public sealed partial class Phone_ToggleGroupCallRecord : IMethod { public Flags flags; public InputGroupCall call; @@ -11250,7 +11250,7 @@ namespace TL.Methods } [TLDef(0xA5273ABF)] - public class Phone_EditGroupCallParticipant : IMethod + public sealed partial class Phone_EditGroupCallParticipant : IMethod { public Flags flags; public InputGroupCall call; @@ -11274,20 +11274,20 @@ namespace TL.Methods } [TLDef(0x1CA6AC0A)] - public class Phone_EditGroupCallTitle : IMethod + public sealed partial class Phone_EditGroupCallTitle : IMethod { public InputGroupCall call; public string title; } [TLDef(0xEF7C213A)] - public class Phone_GetGroupCallJoinAs : IMethod + public sealed partial class Phone_GetGroupCallJoinAs : IMethod { public InputPeer peer; } [TLDef(0xE6AA647F)] - public class Phone_ExportGroupCallInvite : IMethod + public sealed partial class Phone_ExportGroupCallInvite : IMethod { public Flags flags; public InputGroupCall call; @@ -11299,67 +11299,67 @@ namespace TL.Methods } [TLDef(0x219C34E6)] - public class Phone_ToggleGroupCallStartSubscription : IMethod + public sealed partial class Phone_ToggleGroupCallStartSubscription : IMethod { public InputGroupCall call; public bool subscribed; } [TLDef(0x5680E342)] - public class Phone_StartScheduledGroupCall : IMethod + public sealed partial class Phone_StartScheduledGroupCall : IMethod { public InputGroupCall call; } [TLDef(0x575E1F8C)] - public class Phone_SaveDefaultGroupCallJoinAs : IMethod + public sealed partial class Phone_SaveDefaultGroupCallJoinAs : IMethod { public InputPeer peer; public InputPeer join_as; } [TLDef(0xCBEA6BC4)] - public class Phone_JoinGroupCallPresentation : IMethod + public sealed partial class Phone_JoinGroupCallPresentation : IMethod { public InputGroupCall call; public DataJSON params_; } [TLDef(0x1C50D144)] - public class Phone_LeaveGroupCallPresentation : IMethod + public sealed partial class Phone_LeaveGroupCallPresentation : IMethod { public InputGroupCall call; } [TLDef(0x1AB21940)] - public class Phone_GetGroupCallStreamChannels : IMethod + public sealed partial class Phone_GetGroupCallStreamChannels : IMethod { public InputGroupCall call; } [TLDef(0xDEB3ABBF)] - public class Phone_GetGroupCallStreamRtmpUrl : IMethod + public sealed partial class Phone_GetGroupCallStreamRtmpUrl : IMethod { public InputPeer peer; public bool revoke; } [TLDef(0x41248786)] - public class Phone_SaveCallLog : IMethod + public sealed partial class Phone_SaveCallLog : IMethod { public InputPhoneCall peer; public InputFileBase file; } [TLDef(0xF2F2330A)] - public class Langpack_GetLangPack : IMethod + public sealed partial class Langpack_GetLangPack : IMethod { public string lang_pack; public string lang_code; } [TLDef(0xEFEA3803)] - public class Langpack_GetStrings : IMethod + public sealed partial class Langpack_GetStrings : IMethod { public string lang_pack; public string lang_code; @@ -11367,7 +11367,7 @@ namespace TL.Methods } [TLDef(0xCD984AA5)] - public class Langpack_GetDifference : IMethod + public sealed partial class Langpack_GetDifference : IMethod { public string lang_pack; public string lang_code; @@ -11375,26 +11375,26 @@ namespace TL.Methods } [TLDef(0x42C6978F)] - public class Langpack_GetLanguages : IMethod + public sealed partial class Langpack_GetLanguages : IMethod { public string lang_pack; } [TLDef(0x6A596502)] - public class Langpack_GetLanguage : IMethod + public sealed partial class Langpack_GetLanguage : IMethod { public string lang_pack; public string lang_code; } [TLDef(0x6847D0AB)] - public class Folders_EditPeerFolders : IMethod + public sealed partial class Folders_EditPeerFolders : IMethod { public InputFolderPeer[] folder_peers; } [TLDef(0xAB42441A)] - public class Stats_GetBroadcastStats : IMethod + public sealed partial class Stats_GetBroadcastStats : IMethod { public Flags flags; public InputChannelBase channel; @@ -11406,7 +11406,7 @@ namespace TL.Methods } [TLDef(0x621D5FA0)] - public class Stats_LoadAsyncGraph : IMethod + public sealed partial class Stats_LoadAsyncGraph : IMethod { public Flags flags; public string token; @@ -11419,7 +11419,7 @@ namespace TL.Methods } [TLDef(0xDCDF8607)] - public class Stats_GetMegagroupStats : IMethod + public sealed partial class Stats_GetMegagroupStats : IMethod { public Flags flags; public InputChannelBase channel; @@ -11431,7 +11431,7 @@ namespace TL.Methods } [TLDef(0x5F150144)] - public class Stats_GetMessagePublicForwards : IMethod + public sealed partial class Stats_GetMessagePublicForwards : IMethod { public InputChannelBase channel; public int msg_id; @@ -11440,7 +11440,7 @@ namespace TL.Methods } [TLDef(0xB6E0A3F5)] - public class Stats_GetMessageStats : IMethod + public sealed partial class Stats_GetMessageStats : IMethod { public Flags flags; public InputChannelBase channel; @@ -11453,7 +11453,7 @@ namespace TL.Methods } [TLDef(0x374FEF40)] - public class Stats_GetStoryStats : IMethod + public sealed partial class Stats_GetStoryStats : IMethod { public Flags flags; public InputPeer peer; @@ -11466,7 +11466,7 @@ namespace TL.Methods } [TLDef(0xA6437EF6)] - public class Stats_GetStoryPublicForwards : IMethod + public sealed partial class Stats_GetStoryPublicForwards : IMethod { public InputPeer peer; public int id; @@ -11475,7 +11475,7 @@ namespace TL.Methods } [TLDef(0x8472478E)] - public class Chatlists_ExportChatlistInvite : IMethod + public sealed partial class Chatlists_ExportChatlistInvite : IMethod { public InputChatlist chatlist; public string title; @@ -11483,14 +11483,14 @@ namespace TL.Methods } [TLDef(0x719C5C5E)] - public class Chatlists_DeleteExportedInvite : IMethod + public sealed partial class Chatlists_DeleteExportedInvite : IMethod { public InputChatlist chatlist; public string slug; } [TLDef(0x653DB63D)] - public class Chatlists_EditExportedInvite : IMethod + public sealed partial class Chatlists_EditExportedInvite : IMethod { public Flags flags; public InputChatlist chatlist; @@ -11506,64 +11506,64 @@ namespace TL.Methods } [TLDef(0xCE03DA83)] - public class Chatlists_GetExportedInvites : IMethod + public sealed partial class Chatlists_GetExportedInvites : IMethod { public InputChatlist chatlist; } [TLDef(0x41C10FFF)] - public class Chatlists_CheckChatlistInvite : IMethod + public sealed partial class Chatlists_CheckChatlistInvite : IMethod { public string slug; } [TLDef(0xA6B1E39A)] - public class Chatlists_JoinChatlistInvite : IMethod + public sealed partial class Chatlists_JoinChatlistInvite : IMethod { public string slug; public InputPeer[] peers; } [TLDef(0x89419521)] - public class Chatlists_GetChatlistUpdates : IMethod + public sealed partial class Chatlists_GetChatlistUpdates : IMethod { public InputChatlist chatlist; } [TLDef(0xE089F8F5)] - public class Chatlists_JoinChatlistUpdates : IMethod + public sealed partial class Chatlists_JoinChatlistUpdates : IMethod { public InputChatlist chatlist; public InputPeer[] peers; } [TLDef(0x66E486FB)] - public class Chatlists_HideChatlistUpdates : IMethod + public sealed partial class Chatlists_HideChatlistUpdates : IMethod { public InputChatlist chatlist; } [TLDef(0xFDBCD714)] - public class Chatlists_GetLeaveChatlistSuggestions : IMethod + public sealed partial class Chatlists_GetLeaveChatlistSuggestions : IMethod { public InputChatlist chatlist; } [TLDef(0x74FAE13A)] - public class Chatlists_LeaveChatlist : IMethod + public sealed partial class Chatlists_LeaveChatlist : IMethod { public InputChatlist chatlist; public InputPeer[] peers; } [TLDef(0xC7DFDFDD)] - public class Stories_CanSendStory : IMethod + public sealed partial class Stories_CanSendStory : IMethod { public InputPeer peer; } [TLDef(0xE4E6694B)] - public class Stories_SendStory : IMethod + public sealed partial class Stories_SendStory : IMethod { public Flags flags; public InputPeer peer; @@ -11591,7 +11591,7 @@ namespace TL.Methods } [TLDef(0xB583BA46)] - public class Stories_EditStory : IMethod + public sealed partial class Stories_EditStory : IMethod { public Flags flags; public InputPeer peer; @@ -11612,14 +11612,14 @@ namespace TL.Methods } [TLDef(0xAE59DB5F)] - public class Stories_DeleteStories : IMethod + public sealed partial class Stories_DeleteStories : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x9A75A1EF)] - public class Stories_TogglePinned : IMethod + public sealed partial class Stories_TogglePinned : IMethod { public InputPeer peer; public int[] id; @@ -11627,7 +11627,7 @@ namespace TL.Methods } [TLDef(0xEEB0D625)] - public class Stories_GetAllStories : IMethod + public sealed partial class Stories_GetAllStories : IMethod { public Flags flags; [IfFlag(0)] public string state; @@ -11641,7 +11641,7 @@ namespace TL.Methods } [TLDef(0x5821A5DC)] - public class Stories_GetPinnedStories : IMethod + public sealed partial class Stories_GetPinnedStories : IMethod { public InputPeer peer; public int offset_id; @@ -11649,7 +11649,7 @@ namespace TL.Methods } [TLDef(0xB4352016)] - public class Stories_GetStoriesArchive : IMethod + public sealed partial class Stories_GetStoriesArchive : IMethod { public InputPeer peer; public int offset_id; @@ -11657,34 +11657,34 @@ namespace TL.Methods } [TLDef(0x5774CA74)] - public class Stories_GetStoriesByID : IMethod + public sealed partial class Stories_GetStoriesByID : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x7C2557C4)] - public class Stories_ToggleAllStoriesHidden : IMethod + public sealed partial class Stories_ToggleAllStoriesHidden : IMethod { public bool hidden; } [TLDef(0xA556DAC8)] - public class Stories_ReadStories : IMethod + public sealed partial class Stories_ReadStories : IMethod { public InputPeer peer; public int max_id; } [TLDef(0xB2028AFB)] - public class Stories_IncrementStoryViews : IMethod + public sealed partial class Stories_IncrementStoryViews : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x7ED23C57)] - public class Stories_GetStoryViewsList : IMethod + public sealed partial class Stories_GetStoryViewsList : IMethod { public Flags flags; public InputPeer peer; @@ -11703,21 +11703,21 @@ namespace TL.Methods } [TLDef(0x28E16CC8)] - public class Stories_GetStoriesViews : IMethod + public sealed partial class Stories_GetStoriesViews : IMethod { public InputPeer peer; public int[] id; } [TLDef(0x7B8DEF20)] - public class Stories_ExportStoryLink : IMethod + public sealed partial class Stories_ExportStoryLink : IMethod { public InputPeer peer; public int id; } [TLDef(0x1923FA8C)] - public class Stories_Report : IMethod + public sealed partial class Stories_Report : IMethod { public InputPeer peer; public int[] id; @@ -11726,7 +11726,7 @@ namespace TL.Methods } [TLDef(0x57BBD166)] - public class Stories_ActivateStealthMode : IMethod + public sealed partial class Stories_ActivateStealthMode : IMethod { public Flags flags; @@ -11738,7 +11738,7 @@ namespace TL.Methods } [TLDef(0x7FD736B2)] - public class Stories_SendReaction : IMethod + public sealed partial class Stories_SendReaction : IMethod { public Flags flags; public InputPeer peer; @@ -11752,32 +11752,32 @@ namespace TL.Methods } [TLDef(0x2C4ADA50)] - public class Stories_GetPeerStories : IMethod + public sealed partial class Stories_GetPeerStories : IMethod { public InputPeer peer; } [TLDef(0x9B5AE7F9)] - public class Stories_GetAllReadPeerStories : IMethod { } + public sealed partial class Stories_GetAllReadPeerStories : IMethod { } [TLDef(0x535983C3)] - public class Stories_GetPeerMaxIDs : IMethod + public sealed partial class Stories_GetPeerMaxIDs : IMethod { public InputPeer[] id; } [TLDef(0xA56A8B60)] - public class Stories_GetChatsToSend : IMethod { } + public sealed partial class Stories_GetChatsToSend : IMethod { } [TLDef(0xBD0415C4)] - public class Stories_TogglePeerStoriesHidden : IMethod + public sealed partial class Stories_TogglePeerStoriesHidden : IMethod { public InputPeer peer; public bool hidden; } [TLDef(0xB9B2881F)] - public class Stories_GetStoryReactionsList : IMethod + public sealed partial class Stories_GetStoryReactionsList : IMethod { public Flags flags; public InputPeer peer; @@ -11795,7 +11795,7 @@ namespace TL.Methods } [TLDef(0x60F67660)] - public class Premium_GetBoostsList : IMethod + public sealed partial class Premium_GetBoostsList : IMethod { public Flags flags; public InputPeer peer; @@ -11809,10 +11809,10 @@ namespace TL.Methods } [TLDef(0x0BE77B4A)] - public class Premium_GetMyBoosts : IMethod { } + public sealed partial class Premium_GetMyBoosts : IMethod { } [TLDef(0x6B7DA746)] - public class Premium_ApplyBoost : IMethod + public sealed partial class Premium_ApplyBoost : IMethod { public Flags flags; [IfFlag(0)] public int[] slots; @@ -11825,29 +11825,29 @@ namespace TL.Methods } [TLDef(0x042F1F61)] - public class Premium_GetBoostsStatus : IMethod + public sealed partial class Premium_GetBoostsStatus : IMethod { public InputPeer peer; } [TLDef(0x39854D1F)] - public class Premium_GetUserBoosts : IMethod + public sealed partial class Premium_GetUserBoosts : IMethod { public InputPeer peer; public InputUserBase user_id; } [TLDef(0x0EDC39D0)] - public class Smsjobs_IsEligibleToJoin : IMethod { } + public sealed partial class Smsjobs_IsEligibleToJoin : IMethod { } [TLDef(0xA74ECE2D)] - public class Smsjobs_Join : IMethod { } + public sealed partial class Smsjobs_Join : IMethod { } [TLDef(0x9898AD73)] - public class Smsjobs_Leave : IMethod { } + public sealed partial class Smsjobs_Leave : IMethod { } [TLDef(0x093FA0BF)] - public class Smsjobs_UpdateSettings : IMethod + public sealed partial class Smsjobs_UpdateSettings : IMethod { public Flags flags; @@ -11858,16 +11858,16 @@ namespace TL.Methods } [TLDef(0x10A698E8)] - public class Smsjobs_GetStatus : IMethod { } + public sealed partial class Smsjobs_GetStatus : IMethod { } [TLDef(0x778D902F)] - public class Smsjobs_GetSmsJob : IMethod + public sealed partial class Smsjobs_GetSmsJob : IMethod { public string job_id; } [TLDef(0x4F1EBF24)] - public class Smsjobs_FinishJob : IMethod + public sealed partial class Smsjobs_FinishJob : IMethod { public Flags flags; public string job_id; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 6028014..41d7da0 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -4,7 +4,7 @@ namespace TL { #pragma warning disable IDE1006 /// Object describes the contents of an encrypted message. See - public abstract class DecryptedMessageBase : IObject + public abstract partial class DecryptedMessageBase : IObject { /// Flags, see TL conditional fields (added in layer 45) public virtual uint FFlags => default; @@ -30,17 +30,17 @@ namespace TL /// Object describes media contents of an encrypted message. See /// a value means decryptedMessageMediaEmpty - public abstract class DecryptedMessageMedia : IObject + public abstract partial class DecryptedMessageMedia : IObject { public virtual string MimeType => default; internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new WTelegram.WTException("Incompatible DecryptedMessageMedia"); } } /// Object describes the action to which a service message is linked. See - public abstract class DecryptedMessageAction : IObject { } + public abstract partial class DecryptedMessageAction : IObject { } /// Indicates the location of a photo, will be deprecated soon See - public abstract class FileLocationBase : IObject + public abstract partial class FileLocationBase : IObject { /// Server volume public virtual long VolumeId => default; @@ -54,7 +54,7 @@ namespace TL { /// Contents of an encrypted message. See [TLDef(0x1F814F1F)] - public class DecryptedMessage : DecryptedMessageBase + public sealed partial class DecryptedMessage : DecryptedMessageBase { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; @@ -74,7 +74,7 @@ namespace TL } ///
Contents of an encrypted service message. See [TLDef(0xAA48327D)] - public class DecryptedMessageService : DecryptedMessageBase + public sealed partial class DecryptedMessageService : DecryptedMessageBase { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; @@ -91,7 +91,7 @@ namespace TL ///
Photo attached to an encrypted message. See [TLDef(0x32798A8C)] - public class DecryptedMessageMediaPhoto : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; @@ -115,7 +115,7 @@ namespace TL } /// Video attached to an encrypted message. See [TLDef(0x4CEE6EF3)] - public class DecryptedMessageMediaVideo : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -140,7 +140,7 @@ namespace TL } /// GeoPoint attached to an encrypted message. See [TLDef(0x35480A59)] - public class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaGeoPoint : DecryptedMessageMedia { /// Latitude of point public double lat; @@ -149,7 +149,7 @@ namespace TL } /// Contact attached to an encrypted message. See [TLDef(0x588A0A97)] - public class DecryptedMessageMediaContact : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaContact : DecryptedMessageMedia { /// Phone number public string phone_number; @@ -162,7 +162,7 @@ namespace TL } /// Document attached to a message in a secret chat. See [TLDef(0xB095434B)] - public class DecryptedMessageMediaDocument : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; @@ -187,7 +187,7 @@ namespace TL } /// Audio file attached to a secret chat message. See [TLDef(0x6080758F)] - public class DecryptedMessageMediaAudio : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; @@ -203,42 +203,42 @@ namespace TL /// Setting of a message lifetime after reading. See [TLDef(0xA1733AEC)] - public class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction + public sealed partial class DecryptedMessageActionSetMessageTTL : DecryptedMessageAction { /// Lifetime in seconds public int ttl_seconds; } /// Messages marked as read. See [TLDef(0x0C4F40BE)] - public class DecryptedMessageActionReadMessages : DecryptedMessageAction + public sealed partial class DecryptedMessageActionReadMessages : DecryptedMessageAction { /// List of message IDs public long[] random_ids; } /// Deleted messages. See [TLDef(0x65614304)] - public class DecryptedMessageActionDeleteMessages : DecryptedMessageAction + public sealed partial class DecryptedMessageActionDeleteMessages : DecryptedMessageAction { /// List of deleted message IDs public long[] random_ids; } /// A screenshot was taken. See [TLDef(0x8AC1F475)] - public class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction + public sealed partial class DecryptedMessageActionScreenshotMessages : DecryptedMessageAction { /// List of affected message ids (that appeared on the screenshot) public long[] random_ids; } /// The entire message history has been deleted. See [TLDef(0x6719E45C)] - public class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } + public sealed partial class DecryptedMessageActionFlushHistory : DecryptedMessageAction { } } namespace Layer23 { /// Image description. See [TLDef(0x77BFB61B)] - public partial class PhotoSize : PhotoSizeBase + public sealed partial class PhotoSize : PhotoSizeBase { /// Thumbnail type » public string type; @@ -255,7 +255,7 @@ namespace TL } /// Description of an image and its content. See [TLDef(0xE9A734FA)] - public partial class PhotoCachedSize : PhotoSizeBase + public sealed partial class PhotoCachedSize : PhotoSizeBase { /// Thumbnail type public string type; @@ -273,23 +273,23 @@ namespace TL /// User is uploading a video. See [TLDef(0x92042FF7)] - public class SendMessageUploadVideoAction : SendMessageAction { } + public sealed partial class SendMessageUploadVideoAction : SendMessageAction { } /// User is uploading a voice message. See [TLDef(0xE6AC8A6F)] - public class SendMessageUploadAudioAction : SendMessageAction { } + public sealed partial class SendMessageUploadAudioAction : SendMessageAction { } /// User is uploading a photo. See [TLDef(0x990A3C1A)] - public class SendMessageUploadPhotoAction : SendMessageAction { } + public sealed partial class SendMessageUploadPhotoAction : SendMessageAction { } /// User is uploading a file. See [TLDef(0x8FAEE98E)] - public class SendMessageUploadDocumentAction : SendMessageAction { } + public sealed partial class SendMessageUploadDocumentAction : SendMessageAction { } /// Defines a sticker See [TLDef(0xFB0A5727)] - public class DocumentAttributeSticker : DocumentAttribute { } + public sealed partial class DocumentAttributeSticker : DocumentAttribute { } /// Defines a video See [TLDef(0x5910CCCB)] - public class DocumentAttributeVideo : DocumentAttribute + public sealed partial class DocumentAttributeVideo : DocumentAttribute { /// Duration in seconds public int duration; @@ -300,7 +300,7 @@ namespace TL } /// Represents an audio file See [TLDef(0x051448E5)] - public class DocumentAttributeAudio : DocumentAttribute + public sealed partial class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; @@ -308,7 +308,7 @@ namespace TL /// Contents of an encrypted message. See [TLDef(0x204D3878)] - public class DecryptedMessage : DecryptedMessageBase + public sealed partial class DecryptedMessage : DecryptedMessageBase { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; @@ -330,7 +330,7 @@ namespace TL } ///
Contents of an encrypted service message. See [TLDef(0x73164160)] - public class DecryptedMessageService : DecryptedMessageBase + public sealed partial class DecryptedMessageService : DecryptedMessageBase { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; @@ -345,7 +345,7 @@ namespace TL ///
Video attached to an encrypted message. See [TLDef(0x524A415D)] - public class DecryptedMessageMediaVideo : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -375,7 +375,7 @@ namespace TL } /// Audio file attached to a secret chat message. See [TLDef(0x57E0A9CB)] - public class DecryptedMessageMediaAudio : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaAudio : DecryptedMessageMedia { /// Audio duration in seconds public int duration; @@ -395,7 +395,7 @@ namespace TL } /// Non-e2e documented forwarded from non-secret chat See [TLDef(0xFA95B0DD)] - public class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaExternalDocument : DecryptedMessageMedia { /// Document ID public long id; @@ -420,7 +420,7 @@ namespace TL /// Request for the other party in a Secret Chat to automatically resend a contiguous range of previously sent messages, as explained in Sequence number is Secret Chats. See [TLDef(0x511110B0)] - public class DecryptedMessageActionResend : DecryptedMessageAction + public sealed partial class DecryptedMessageActionResend : DecryptedMessageAction { /// out_seq_no of the first message to be resent, with correct parity public int start_seq_no; @@ -429,21 +429,21 @@ namespace TL } /// A notification stating the API layer that is used by the client. You should use your current layer and take notice of the layer used on the other side of a conversation when sending messages. See [TLDef(0xF3048883)] - public class DecryptedMessageActionNotifyLayer : DecryptedMessageAction + public sealed partial class DecryptedMessageActionNotifyLayer : DecryptedMessageAction { /// Layer number, must be 17 or higher (this constructor was introduced in Layer 17. public int layer; } /// User is preparing a message: typing, recording, uploading, etc. See [TLDef(0xCCB27641)] - public class DecryptedMessageActionTyping : DecryptedMessageAction + public sealed partial class DecryptedMessageActionTyping : DecryptedMessageAction { /// Type of action public SendMessageAction action; } /// Request rekeying, see rekeying process See [TLDef(0xF3C9611B)] - public class DecryptedMessageActionRequestKey : DecryptedMessageAction + public sealed partial class DecryptedMessageActionRequestKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; @@ -452,7 +452,7 @@ namespace TL } /// Accept new key See [TLDef(0x6FE1735B)] - public class DecryptedMessageActionAcceptKey : DecryptedMessageAction + public sealed partial class DecryptedMessageActionAcceptKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; @@ -463,14 +463,14 @@ namespace TL } /// Abort rekeying See [TLDef(0xDD05EC6B)] - public class DecryptedMessageActionAbortKey : DecryptedMessageAction + public sealed partial class DecryptedMessageActionAbortKey : DecryptedMessageAction { /// Exchange ID public long exchange_id; } /// Commit new key, see rekeying process See [TLDef(0xEC2E0B9B)] - public class DecryptedMessageActionCommitKey : DecryptedMessageAction + public sealed partial class DecryptedMessageActionCommitKey : DecryptedMessageAction { /// Exchange ID, see rekeying process public long exchange_id; @@ -479,11 +479,11 @@ namespace TL } /// NOOP action See [TLDef(0xA82FDD63)] - public class DecryptedMessageActionNoop : DecryptedMessageAction { } + public sealed partial class DecryptedMessageActionNoop : DecryptedMessageAction { } /// Sets the layer number for the contents of an encrypted message. See [TLDef(0x1BE31789)] - public class DecryptedMessageLayer : IObject + public sealed partial class DecryptedMessageLayer : IObject { /// Set of random bytes to prevent content recognition in short encrypted messages.
Clients are required to check that there are at least 15 random bytes included in each message. Messages with less than 15 random bytes must be ignored.
Parameter moved here from in Layer 17.
public byte[] random_bytes; @@ -499,7 +499,7 @@ namespace TL ///
File is currently unavailable. See [TLDef(0x7C596B46)] - public class FileLocationUnavailable : FileLocationBase + public sealed partial class FileLocationUnavailable : FileLocationBase { /// Server volume public long volume_id; @@ -517,7 +517,7 @@ namespace TL } /// File location. See [TLDef(0x53D69076)] - public class FileLocation : FileLocationBase + public sealed partial class FileLocation : FileLocationBase { /// Number of the data center holding the file public int dc_id; @@ -541,7 +541,7 @@ namespace TL { /// Represents an audio file See [TLDef(0xDED218E0)] - public class DocumentAttributeAudio : DocumentAttribute + public sealed partial class DocumentAttributeAudio : DocumentAttribute { /// Duration in seconds public int duration; @@ -556,7 +556,7 @@ namespace TL { /// Defines a sticker See [TLDef(0x3A556302)] - public class DocumentAttributeSticker : DocumentAttribute + public sealed partial class DocumentAttributeSticker : DocumentAttribute { /// Alternative emoji representation of sticker public string alt; @@ -566,7 +566,7 @@ namespace TL /// Message entity representing a user mention: for creating a mention use . See [TLDef(0x352DCA58, inheritBefore = true)] - public class MessageEntityMentionName : MessageEntityMention + public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public int user_id; @@ -574,7 +574,7 @@ namespace TL /// Contents of an encrypted message. See [TLDef(0x36B091DE)] - public class DecryptedMessage : DecryptedMessageBase + public sealed partial class DecryptedMessage : DecryptedMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -625,7 +625,7 @@ namespace TL /// Photo attached to an encrypted message. See [TLDef(0xF1FA8D78)] - public class DecryptedMessageMediaPhoto : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaPhoto : DecryptedMessageMedia { /// Content of thumbnail file (JPEGfile, quality 55, set in a square 90x90) public byte[] thumb; @@ -651,7 +651,7 @@ namespace TL } /// Video attached to an encrypted message. See [TLDef(0x970C8C0E)] - public class DecryptedMessageMediaVideo : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaVideo : DecryptedMessageMedia { /// Content of thumbnail file (JPEG file, quality 55, set in a square 90x90) public byte[] thumb; @@ -683,7 +683,7 @@ namespace TL } /// Document attached to a message in a secret chat. See [TLDef(0x7AFE8AE2)] - public class DecryptedMessageMediaDocument : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; @@ -711,7 +711,7 @@ namespace TL } /// Venue See [TLDef(0x8A0DF56F)] - public class DecryptedMessageMediaVenue : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaVenue : DecryptedMessageMedia { /// Latitude of venue public double lat; @@ -728,7 +728,7 @@ namespace TL } /// Webpage preview See [TLDef(0xE50511D8)] - public class DecryptedMessageMediaWebPage : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaWebPage : DecryptedMessageMedia { /// URL of webpage public string url; @@ -739,11 +739,11 @@ namespace TL { /// User is uploading a round video See [TLDef(0xBB718624)] - public class SendMessageUploadRoundAction : SendMessageAction { } + public sealed partial class SendMessageUploadRoundAction : SendMessageAction { } /// Defines a video See [TLDef(0x0EF02CE6)] - public class DocumentAttributeVideo : DocumentAttribute + public sealed partial class DocumentAttributeVideo : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -766,7 +766,7 @@ namespace TL { /// Contents of an encrypted message. See [TLDef(0x91CC4674)] - public class DecryptedMessage : DecryptedMessageBase + public sealed partial class DecryptedMessage : DecryptedMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -831,7 +831,7 @@ namespace TL { /// Document attached to a message in a secret chat. See [TLDef(0x6ABD9782)] - public class DecryptedMessageMediaDocument : DecryptedMessageMedia + public sealed partial class DecryptedMessageMediaDocument : DecryptedMessageMedia { /// Thumbnail-file contents (JPEG-file, quality 55, set in a 90x90 square) public byte[] thumb; diff --git a/src/TL.Table.cs b/src/TL.Table.cs index ed185a2..af24420 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -4,7 +4,7 @@ using System.ComponentModel; namespace TL { - public static class Layer + public static partial class Layer { public const int Version = 176; // fetched 08/03/2024 11:12:00 internal const int SecretChats = 144; @@ -1325,7 +1325,7 @@ namespace TL [typeof(UrlAuthResult)] = 0xA9D6DB1F, //urlAuthResultDefault [typeof(ChannelLocation)] = 0xBFB5AD8B, //channelLocationEmpty [typeof(Account_Themes)] = 0xF41EB622, //account.themesNotModified - [typeof(DialogFilter)] = 0x363293AE, //dialogFilterDefault + [typeof(DialogFilterBase)] = 0x363293AE, //dialogFilterDefault [typeof(Help_CountriesList)] = 0x93CC1F32, //help.countriesListNotModified [typeof(BotCommandScope)] = 0x2F6CB2AB, //botCommandScopeDefault [typeof(Messages_SponsoredMessages)] = 0x1839490F, //messages.sponsoredMessagesEmpty @@ -1340,7 +1340,6 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: - [typeof(DialogFilterBase)] = 0x363293AE, //dialogFilterDefault [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified diff --git a/src/TL.cs b/src/TL.cs index d8e79da..90e25fc 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -16,19 +16,19 @@ namespace TL public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } [AttributeUsage(AttributeTargets.Class)] - public class TLDefAttribute(uint ctorNb) : Attribute + public sealed class TLDefAttribute(uint ctorNb) : Attribute { public readonly uint CtorNb = ctorNb; public bool inheritBefore; } [AttributeUsage(AttributeTargets.Field)] - public class IfFlagAttribute(int bit) : Attribute + public sealed class IfFlagAttribute(int bit) : Attribute { public readonly int Bit = bit; } - public class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) + public sealed class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) { public readonly int Code = code; /// The value of X in the message, -1 if no variable X was found @@ -36,7 +36,7 @@ namespace TL public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } } - public class ReactorError : IObject + public sealed partial class ReactorError : IObject { public Exception Exception; } @@ -352,7 +352,7 @@ namespace TL public static implicit operator byte[](Int256 int256) => int256.raw; } - public class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdate in case of such API call result + public sealed partial class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdate in case of such API call result { public Messages_AffectedMessages affected; public override (long, int, int) GetMBox() => (0, affected.pts, affected.pts_count); @@ -361,21 +361,21 @@ namespace TL // Below TL types are commented "parsed manually" from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/tl/mtproto.tl [TLDef(0x7A19CB76)] //RSA_public_key#7a19cb76 n:bytes e:bytes = RSAPublicKey - public class RSAPublicKey : IObject + public sealed partial class RSAPublicKey : IObject { public byte[] n; public byte[] e; } [TLDef(0xF35C6D01)] //rpc_result#f35c6d01 req_msg_id:long result:Object = RpcResult - public class RpcResult : IObject + public sealed partial class RpcResult : IObject { public long req_msg_id; public object result; } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public class _Message(long msgId, int seqNo, IObject obj) : IObject + public sealed partial class _Message(long msgId, int seqNo, IObject obj) : IObject { public long msg_id = msgId; public int seq_no = seqNo; @@ -384,10 +384,10 @@ namespace TL } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer - public class MsgContainer : IObject { public _Message[] messages; } + public sealed partial class MsgContainer : IObject { public _Message[] messages; } [TLDef(0xE06046B2)] //msg_copy#e06046b2 orig_message:Message = MessageCopy - public class MsgCopy : IObject { public _Message orig_message; } + public sealed partial class MsgCopy : IObject { public _Message orig_message; } [TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object - public class GzipPacked : IObject { public byte[] packed_data; } + public sealed partial class GzipPacked : IObject { public byte[] packed_data; } } diff --git a/src/TlsStream.cs b/src/TlsStream.cs index b7d4632..3adc277 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -11,7 +11,7 @@ using System.Threading.Tasks; namespace WTelegram { - class TlsStream(Stream innerStream) : Helpers.IndirectStream(innerStream) + internal sealed class TlsStream(Stream innerStream) : Helpers.IndirectStream(innerStream) { private int _tlsFrameleft; private readonly byte[] _tlsSendHeader = [0x17, 0x03, 0x03, 0, 0]; From e2323092dc97f8e0d56681ec9df7e99be8afd6f3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 26 Mar 2024 12:07:03 +0100 Subject: [PATCH 184/336] net8.0 target, compatible with AOT --- src/Client.cs | 2 +- src/Compat.cs | 7 +++++++ src/Encryption.cs | 6 +++--- src/Helpers.cs | 10 ++++++++++ src/TL.cs | 8 ++++---- src/WTelegramClient.csproj | 3 ++- 6 files changed, 27 insertions(+), 9 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 046ddd4..e5da354 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -918,7 +918,7 @@ namespace WTelegram TLConfig = new Config { this_dc = _session.MainDC, dc_options = _session.DcOptions }; else { - var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonSerializer.Deserialize(Config("init_params"))); + var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonDocument.Parse(Config("init_params")).RootElement); TLConfig = await this.InvokeWithLayer(Layer.Version, new TL.Methods.InitConnection { diff --git a/src/Compat.cs b/src/Compat.cs index b83e832..53d54b4 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -76,6 +76,13 @@ static class Convert internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", ""); internal static byte[] FromHexString(string hex) => Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16)).ToArray(); } +public class RandomNumberGenerator +{ + internal static readonly RNGCryptoServiceProvider RNG = new(); + public static RandomNumberGenerator Create() => new(); + public void GetBytes(byte[] data) => RNG.GetBytes(data); + public void GetBytes(byte[] data, int offset, int count) => RNG.GetBytes(data, offset, count); +} #endif #if NETSTANDARD2_0 diff --git a/src/Encryption.cs b/src/Encryption.cs index 4c49f5e..d943e5d 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -16,7 +16,7 @@ namespace WTelegram internal static class Encryption { private static readonly Dictionary PublicKeys = []; - internal static readonly RNGCryptoServiceProvider RNG = new(); + internal static readonly RandomNumberGenerator RNG = RandomNumberGenerator.Create(); internal static readonly Aes AesECB = Aes.Create(); static Encryption() @@ -33,7 +33,7 @@ namespace WTelegram var sha256 = SHA256.Create(); //1) - var nonce = new Int128(RNG); + var nonce = new TL.Int128(RNG); var resPQ = await client.ReqPqMulti(nonce); //2) if (resPQ.nonce != nonce) throw new WTException("Nonce mismatch"); @@ -164,7 +164,7 @@ namespace WTelegram session.Salt = BinaryPrimitives.ReadInt64LittleEndian(pqInnerData.new_nonce.raw) ^ BinaryPrimitives.ReadInt64LittleEndian(resPQ.server_nonce.raw); session.OldSalt = session.Salt; - (byte[] key, byte[] iv) ConstructTmpAESKeyIV(Int128 server_nonce, Int256 new_nonce) + (byte[] key, byte[] iv) ConstructTmpAESKeyIV(TL.Int128 server_nonce, Int256 new_nonce) { byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; sha1.TransformBlock(new_nonce, 0, 32, null, 0); diff --git a/src/Helpers.cs b/src/Helpers.cs index f1569c0..e76c116 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -7,6 +7,13 @@ using System.Text.Json; using System.Threading; using System.Threading.Tasks; +#if NET8_0_OR_GREATER +using System.Text.Json.Serialization; +using System.Text.Json.Serialization.Metadata; +[JsonSerializable(typeof(WTelegram.Session))] +internal partial class WTelegramContext : JsonSerializerContext { } +#endif + namespace WTelegram { public static class Helpers @@ -16,6 +23,9 @@ namespace WTelegram /// For serializing indented Json with fields included public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, +#if NET8_0_OR_GREATER + TypeInfoResolver = JsonSerializer.IsReflectionEnabledByDefault ? new DefaultJsonTypeInfoResolver() : WTelegramContext.Default, +#endif IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }; private static readonly ConsoleColor[] LogLevelToColor = [ ConsoleColor.DarkGray, ConsoleColor.DarkCyan, diff --git a/src/TL.cs b/src/TL.cs index 90e25fc..6d4541a 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -328,8 +328,8 @@ namespace TL { public byte[] raw; - public Int128(System.IO.BinaryReader reader) => raw = reader.ReadBytes(16); - public Int128(RNGCryptoServiceProvider rng) => rng.GetBytes(raw = new byte[16]); + public Int128(BinaryReader reader) => raw = reader.ReadBytes(16); + public Int128(RandomNumberGenerator rng) => rng.GetBytes(raw = new byte[16]); public static bool operator ==(Int128 left, Int128 right) { for (int i = 0; i < 16; i++) if (left.raw[i] != right.raw[i]) return false; return true; } public static bool operator !=(Int128 left, Int128 right) { for (int i = 0; i < 16; i++) if (left.raw[i] != right.raw[i]) return true; return false; } public override readonly bool Equals(object obj) => obj is Int128 other && this == other; @@ -342,8 +342,8 @@ namespace TL { public byte[] raw; - public Int256(System.IO.BinaryReader reader) => raw = reader.ReadBytes(32); - public Int256(RNGCryptoServiceProvider rng) => rng.GetBytes(raw = new byte[32]); + public Int256(BinaryReader reader) => raw = reader.ReadBytes(32); + public Int256(RandomNumberGenerator rng) => rng.GetBytes(raw = new byte[32]); public static bool operator ==(Int256 left, Int256 right) { for (int i = 0; i < 32; i++) if (left.raw[i] != right.raw[i]) return false; return true; } public static bool operator !=(Int256 left, Int256 right) { for (int i = 0; i < 32; i++) if (left.raw[i] != right.raw[i]) return true; return false; } public override readonly bool Equals(object obj) => obj is Int256 other && this == other; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 25acdfb..d2b078c 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -2,7 +2,7 @@ Library - netstandard2.0;net5.0 + netstandard2.0;net5.0;net8.0 latest WTelegram true @@ -26,6 +26,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 TRACE;OBFUSCATION + From 55feb857d77e0a61802ef7f464c04edef59086e7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 26 Mar 2024 18:12:39 +0100 Subject: [PATCH 185/336] more sealed partial --- src/SecretChats.cs | 58 +++++++++++++++++++++++----------------------- src/TL.Table.cs | 2 +- 2 files changed, 30 insertions(+), 30 deletions(-) diff --git a/src/SecretChats.cs b/src/SecretChats.cs index 7b1cfbe..c7b78cf 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -21,6 +21,35 @@ namespace WTelegram int RemoteLayer { get; } } + [TLDef(0xFEFEFEFE)] + internal sealed partial class SecretChat : IObject, ISecretChat + { + [Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 } + public Flags flags; + public InputEncryptedChat peer = new(); + public byte[] salt; // contains future/discarded authKey during acceptKey/commitKey + public byte[] authKey; + public DateTime key_created; + public int key_useCount; + public long participant_id; + public int remoteLayer = 46; + public int in_seq_no = -2, out_seq_no = 0; + public long exchange_id; + + public int ChatId => peer.chat_id; + public long RemoteUserId => participant_id; + public InputEncryptedChat Peer => peer; + public int RemoteLayer => remoteLayer; + + internal long key_fingerprint; + internal SortedList pendingMsgs = []; + internal void Discarded() // clear out fields for more security + { + Array.Clear(authKey, 0, authKey.Length); + key_fingerprint = participant_id = peer.access_hash = peer.chat_id = in_seq_no = out_seq_no = remoteLayer = 0; + } + } + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles")] public sealed class SecretChats : IDisposable { @@ -35,35 +64,6 @@ namespace WTelegram private readonly SHA1 sha1 = SHA1.Create(); private readonly Random random = new(); private const int ThresholdPFS = 100; - - [TLDef(0xFEFEFEFE)] - internal sealed class SecretChat : IObject, ISecretChat - { - [Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 } - public Flags flags; - public InputEncryptedChat peer = new(); - public byte[] salt; // contains future/discarded authKey during acceptKey/commitKey - public byte[] authKey; - public DateTime key_created; - public int key_useCount; - public long participant_id; - public int remoteLayer = 46; - public int in_seq_no = -2, out_seq_no = 0; - public long exchange_id; - - public int ChatId => peer.chat_id; - public long RemoteUserId => participant_id; - public InputEncryptedChat Peer => peer; - public int RemoteLayer => remoteLayer; - - internal long key_fingerprint; - internal SortedList pendingMsgs = []; - internal void Discarded() // clear out fields for more security - { - Array.Clear(authKey, 0, authKey.Length); - key_fingerprint = participant_id = peer.access_hash = peer.chat_id = in_seq_no = out_seq_no = remoteLayer = 0; - } - } /// Instantiate a Secret Chats manager /// The Telegram client diff --git a/src/TL.Table.cs b/src/TL.Table.cs index af24420..e68173d 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -25,7 +25,7 @@ namespace TL [0x73F1F8DC] = typeof(MsgContainer), [0xE06046B2] = typeof(MsgCopy), [0x3072CFA1] = typeof(GzipPacked), - [0xFEFEFEFE] = typeof(WTelegram.SecretChats.SecretChat), + [0xFEFEFEFE] = typeof(WTelegram.SecretChat), // from TL.MTProto: [0x05162463] = typeof(ResPQ), [0x83C95AEC] = typeof(PQInnerData), From 3918e68945ca6d679a74e451ac2b063fd9b54460 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 28 Mar 2024 12:13:56 +0100 Subject: [PATCH 186/336] Using a source generator to make the library compatible with NativeAOT trimming. --- generator/MTProtoGenerator.cs | 235 ++++++++++++++++++++++++++++++ generator/MTProtoGenerator.csproj | 20 +++ src/Client.cs | 5 +- src/Helpers.cs | 7 +- src/TL.Extensions.cs | 3 + src/TL.cs | 81 +++++++--- src/WTelegramClient.csproj | 6 +- 7 files changed, 332 insertions(+), 25 deletions(-) create mode 100644 generator/MTProtoGenerator.cs create mode 100644 generator/MTProtoGenerator.csproj diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs new file mode 100644 index 0000000..4901bd8 --- /dev/null +++ b/generator/MTProtoGenerator.cs @@ -0,0 +1,235 @@ +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.Diagnostics; +using System.Linq; +using System.Text; + +#pragma warning disable RS1024 // Symbols should be compared for equality + +namespace TL.Generator; + +[Generator] +public class MTProtoGenerator : IIncrementalGenerator +{ + public void Initialize(IncrementalGeneratorInitializationContext context) + { + var classDeclarations = context.SyntaxProvider.ForAttributeWithMetadataName("TL.TLDefAttribute", + (_, _) => true, (context, _) => (ClassDeclarationSyntax)context.TargetNode); + var source = context.CompilationProvider.Combine(classDeclarations.Collect()); + context.RegisterSourceOutput(source, Execute); + } + + static void Execute(SourceProductionContext context, (Compilation compilation, ImmutableArray classes) unit) + { + var object_ = unit.compilation.GetSpecialType(SpecialType.System_Object); + if (unit.compilation.GetTypeByMetadataName("TL.TLDefAttribute") is not { } tlDefAttribute) return; + if (unit.compilation.GetTypeByMetadataName("TL.IfFlagAttribute") is not { } ifFlagAttribute) return; + if (unit.compilation.GetTypeByMetadataName("TL.Layer") is not { } layer) return; + if (unit.compilation.GetTypeByMetadataName("TL.IObject") is not { } iobject) return; + var nullables = LoadNullables(layer); + var namespaces = new Dictionary>(); // namespace,class,methods + var readTL = new StringBuilder(); + readTL + .AppendLine("\t\tpublic static IObject ReadTL(this BinaryReader reader, uint ctorId = 0) => (ctorId != 0 ? ctorId : reader.ReadUInt32()) switch") + .AppendLine("\t\t{"); + + foreach (var classDecl in unit.classes) + { + var semanticModel = unit.compilation.GetSemanticModel(classDecl.SyntaxTree); + if (semanticModel.GetDeclaredSymbol(classDecl) is not { } symbol) continue; + var tldef = symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); + if (tldef == null) continue; + var id = (uint)tldef.ConstructorArguments[0].Value; + var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; + StringBuilder writeTl = new(), ctorTL = new(); + var ns = symbol.BaseType.ContainingNamespace.ToString(); + var name = symbol.BaseType.Name; + if (ns != "System") + { + if (!namespaces.TryGetValue(ns, out var parentClasses)) namespaces[ns] = parentClasses = []; + parentClasses.TryGetValue(name, out var parentMethods); + if (symbol.BaseType.IsAbstract) + { + if (parentMethods == null) + { + writeTl.AppendLine("\t\tpublic abstract void WriteTL(BinaryWriter writer);"); + parentClasses[name] = writeTl.ToString(); + writeTl.Clear(); + } + } + else if (parentMethods?.Contains(" virtual ") == false) + parentClasses[name] = parentMethods.Replace("public void WriteTL(", "public virtual void WriteTL("); + } + ns = symbol.ContainingNamespace.ToString(); + name = symbol.Name; + if (!namespaces.TryGetValue(ns, out var classes)) namespaces[ns] = classes = []; + if (name is "_Message" or "RpcResult" or "MsgCopy") + { + classes[name] = "\t\tpublic void WriteTL(BinaryWriter writer) => throw new NotSupportedException();"; + continue; + } + if (id == 0x3072CFA1) // GzipPacked + readTL.AppendLine($"\t\t\t0x{id:X8} => reader.ReadTLGzipped(),"); + else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) + readTL.AppendLine($"\t\t\t0x{id:X8} => new {(ns == "TL" ? "" : ns + '.')}{name}(reader),"); + var override_ = symbol.BaseType == object_ ? "" : "override "; + if (name == "Messages_AffectedMessages") override_ = "virtual "; + if (symbol.Constructors[0].IsImplicitlyDeclared) + ctorTL.AppendLine($"\t\tpublic {name}() {{ }}"); + ctorTL + .AppendLine($"\t\tpublic {name}(BinaryReader reader)") + .AppendLine("\t\t{"); + writeTl + .AppendLine($"\t\tpublic {override_}void WriteTL(BinaryWriter writer)") + .AppendLine("\t\t{") + .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); + var members = symbol.GetMembers().ToList(); + for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) + if (inheritBefore) members.InsertRange(0, parent.GetMembers()); + else members.AddRange(parent.GetMembers()); + foreach (var member in members.OfType()) + { + if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; + ctorTL.Append("\t\t\t"); + writeTl.Append("\t\t\t"); + var ifFlag = (int?)member.GetAttributes().FirstOrDefault(a => a.AttributeClass == ifFlagAttribute)?.ConstructorArguments[0].Value; + if (ifFlag != null) + { + var condition = ifFlag < 32 ? $"if (((uint)flags & 0x{1 << ifFlag:X}) != 0) " + : $"if (((uint)flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "; + ctorTL.Append(condition); + writeTl.Append(condition); + } + string memberType = member.Type.ToString(); + switch (memberType) + { + case "int": + ctorTL.AppendLine($"{member.Name} = reader.ReadInt32();"); + writeTl.AppendLine($"writer.Write({member.Name});"); + break; + case "long": + ctorTL.AppendLine($"{member.Name} = reader.ReadInt64();"); + writeTl.AppendLine($"writer.Write({member.Name});"); + break; + case "double": + ctorTL.AppendLine($"{member.Name} = reader.ReadDouble();"); + writeTl.AppendLine($"writer.Write({member.Name});"); + break; + case "bool": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLBool();"); + writeTl.AppendLine($"writer.Write({member.Name} ? 0x997275B5 : 0xBC799737);"); + break; + case "System.DateTime": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLStamp();"); + writeTl.AppendLine($"writer.WriteTLStamp({member.Name});"); + break; + case "string": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLString();"); + writeTl.AppendLine($"writer.WriteTLString({member.Name});"); + break; + case "byte[]": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLBytes();"); + writeTl.AppendLine($"writer.WriteTLBytes({member.Name});"); + break; + case "TL.Int128": + ctorTL.AppendLine($"{member.Name} = new Int128(reader);"); + writeTl.AppendLine($"writer.Write({member.Name});"); + break; + case "TL.Int256": + ctorTL.AppendLine($"{member.Name} = new Int256(reader);"); + writeTl.AppendLine($"writer.Write({member.Name});"); + break; + case "TL._Message[]": + ctorTL.AppendLine($"throw new NotSupportedException();"); + writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); + break; + case "TL.IObject": case "TL.IMethod": + ctorTL.AppendLine($"{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTL();"); + writeTl.AppendLine($"{member.Name}.WriteTL(writer);"); + break; + case "System.Collections.Generic.Dictionary": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + break; + case "System.Collections.Generic.Dictionary": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + break; + default: + if (member.Type is IArrayTypeSymbol arrayType) + { + if (name is "FutureSalts") + ctorTL.AppendLine($"{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC);"); + else + ctorTL.AppendLine($"{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); + } + else if (member.Type.BaseType.SpecialType == SpecialType.System_Enum) + { + ctorTL.AppendLine($"{member.Name} = ({memberType})reader.ReadUInt32();"); + writeTl.AppendLine($"writer.Write((uint){member.Name});"); + } + else if (memberType.StartsWith("TL.")) + { + ctorTL.AppendLine($"{member.Name} = ({memberType})reader.ReadTL();"); + var nullStr = nullables.TryGetValue(memberType, out uint nullCtor) ? $"0x{nullCtor:X8}" : "Layer.NullCtor"; + writeTl.AppendLine($"if ({member.Name} != null) {member.Name}.WriteTL(writer); else writer.Write({nullStr});"); + } + else + writeTl.AppendLine($"Cannot serialize {memberType}"); + break; + } + } + ctorTL.AppendLine("\t\t}"); + writeTl.AppendLine("\t\t}"); + ctorTL.Append(writeTl.ToString()); + if (symbol.IsGenericType) name += ""; + classes[name] = ctorTL.ToString(); + } + + var source = new StringBuilder(); + source + .AppendLine("using System;") + .AppendLine("using System.IO;") + .AppendLine("using System.Linq;") + .AppendLine("using TL;") + .AppendLine(); + foreach (var nullable in nullables) + readTL.AppendLine($"\t\t\t0x{nullable.Value:X8} => null,"); + readTL.AppendLine("\t\t\tvar ctorNb => throw new Exception($\"Cannot find type for ctor #{ctorNb:x}\")"); + readTL.AppendLine("\t\t};"); + namespaces["TL"]["Layer"] = readTL.ToString(); + foreach (var namesp in namespaces) + { + source.Append("namespace ").AppendLine(namesp.Key).Append('{'); + foreach (var method in namesp.Value) + source.AppendLine().Append("\tpartial class ").AppendLine(method.Key).AppendLine("\t{").Append(method.Value).AppendLine("\t}"); + source.AppendLine("}").AppendLine(); + } + string text = source.ToString(); + Debug.Write(text); + context.AddSource("TL.Generated.cs", text); + } + + private static Dictionary LoadNullables(INamedTypeSymbol layer) + { + var nullables = layer.GetMembers("Nullables").Single() as IFieldSymbol; + var initializer = nullables.DeclaringSyntaxReferences[0].GetSyntax().ToString(); + var table = new Dictionary(); + foreach (var line in initializer.Split('\n')) + { + int index = line.IndexOf("[typeof("); + if (index == -1) continue; + int index2 = line.IndexOf(')', index += 8); + string className = "TL." + line.Substring(index, index2 - index); + index = line.IndexOf("= 0x", index2); + if (index == -1) continue; + index2 = line.IndexOf(',', index += 4); + table[className] = uint.Parse(line.Substring(index, index2 - index), System.Globalization.NumberStyles.HexNumber); + } + return table; + } +} diff --git a/generator/MTProtoGenerator.csproj b/generator/MTProtoGenerator.csproj new file mode 100644 index 0000000..881f2da --- /dev/null +++ b/generator/MTProtoGenerator.csproj @@ -0,0 +1,20 @@ + + + netstandard2.0 + true + true + true + True + latest + + + + + + + + + + \ No newline at end of file diff --git a/src/Client.cs b/src/Client.cs index e5da354..af57f0b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -570,12 +570,11 @@ namespace WTelegram if (peek == Layer.RpcErrorCtor) result = reader.ReadTLObject(Layer.RpcErrorCtor); else if (peek == Layer.GZipedCtor) - using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress))) - result = gzipReader.ReadTLValue(rpc.type); + result = reader.ReadTLGzipped(); else { reader.BaseStream.Position -= 4; - result = reader.ReadTLValue(rpc.type); + result = reader.ReadTLVector(rpc.type); } } if (rpc.type.IsEnum) result = Enum.ToObject(rpc.type, result); diff --git a/src/Helpers.cs b/src/Helpers.cs index e76c116..e716078 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -4,12 +4,11 @@ using System.IO; using System.Numerics; using System.Reflection; using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; #if NET8_0_OR_GREATER -using System.Text.Json.Serialization; -using System.Text.Json.Serialization.Metadata; [JsonSerializable(typeof(WTelegram.Session))] internal partial class WTelegramContext : JsonSerializerContext { } #endif @@ -24,9 +23,9 @@ namespace WTelegram /// For serializing indented Json with fields included public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, #if NET8_0_OR_GREATER - TypeInfoResolver = JsonSerializer.IsReflectionEnabledByDefault ? new DefaultJsonTypeInfoResolver() : WTelegramContext.Default, + TypeInfoResolver = JsonSerializer.IsReflectionEnabledByDefault ? null : WTelegramContext.Default, #endif - IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = System.Text.Json.Serialization.JsonIgnoreCondition.WhenWritingNull }; + IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; private static readonly ConsoleColor[] LogLevelToColor = [ ConsoleColor.DarkGray, ConsoleColor.DarkCyan, ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue ]; diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 428f243..8aa400a 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -88,6 +88,9 @@ namespace TL } return null; } +#if MTPG + public override void WriteTL(System.IO.BinaryWriter writer) => throw new NotImplementedException(); +#endif } /// Accumulate users/chats found in this structure in your dictionaries, ignoring Min constructors when the full object is already stored diff --git a/src/TL.cs b/src/TL.cs index 6d4541a..2eee871 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -11,7 +11,11 @@ using System.Text; namespace TL { +#if MTPG + public interface IObject { void WriteTL(BinaryWriter writer); } +#else public interface IObject { } +#endif public interface IMethod : IObject { } public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } @@ -39,6 +43,7 @@ namespace TL public sealed partial class ReactorError : IObject { public Exception Exception; + public void WriteTL(BinaryWriter writer) => throw new NotSupportedException(); } public static class Serialization @@ -46,6 +51,9 @@ namespace TL public static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } +#if MTPG + obj.WriteTL(writer); +#else var type = obj.GetType(); var tlDef = type.GetCustomAttribute(); var ctorNb = tlDef.CtorNb; @@ -63,14 +71,16 @@ namespace TL if (field.Name == "flags") flags = (uint)value; else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; } +#endif } public static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) { +#if MTPG + return reader.ReadTL(ctorNb); +#else if (ctorNb == 0) ctorNb = reader.ReadUInt32(); - if (ctorNb == Layer.GZipedCtor) - using (var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress))) - return ReadTLObject(gzipReader); + if (ctorNb == Layer.GZipedCtor) return reader.ReadTLGzipped(); if (!Layer.Table.TryGetValue(ctorNb, out var type)) throw new WTelegram.WTException($"Cannot find type for ctor #{ctorNb:x}"); if (type == null) return null; // nullable ctor (class meaning is associated with null) @@ -90,6 +100,7 @@ namespace TL else if (field.Name == "flags2") flags |= (ulong)(uint)value << 32; } return (IObject)obj; +#endif } internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) @@ -178,17 +189,6 @@ namespace TL } } - internal static void WriteTLVector(this BinaryWriter writer, Array array) - { - writer.Write(Layer.VectorCtor); - if (array == null) { writer.Write(0); return; } - int count = array.Length; - writer.Write(count); - var elementType = array.GetType().GetElementType(); - for (int i = 0; i < count; i++) - writer.WriteTLValue(array.GetValue(i), elementType); - } - internal static void WriteTLMessages(this BinaryWriter writer, _Message[] messages) { writer.Write(messages.Length); @@ -209,6 +209,38 @@ namespace TL } } + internal static void WriteTLVector(this BinaryWriter writer, Array array) + { + writer.Write(Layer.VectorCtor); + if (array == null) { writer.Write(0); return; } + int count = array.Length; + writer.Write(count); + var elementType = array.GetType().GetElementType(); + for (int i = 0; i < count; i++) + writer.WriteTLValue(array.GetValue(i), elementType); + } + + internal static T[] ReadTLRawVector(this BinaryReader reader, uint ctorNb) + { + int count = reader.ReadInt32(); + var array = new T[count]; + for (int i = 0; i < count; i++) + array[i] = (T)reader.ReadTLObject(ctorNb); + return array; + } + + internal static T[] ReadTLVector(this BinaryReader reader) + { + var elementType = typeof(T); + if (reader.ReadUInt32() is not Layer.VectorCtor and uint ctorNb) + throw new WTelegram.WTException($"Cannot deserialize {elementType.Name}[] with ctor #{ctorNb:x}"); + int count = reader.ReadInt32(); + var array = new T[count]; + for (int i = 0; i < count; i++) + array[i] = (T)reader.ReadTLValue(elementType); + return array; + } + internal static Array ReadTLVector(this BinaryReader reader, Type type) { var elementType = type.GetElementType(); @@ -240,14 +272,13 @@ namespace TL internal static Dictionary ReadTLDictionary(this BinaryReader reader) where T : class, IPeerInfo { uint ctorNb = reader.ReadUInt32(); - var elementType = typeof(T); if (ctorNb != Layer.VectorCtor) - throw new WTelegram.WTException($"Cannot deserialize Vector<{elementType.Name}> with ctor #{ctorNb:x}"); + throw new WTelegram.WTException($"Cannot deserialize Vector<{typeof(T).Name}> with ctor #{ctorNb:x}"); int count = reader.ReadInt32(); var dict = new Dictionary(count); for (int i = 0; i < count; i++) { - var value = (T)reader.ReadTLValue(elementType); + var value = (T)reader.ReadTLObject(); dict[value.ID] = value is UserEmpty ? null : value; } return dict; @@ -317,6 +348,19 @@ namespace TL writer.Write(0); // null arrays/strings are serialized as empty } + internal static IObject ReadTLGzipped(this BinaryReader reader) + { + using var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress)); + return ReadTLObject(gzipReader); + } + + internal static bool ReadTLBool(this BinaryReader reader) => reader.ReadUInt32() switch + { + 0x997275b5 => true, + 0xbc799737 => false, + var value => throw new WTelegram.WTException($"Invalid boolean value #{value:x}") + }; + #if DEBUG private static void ShouldntBeHere() => System.Diagnostics.Debugger.Break(); #else @@ -356,6 +400,9 @@ namespace TL { public Messages_AffectedMessages affected; public override (long, int, int) GetMBox() => (0, affected.pts, affected.pts_count); +#if MTPG + public override void WriteTL(BinaryWriter writer) => throw new NotSupportedException(); +#endif } // Below TL types are commented "parsed manually" from https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/Resources/tl/mtproto.tl diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d2b078c..73e5418 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -25,7 +25,7 @@ README.md $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) 0419;1573;1591;NETSDK1138 - TRACE;OBFUSCATION + TRACE;OBFUSCATION;MTPG @@ -42,6 +42,10 @@ --> + + + + From 270a7d89e66d33ceaa05e3a2ca5321c023f7d17b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 28 Mar 2024 12:31:06 +0100 Subject: [PATCH 187/336] Using a source generator to make the library compatible with NativeAOT trimming. --- .github/dev.yml | 2 +- .github/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index c9a88ef..b80f31d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -25,7 +25,7 @@ stages: - task: DotNetCoreCLI@2 inputs: command: 'pack' - packagesToPack: '**/*.csproj' + packagesToPack: 'src/WTelegramClient.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' diff --git a/.github/release.yml b/.github/release.yml index aa20ed8..47e6a28 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -28,7 +28,7 @@ stages: - task: DotNetCoreCLI@2 inputs: command: 'pack' - packagesToPack: '**/*.csproj' + packagesToPack: 'src/WTelegramClient.csproj' includesymbols: true versioningScheme: 'byEnvVar' versionEnvVar: 'Build.BuildNumber' From 3d224afb2385b2a67035cf0d0281bd032dc1b7a8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 29 Mar 2024 16:42:58 +0100 Subject: [PATCH 188/336] Renamed OnUpdate => OnUpdates (with temporary compatibility shim) --- EXAMPLES.md | 8 ++-- Examples/Program_DownloadSavedMedia.cs | 6 +-- Examples/Program_GetAllChats.cs | 1 - Examples/Program_Heroku.cs | 4 +- Examples/Program_ListenUpdates.cs | 4 +- Examples/Program_ReactorError.cs | 5 +-- Examples/Program_SecretChats.cs | 4 +- FAQ.md | 4 +- README.md | 2 +- src/Client.cs | 57 +++++++++++++------------- src/SecretChats.cs | 4 +- src/TL.cs | 2 +- 12 files changed, 49 insertions(+), 52 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 57b461d..8198f8f 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -187,7 +187,7 @@ Notes: ## Monitor all Telegram events happening for the user -This is done through the `client.OnUpdate` callback event. +This is done through the `client.OnUpdates` callback event. Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). @@ -195,7 +195,7 @@ See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient ## Monitor new messages being posted in chats in real-time -You have to handle `client.OnUpdate` events containing an `UpdateNewMessage`. +You have to handle `client.OnUpdates` events containing an `UpdateNewMessage`. See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). @@ -453,7 +453,7 @@ finally ## Collect Users/Chats description structures and access hash Many API calls return a structure with a `users` and a `chats` field at the root of the structure. -This is also the case for updates passed to `client.OnUpdate`. +This is also the case for updates passed to `client.OnUpdates`. These two dictionaries give details *(including access hash)* about the various users/chats that will be typically referenced in subobjects deeper in the structure, typically in the form of a `Peer` object or a `user_id`/`chat_id` field. @@ -473,7 +473,7 @@ private Dictionary _chats = new(); var dialogs = await client.Messages_GetAllDialogs(); dialogs.CollectUsersChats(_users, _chats); -private async Task OnUpdate(UpdatesBase updates) +private async Task OnUpdates(UpdatesBase updates) { updates.CollectUsersChats(_users, _chats); ... diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 186ddbb..11e2271 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -1,7 +1,5 @@ using System; -using System.Collections.Generic; using System.IO; -using System.Linq; using System.Threading.Tasks; using TL; @@ -15,10 +13,10 @@ namespace WTelegramClientTest Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); - client.OnUpdate += Client_OnUpdate; + client.OnUpdates += Client_OnUpdates; Console.ReadKey(); - async Task Client_OnUpdate(UpdatesBase updates) + async Task Client_OnUpdates(UpdatesBase updates) { foreach (var update in updates.UpdateList) { diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 02fc287..8d1c442 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -1,5 +1,4 @@ using System; -using System.Linq; using System.Threading.Tasks; using TL; diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 482b830..f1baa5a 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -30,7 +30,7 @@ namespace WTelegramClientTest Client = new WTelegram.Client(store.Length == 0 ? null : Environment.GetEnvironmentVariable, store); using (Client) { - Client.OnUpdate += Client_OnUpdate; + Client.OnUpdates += Client_OnUpdates; My = await Client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {My.username ?? My.first_name + " " + My.last_name} (id {My.id})"); var dialogs = await Client.Messages_GetAllDialogs(); @@ -39,7 +39,7 @@ namespace WTelegramClientTest } } - private static async Task Client_OnUpdate(UpdatesBase updates) + private static async Task Client_OnUpdates(UpdatesBase updates) { updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index ff0f502..fd2180e 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -20,7 +20,7 @@ namespace WTelegramClientTest Client = new WTelegram.Client(Environment.GetEnvironmentVariable); using (Client) { - Client.OnUpdate += Client_OnUpdate; + Client.OnUpdates += Client_OnUpdates; My = await Client.LoginUserIfNeeded(); Users[My.id] = My; // Note: on login, Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged @@ -33,7 +33,7 @@ namespace WTelegramClientTest } // if not using async/await, we could just return Task.CompletedTask - private static async Task Client_OnUpdate(UpdatesBase updates) + private static async Task Client_OnUpdates(UpdatesBase updates) { updates.CollectUsersChats(Users, Chats); if (updates is UpdateShortMessage usm && !Users.ContainsKey(usm.user_id)) diff --git a/Examples/Program_ReactorError.cs b/Examples/Program_ReactorError.cs index 5a8a0a8..ce0e629 100644 --- a/Examples/Program_ReactorError.cs +++ b/Examples/Program_ReactorError.cs @@ -1,6 +1,5 @@ using System; using System.Threading.Tasks; -using Telegram.Bot.Types; using TL; namespace WTelegramClientTest @@ -28,7 +27,7 @@ namespace WTelegramClientTest private static async Task CreateAndConnect() { Client = new WTelegram.Client(Environment.GetEnvironmentVariable); - Client.OnUpdate += Client_OnUpdate; + Client.OnUpdates += Client_OnUpdates; Client.OnOther += Client_OnOther; var my = await Client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as " + my); @@ -61,7 +60,7 @@ namespace WTelegramClientTest Console.WriteLine("Other: " + arg.GetType().Name); } - private static Task Client_OnUpdate(UpdatesBase updates) + private static Task Client_OnUpdates(UpdatesBase updates) { foreach (var update in updates.UpdateList) Console.WriteLine(update.GetType().Name); diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index 2d02d0d..bebd5ac 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -25,7 +25,7 @@ namespace WTelegramClientTest AppDomain.CurrentDomain.ProcessExit += (s, e) => { Secrets.Dispose(); Client.Dispose(); }; SelectActiveChat(); - Client.OnUpdate += Client_OnUpdate; + Client.OnUpdates += Client_OnUpdates; var myself = await Client.LoginUserIfNeeded(); Users[myself.id] = myself; Console.WriteLine($"We are logged-in as {myself}"); @@ -76,7 +76,7 @@ Type a command, or a message to send to the active secret chat:"); } while (true); } - private static async Task Client_OnUpdate(UpdatesBase updates) + private static async Task Client_OnUpdates(UpdatesBase updates) { updates.CollectUsersChats(Users, Chats); foreach (var update in updates.UpdateList) diff --git a/FAQ.md b/FAQ.md index 84d0df4..60e7377 100644 --- a/FAQ.md +++ b/FAQ.md @@ -143,7 +143,7 @@ Here are some advices from [another similar library](https://github.com/gotd/td/ Some additional advices from me: -5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdate` events. +5. Avoid repetitive polling or repetitive sequence of actions/requests: Save the initial results of your queries, and update those results when you're informed of a change through `OnUpdates` events. 6. Don't buy fake user accounts/sessions and don't extract api_id/hash/authkey/sessions from official clients, this is [specifically forbidden by API TOS](https://core.telegram.org/api/terms#2-transparency). You must use your own api_id and create your own sessions associated with it. 7. If a phone number is brand new, it will be closely monitored by Telegram for abuse, and it can even already be considered a bad user due to bad behavior from the previous owner of that phone number (which may happen often with VoIP or other easy-to-buy-online numbers, so expect fast ban) 8. You may want to use your new phone number account with an official Telegram client and act like a normal user for some time (some weeks/months), before using it for automation with WTelegramClient. @@ -261,7 +261,7 @@ The following choices were made while implementing Secret Chats in WTelegramClie If for some reason, we received them in incorrect order, messages are kept in memory until the requested missing messages are obtained. If those missing messages are never obtained during the session, incoming messages might get stuck and lost. - SecretChats file data is only valid for the current user, so make sure to pick the right file *(or a new file name)* if you change logged-in user. -- If you want to accept incoming Secret Chats request only from specific user, you must check it in OnUpdate before: +- If you want to accept incoming Secret Chats request only from specific user, you must check it in OnUpdates before: `await Secrets.HandleUpdate(ue, ue.chat is EncryptedChatRequested ecr && ecr.admin_id == EXPECTED_USER_ID);` - As recommended, new encryption keys are negotiated every 100 sent/received messages or after one week. If remote client doesn't complete this negotiation before reaching 200 messages, the Secret Chat is aborted. diff --git a/README.md b/README.md index 155f37f..fec7352 100644 --- a/README.md +++ b/README.md @@ -164,7 +164,7 @@ See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn m # Other things to know -The Client class also offers `OnUpdate` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. +The Client class also offers `OnUpdates` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) and [Examples/Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs?ts=4#L32) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. diff --git a/src/Client.cs b/src/Client.cs index af57f0b..b94b6b8 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -4,7 +4,6 @@ using System.Collections.Generic; using System.ComponentModel; using System.Globalization; using System.IO; -using System.IO.Compression; using System.Linq; using System.Net; using System.Net.Sockets; @@ -25,11 +24,13 @@ namespace WTelegram { /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
- public event Func OnUpdate; + public event Func OnUpdates; + [Obsolete("This event was renamed OnUpdates (plural)")] + public event Func OnUpdate { add { OnUpdates += value; } remove { OnUpdates -= value; } } /// This event is called for other types of notifications (login states, reactor errors, ...) public event Func OnOther; /// Use this handler to intercept Updates that resulted from your own API calls - public event Func OnOwnUpdate; + public event Func OnOwnUpdates; /// Used to create a TcpClient connected to the given address/port, or throw an exception on failure public TcpFactory TcpHandler { get; set; } = DefaultTcpHandler; public delegate Task TcpFactory(string host, int port); @@ -355,13 +356,13 @@ namespace WTelegram if (IsMainDC) { var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates - RaiseUpdate(updatesState); + RaiseUpdates(updatesState); } } catch { if (IsMainDC) - RaiseUpdate(reactorError); + RaiseUpdates(reactorError); lock (_pendingRpcs) // abort all pending requests { foreach (var rpc in _pendingRpcs.Values) @@ -583,11 +584,11 @@ namespace WTelegram else { Helpers.Log(1, $" → {result?.GetType().Name,-37} #{(short)msgId.GetHashCode():X4}"); - if (OnOwnUpdate != null) + if (OnOwnUpdates != null) if (result is UpdatesBase updates) - RaiseOwnUpdate(updates); + RaiseOwnUpdates(updates); else if (result is Messages_AffectedMessages affected) - RaiseOwnUpdate(new UpdateShort { update = new UpdateAffectedMessages { affected = affected }, date = MsgIdToStamp(_lastRecvMsgId) }); + RaiseOwnUpdates(new UpdateShort { update = new UpdateAffectedMessages { affected = affected }, date = MsgIdToStamp(_lastRecvMsgId) }); } rpc.tcs.SetResult(result); @@ -611,8 +612,8 @@ namespace WTelegram else { result = reader.ReadTLObject(ctorNb); - if (OnOwnUpdate != null && result is UpdatesBase updates) - RaiseOwnUpdate(updates); + if (OnOwnUpdates != null && result is UpdatesBase updates) + RaiseOwnUpdates(updates); } var typeName = result?.GetType().Name; @@ -673,7 +674,7 @@ namespace WTelegram break; case Pong pong: SetResult(pong.msg_id, pong); - RaiseUpdate(pong); + RaiseUpdates(pong); break; case FutureSalts futureSalts: SetResult(futureSalts.req_msg_id, futureSalts); @@ -733,10 +734,10 @@ namespace WTelegram rpc.tcs.SetException(new WTException($"BadMsgNotification {badMsgNotification.error_code}")); } else - RaiseUpdate(badMsgNotification); + RaiseUpdates(badMsgNotification); break; default: - RaiseUpdate(obj); + RaiseUpdates(obj); break; } @@ -746,32 +747,32 @@ namespace WTelegram if (rpc != null) rpc.tcs.SetResult(result); else - RaiseUpdate(obj); + RaiseUpdates(obj); } } - private async void RaiseUpdate(IObject obj) + private async void RaiseUpdates(IObject obj) { try { - var task = obj is UpdatesBase updates ? OnUpdate?.Invoke(updates) : OnOther?.Invoke(obj); + var task = obj is UpdatesBase updates ? OnUpdates?.Invoke(updates) : OnOther?.Invoke(obj); if (task != null) await task; } catch (Exception ex) { - Helpers.Log(4, $"{nameof(OnUpdate)}({obj?.GetType().Name}) raised {ex}"); + Helpers.Log(4, $"{nameof(OnUpdates)}({obj?.GetType().Name}) raised {ex}"); } } - private async void RaiseOwnUpdate(UpdatesBase updates) + private async void RaiseOwnUpdates(UpdatesBase updates) { try { - await OnOwnUpdate(updates); + await OnOwnUpdates(updates); } catch (Exception ex) { - Helpers.Log(4, $"{nameof(OnOwnUpdate)}({updates.GetType().Name}) raised {ex}"); + Helpers.Log(4, $"{nameof(OnOwnUpdates)}({updates.GetType().Name}) raised {ex}"); } } @@ -1050,7 +1051,7 @@ namespace WTelegram if (self.id == long.Parse(botToken.Split(':')[0])) { _session.UserId = _dcSession.UserId = self.id; - RaiseUpdate(self); + RaiseUpdates(self); return User = self; } Helpers.Log(3, $"Current logged user {self.id} mismatched bot_token. Logging out and in..."); @@ -1089,7 +1090,7 @@ namespace WTelegram self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; - RaiseUpdate(self); + RaiseUpdates(self); return User = self; } var mismatch = $"Current logged user {self.id} mismatched user_id or phone_number"; @@ -1124,7 +1125,7 @@ namespace WTelegram { phone_code_hash = setupSentCode.phone_code_hash; Helpers.Log(3, "A login email is required"); - RaiseUpdate(sentCodeBase); + RaiseUpdates(sentCodeBase); var email = _config("email"); if (string.IsNullOrEmpty(email)) sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); @@ -1135,7 +1136,7 @@ namespace WTelegram { var sentEmail = await this.Account_SendVerifyEmailCode(purpose, email); Helpers.Log(3, "An email verification code has been sent to " + sentEmail.email_pattern); - RaiseUpdate(sentEmail); + RaiseUpdates(sentEmail); } Account_EmailVerified verified = null; for (int retry = 1; verified == null; retry++) @@ -1166,7 +1167,7 @@ namespace WTelegram phone_code_hash = sentCode.phone_code_hash; var timeout = DateTime.UtcNow + TimeSpan.FromSeconds(sentCode.timeout); Helpers.Log(3, $"A verification code has been sent via {sentCode.type.GetType().Name[17..]}"); - RaiseUpdate(sentCode); + RaiseUpdates(sentCode); if (sentCode.type is Auth_SentCodeTypeFirebaseSms firebaseSms) { var token = await ConfigAsync("firebase"); @@ -1210,7 +1211,7 @@ namespace WTelegram try { var accountPassword = await this.Account_GetPassword(); - RaiseUpdate(accountPassword); + RaiseUpdates(accountPassword); var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); authorization = await this.Auth_CheckPassword(checkPasswordSRP); } @@ -1230,7 +1231,7 @@ namespace WTelegram if (authorization is Auth_AuthorizationSignUpRequired signUpRequired) { var waitUntil = DateTime.UtcNow.AddSeconds(3); - RaiseUpdate(signUpRequired); // give caller the possibility to read and accept TOS + RaiseUpdates(signUpRequired); // give caller the possibility to read and accept TOS var first_name = Config("first_name"); var last_name = Config("last_name"); var wait = waitUntil - DateTime.UtcNow; @@ -1257,7 +1258,7 @@ namespace WTelegram throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); _session.UserId = _dcSession.UserId = self.id; lock (_session) _session.Save(); - RaiseUpdate(self); + RaiseUpdates(self); return User = self; } diff --git a/src/SecretChats.cs b/src/SecretChats.cs index c7b78cf..5773c8c 100644 --- a/src/SecretChats.cs +++ b/src/SecretChats.cs @@ -21,7 +21,7 @@ namespace WTelegram int RemoteLayer { get; } } - [TLDef(0xFEFEFEFE)] + [TLDef(0xFEFEFEFE)] [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006:Naming Styles")] internal sealed partial class SecretChat : IObject, ISecretChat { [Flags] public enum Flags : uint { requestChat = 1, renewKey = 2, acceptKey = 4, originator = 8, commitKey = 16 } @@ -170,7 +170,7 @@ namespace WTelegram return chat_id; } - /// Processes the you received from Telegram (). + /// Processes the you received from Telegram (). /// If update.chat is , you might want to first make sure you want to accept this secret chat initiated by user /// Incoming requests for secret chats are automatically: accepted (), rejected () or ignored () /// if the update was handled successfully diff --git a/src/TL.cs b/src/TL.cs index 2eee871..e526e40 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -396,7 +396,7 @@ namespace TL public static implicit operator byte[](Int256 int256) => int256.raw; } - public sealed partial class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdate in case of such API call result + public sealed partial class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdates in case of such API call result { public Messages_AffectedMessages affected; public override (long, int, int) GetMBox() => (0, affected.pts, affected.pts_count); From 210a3365e5966540c505c849854d9c7d29583e7b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 30 Mar 2024 17:09:54 +0100 Subject: [PATCH 189/336] Introducing the UpdateManager to streamline the handling of continuous updates (see FAQ) --- EXAMPLES.md | 20 +- Examples/Program_ListenUpdates.cs | 57 ++-- FAQ.md | 32 ++ README.md | 5 +- src/Client.cs | 5 +- src/Helpers.cs | 3 + src/UpdateManager.cs | 544 ++++++++++++++++++++++++++++++ src/WTelegramClient.csproj | 1 + 8 files changed, 620 insertions(+), 47 deletions(-) create mode 100644 src/UpdateManager.cs diff --git a/EXAMPLES.md b/EXAMPLES.md index 8198f8f..9c5b463 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -95,7 +95,7 @@ foreach (Dialog dialog in dialogs.dialogs) Notes: - The lists returned by Messages_GetAllDialogs contains the `access_hash` for those chats and users. -- See also the `Main` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L20). +- See also the `Main` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L18). - To retrieve the dialog information about a specific [peer](README.md#terminology), use `client.Messages_GetPeerDialogs(inputPeer)` @@ -114,7 +114,7 @@ Notes: - The list returned by Messages_GetAllChats contains the `access_hash` for those chats. Read [FAQ #4](FAQ.md#access-hash) about this. - If a basic chat group has been migrated to a supergroup, you may find both the old `Chat` and a `Channel` with different IDs in the `chats.chats` result, but the old `Chat` will be marked with flag [deactivated] and should not be used anymore. See [Terminology in ReadMe](README.md#terminology). -- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_GetAllChats.cs?ts=4#L32) +- You can find a longer version of this method call in [Examples/Program_GetAllChats.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_GetAllChats.cs?ts=4#L31) ## List the members from a chat @@ -187,17 +187,17 @@ Notes: ## Monitor all Telegram events happening for the user -This is done through the `client.OnUpdates` callback event. -Your event handler implementation can either return `Task.CompletedTask` or be an `async Task` method. +This is done through the `client.OnUpdates` callback event, or via the [UpdateManager class](FAQ.md#manager) that simplifies the handling of updates. -See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21). ## Monitor new messages being posted in chats in real-time -You have to handle `client.OnUpdates` events containing an `UpdateNewMessage`. +You have to handle update events containing an `UpdateNewMessage`. +This can be done through the `client.OnUpdates` callback event, or via the [UpdateManager class](FAQ.md#manager) that simplifies the handling of updates. -See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23). +See the `HandleMessage` method in [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21). You can filter specific chats the message are posted in, by looking at the `Message.peer_id` field. See also [explanation below](#message-user) to extract user/chat info from messages. @@ -208,7 +208,7 @@ See also [explanation below](#message-user) to extract user/chat info from messa This is done using the helper method `client.DownloadFileAsync(file, outputStream)` that simplifies the download of a photo/document/file once you get a reference to its location *(through updates or API calls)*. -See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L31) that download all media files you forward to yourself (Saved Messages) +See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages) ## Upload a media file and post it with caption to a chat @@ -498,6 +498,8 @@ A message contains those two fields/properties: These two fields derive from class `Peer` and can be of type `PeerChat`, `PeerChannel` or `PeerUser` depending on the nature of WHERE & WHO (private chat with a user? message posted BY a channel IN a chat? ...) +> ✳️ It is recommended that you use the [UpdateManager class](FAQ.md#manager), as it handles automatically all of the details below, and you just need to use `Manager.UserOrChat(peer)` or Manager.Users/Chats dictionaries + The root structure where you obtained the message (typically `UpdatesBase` or `Messages_MessagesBase`) inherits from `IPeerResolver`. This allows you to call `.UserOrChat(peer)` on the root structure, in order to resolve those fields into a `User` class, or a `ChatBase`-derived class (typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID. @@ -506,7 +508,7 @@ However, in some case _(typically when dealing with updates)_, Telegram might ch because it expects you to already know about it (`UserOrChat` returns `null`). That's why you should collect users/chats details each time you're dealing with Updates or other API results inheriting from `IPeerResolver`, and use the collected dictionaries to find details about users/chats -([see previous section](#collect-users-chats) and [Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) example) +([see previous section](#collect-users-chats) and [Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21) example) And finally, it may happen that you receive updates of type `UpdateShortMessage` or `UpdateShortChatMessage` with totally unknown peers (even in your collected dictionaries). In this case, [Telegram recommends](https://core.telegram.org/api/updates#recovering-gaps) that you use the [`Updates_GetDifference`](https://corefork.telegram.org/method/updates.getDifference) method to retrieve the full information associated with the short message. diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index fd2180e..0bf7f4a 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -1,5 +1,4 @@ using System; -using System.Collections.Generic; using System.Threading.Tasks; using TL; @@ -8,9 +7,8 @@ namespace WTelegramClientTest static class Program_ListenUpdates { static WTelegram.Client Client; + static WTelegram.UpdateManager Manager; static User My; - static readonly Dictionary Users = []; - static readonly Dictionary Chats = []; // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) @@ -20,43 +18,37 @@ namespace WTelegramClientTest Client = new WTelegram.Client(Environment.GetEnvironmentVariable); using (Client) { - Client.OnUpdates += Client_OnUpdates; + Manager = Client.WithUpdateManager(Client_OnUpdate/*, "Updates.state"*/); My = await Client.LoginUserIfNeeded(); - Users[My.id] = My; // Note: on login, Telegram may sends a bunch of updates/messages that happened in the past and were not acknowledged Console.WriteLine($"We are logged-in as {My.username ?? My.first_name + " " + My.last_name} (id {My.id})"); // We collect all infos about the users/chats so that updates can be printed with their names var dialogs = await Client.Messages_GetAllDialogs(); // dialogs = groups/channels/users - dialogs.CollectUsersChats(Users, Chats); + dialogs.CollectUsersChats(Manager.Users, Manager.Chats); Console.ReadKey(); } + //Manager.SaveState("Updates.state"); // if you want to resume missed updates on the next run (see WithUpdateManager above) } // if not using async/await, we could just return Task.CompletedTask - private static async Task Client_OnUpdates(UpdatesBase updates) + private static async Task Client_OnUpdate(Update update) { - updates.CollectUsersChats(Users, Chats); - if (updates is UpdateShortMessage usm && !Users.ContainsKey(usm.user_id)) - (await Client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0)).CollectUsersChats(Users, Chats); - else if (updates is UpdateShortChatMessage uscm && (!Users.ContainsKey(uscm.from_id) || !Chats.ContainsKey(uscm.chat_id))) - (await Client.Updates_GetDifference(uscm.pts - uscm.pts_count, uscm.date, 0)).CollectUsersChats(Users, Chats); - foreach (var update in updates.UpdateList) - switch (update) - { - case UpdateNewMessage unm: await HandleMessage(unm.message); break; - case UpdateEditMessage uem: await HandleMessage(uem.message, true); break; - // Note: UpdateNewChannelMessage and UpdateEditChannelMessage are also handled by above cases - case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break; - case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; - case UpdateUserTyping uut: Console.WriteLine($"{User(uut.user_id)} is {uut.action}"); break; - case UpdateChatUserTyping ucut: Console.WriteLine($"{Peer(ucut.from_id)} is {ucut.action} in {Chat(ucut.chat_id)}"); break; - case UpdateChannelUserTyping ucut2: Console.WriteLine($"{Peer(ucut2.from_id)} is {ucut2.action} in {Chat(ucut2.channel_id)}"); break; - case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {Chat(cp.chat_id)}"); break; - case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; - case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; - case UpdateUser uu: Console.WriteLine($"{User(uu.user_id)} has changed infos/photo"); break; - default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above example cases - } + switch (update) + { + case UpdateNewMessage unm: await HandleMessage(unm.message); break; + case UpdateEditMessage uem: await HandleMessage(uem.message, true); break; + // Note: UpdateNewChannelMessage and UpdateEditChannelMessage are also handled by above cases + case UpdateDeleteChannelMessages udcm: Console.WriteLine($"{udcm.messages.Length} message(s) deleted in {Chat(udcm.channel_id)}"); break; + case UpdateDeleteMessages udm: Console.WriteLine($"{udm.messages.Length} message(s) deleted"); break; + case UpdateUserTyping uut: Console.WriteLine($"{User(uut.user_id)} is {uut.action}"); break; + case UpdateChatUserTyping ucut: Console.WriteLine($"{Peer(ucut.from_id)} is {ucut.action} in {Chat(ucut.chat_id)}"); break; + case UpdateChannelUserTyping ucut2: Console.WriteLine($"{Peer(ucut2.from_id)} is {ucut2.action} in {Chat(ucut2.channel_id)}"); break; + case UpdateChatParticipants { participants: ChatParticipants cp }: Console.WriteLine($"{cp.participants.Length} participants in {Chat(cp.chat_id)}"); break; + case UpdateUserStatus uus: Console.WriteLine($"{User(uus.user_id)} is now {uus.status.GetType().Name[10..]}"); break; + case UpdateUserName uun: Console.WriteLine($"{User(uun.user_id)} has changed profile name: {uun.first_name} {uun.last_name}"); break; + case UpdateUser uu: Console.WriteLine($"{User(uu.user_id)} has changed infos/photo"); break; + default: Console.WriteLine(update.GetType().Name); break; // there are much more update types than the above example cases + } } // in this example method, we're not using async/await, so we just return Task.CompletedTask @@ -71,9 +63,8 @@ namespace WTelegramClientTest return Task.CompletedTask; } - private static string User(long id) => Users.TryGetValue(id, out var user) ? user.ToString() : $"User {id}"; - private static string Chat(long id) => Chats.TryGetValue(id, out var chat) ? chat.ToString() : $"Chat {id}"; - private static string Peer(Peer peer) => peer is null ? null : peer is PeerUser user ? User(user.user_id) - : peer is PeerChat or PeerChannel ? Chat(peer.ID) : $"Peer {peer.ID}"; + private static string User(long id) => Manager.Users.TryGetValue(id, out var user) ? user.ToString() : $"User {id}"; + private static string Chat(long id) => Manager.Chats.TryGetValue(id, out var chat) ? chat.ToString() : $"Chat {id}"; + private static string Peer(Peer peer) => Manager.UserOrChat(peer)?.ToString() ?? $"Peer {peer?.ID}"; } } diff --git a/FAQ.md b/FAQ.md index 60e7377..e24b20c 100644 --- a/FAQ.md +++ b/FAQ.md @@ -329,3 +329,35 @@ For a console program, this is typical done by waiting for a key or some close e 5) Is every Telegram API call rejected? (typically with an exception message like `AUTH_RESTART`) The user authentification might have failed at some point (or the user revoked the authorization). It is therefore necessary to go through the authentification again. This can be done by deleting the WTelegram.session file, or at runtime by calling `client.Reset()` + + +# About the UpdateManager + +The UpdateManager does the following: +- ensure the correct sequential order of receiving updates (Telegram may send them in wrong order) +- fetch the missing updates if there was a gap (missing update) in the flow of incoming updates +- resume the flow of updates where you left off if you stopped your program (with saved state) +- collect the users & chats from updates automatically for you _(by default)_ +- simplifies the handling of the various containers of update (UpdatesBase) + +To use the UpdateManager, instead of setting `client.OnUpdates`, you call: +```csharp +// if you don't care about missed updates while your program was down: +var manager = client.WithUpdateManager(OnUpdate); + +// if you want to recover missed updates using the state saved on the last run of your program +var manager = client.WithUpdateManager(OnUpdate, "Updates.state"); +// to save the state later, preferably after disposing the client: +manager.SaveState("Updates.state") + +// (WithUpdateManager has other parameters for advanced use) +``` + +Your `OnUpdate` method will directly take a single `Update` as parameter, instead of a container of updates. +The `manager.Users` and `manager.Chats` dictionaries will collect the users/chats data from updates. +You can also feed them manually from result of your API calls by calling `result.CollectUsersChats(manager.Users, manager.Chats);` and resolve Peer fields via `manager.UserOrChat(peer)` +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21) for an example of implementation. + +Notes: +- set `manager.Log` if you want different logger settings than the client +- `WithUpdateManager()` has other parameters for advanced use \ No newline at end of file diff --git a/README.md b/README.md index fec7352..15877e3 100644 --- a/README.md +++ b/README.md @@ -164,8 +164,9 @@ See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn m # Other things to know -The Client class also offers `OnUpdates` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. -See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L23) and [Examples/Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs?ts=4#L32) +The Client class offers `OnUpdates` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. +You can also use the [UpdateManager class](https://wiz0u.github.io/WTelegramClient/FAQ#manager) to simplify the handling of such updates. +See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21) and [Examples/Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs?ts=4#L30) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. diff --git a/src/Client.cs b/src/Client.cs index b94b6b8..4e34177 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -23,9 +23,9 @@ namespace WTelegram public partial class Client : IDisposable { /// This event will be called when unsollicited updates/messages are sent by Telegram servers - /// Make your handler , or return or
See Examples/Program_ListenUpdate.cs for how to use this
+ /// Make your handler , or return or
See Examples/Program_ReactorError.cs for how to use this
or Examples/Program_ListenUpdate.cs using the UpdateManager class instead
public event Func OnUpdates; - [Obsolete("This event was renamed OnUpdates (plural)")] + [Obsolete("This event was renamed OnUpdates (plural). You may also want to consider using our new UpdateManager class instead (see FAQ)")] public event Func OnUpdate { add { OnUpdates += value; } remove { OnUpdates -= value; } } /// This event is called for other types of notifications (login states, reactor errors, ...) public event Func OnOther; @@ -352,7 +352,6 @@ namespace WTelegram _pendingRpcs.Clear(); _bareRpc = null; } - // TODO: implement an Updates gaps handling system? https://core.telegram.org/api/updates if (IsMainDC) { var updatesState = await this.Updates_GetState(); // this call reenables incoming Updates diff --git a/src/Helpers.cs b/src/Helpers.cs index e716078..d483cb6 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -10,6 +10,9 @@ using System.Threading.Tasks; #if NET8_0_OR_GREATER [JsonSerializable(typeof(WTelegram.Session))] +[JsonSerializable(typeof(Dictionary))] +[JsonSerializable(typeof(IDictionary))] +[JsonSerializable(typeof(System.Collections.Immutable.ImmutableDictionary))] internal partial class WTelegramContext : JsonSerializerContext { } #endif diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs new file mode 100644 index 0000000..b26fa70 --- /dev/null +++ b/src/UpdateManager.cs @@ -0,0 +1,544 @@ +using System; +using System.Collections.Generic; +using System.Collections.Immutable; +using System.ComponentModel; +using System.Linq; +using System.Threading; +using System.Threading.Tasks; +using TL; + +namespace WTelegram +{ + public delegate IPeerInfo UserChatCollector(Dictionary users, Dictionary chats); + + public class UpdateManager : IPeerResolver + { + /// Collected info about Users (only if using the default collector) + public readonly Dictionary Users; + /// Collected info about Chats (only if using the default collector) + public readonly Dictionary Chats; + /// Timout to detect lack of updates and force refetch them + public TimeSpan InactivityThreshold { get; set; } = TimeSpan.FromMinutes(15); + /// Logging callback (defaults to WTelegram.Helpers.Log ; can be null for performance) + public Action Log { get; set; } = Helpers.Log; + /// Current set of update states (for saving and later resume) + public ImmutableDictionary State + { + get + { + _sem.Wait(); + try { return _local.ToImmutableDictionary(); } + finally { _sem.Release(); } + } + } + + [System.Diagnostics.CodeAnalysis.SuppressMessage("Style", "IDE1006")] + public sealed class MBoxState { public int pts { get; set; } public long access_hash { get; set; } } + + private readonly Client _client; + private readonly Func _onUpdate; + private readonly UserChatCollector _onCollect; + private readonly bool _reentrant; + private readonly SemaphoreSlim _sem = new(1); + private readonly Extensions.CollectorPeer _collector; + private readonly List<(Update update, UpdatesBase updates, bool own, DateTime stamp)> _pending = []; + private readonly Dictionary _local; // -2 for seq/date, -1 for qts, 0 for common pts, >0 for channel pts + private const int L_SEQ = -2, L_QTS = -1, L_PTS = 0; + private const long UndefinedSeqDate = 3155378975999999999L; // DateTime.MaxValue.Ticks + private static readonly TimeSpan HalfSec = new(TimeSpan.TicksPerSecond / 2); + private Task _recoveringGaps; + private DateTime _lastUpdateStamp = DateTime.UtcNow; + + /// Manager ensuring that you receive Telegram updates in correct order, without missing any + /// the WTelegram Client to manage + /// Event to be called on sequential individual update + /// (optional) Resume session by recovering all updates that occured since this state + /// Custom users/chats collector. By default, those are collected in properties Users/Chats + /// if your method can be called again even when last async call didn't return yet + public UpdateManager(Client client, Func onUpdate, IDictionary state = null, UserChatCollector collector = null, bool reentrant = false) + { + _client = client; + _onUpdate = onUpdate; + if (collector != null) + _onCollect = collector; + else + { + _collector = new() { _users = Users = [], _chats = Chats = [] }; + _onCollect = _collector.UserOrChat; + } + + if (state == null) + _local = new() { [L_SEQ] = new() { access_hash = UndefinedSeqDate }, [L_QTS] = new(), [L_PTS] = new() }; + else + _local = state as Dictionary ?? new Dictionary(state); + _reentrant = reentrant; + client.OnOther += OnOther; + client.OnUpdates += u => OnUpdates(u, false); + client.OnOwnUpdates += u => OnUpdates(u, true); + } + + private async Task OnOther(IObject obj) + { + switch (obj) + { + case Pong when DateTime.UtcNow - _lastUpdateStamp > InactivityThreshold: + if (_local[L_PTS].pts != 0) await ResyncState(); + break; + case User user when user.flags.HasFlag(User.Flags.self): + if (Users != null) Users[user.id] = user; + goto newSession; + case NewSessionCreated when _client.User != null: + newSession: + if (_local[L_PTS].pts != 0) await ResyncState(); + else await ResyncState(await _client.Updates_GetState()); + break; + case Updates_State state: + await ResyncState(state); + break; + } + } + + private async Task ResyncState(Updates_State state = null) + { + state ??= new() { qts = int.MaxValue }; + await _sem.WaitAsync(); + try + { + var local = _local[L_PTS]; + Log?.Invoke(2, $"Got Updates_State {local.pts}->{state.pts}, date={new DateTime(_local[L_SEQ].access_hash, DateTimeKind.Utc)}->{state.date}, seq={_local[L_SEQ].pts}->{state.seq}"); + if (local.pts == 0 || local.pts >= state.pts && _local[L_SEQ].pts >= state.seq && _local[L_QTS].pts >= state.qts) + await HandleDifference(null, null, state, null); + else if (await GetDifference(L_PTS, state.pts, local)) + await ApplyFilledGaps(); + } + finally { _sem.Release(); } + } + + private async Task OnUpdates(UpdatesBase updates, bool own) + { + RaiseCollect(updates.Users, updates.Chats); + await _sem.WaitAsync(); + try + { + await HandleUpdates(updates, own); + } + finally { _sem.Release(); } + } + + private async Task HandleUpdates(UpdatesBase updates, bool own) + { + var now = _lastUpdateStamp = DateTime.UtcNow; + var updateList = updates.UpdateList; + if (updates is UpdateShortSentMessage sent) + updateList = new[] { new UpdateNewMessage { pts = sent.pts, pts_count = sent.pts_count, message = new Message { + flags = (Message.Flags)sent.flags, + id = sent.id, date = sent.date, entities = sent.entities, media = sent.media, ttl_period = sent.ttl_period, + } } }; + else if (Users != null) + if (updates is UpdateShortMessage usm && !Users.ContainsKey(usm.user_id)) + (await _client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0)).UserOrChat(_collector); + else if (updates is UpdateShortChatMessage uscm && (!Users.ContainsKey(uscm.from_id) || !Chats.ContainsKey(uscm.chat_id))) + (await _client.Updates_GetDifference(uscm.pts - uscm.pts_count, uscm.date, 0)).UserOrChat(_collector); + + bool ptsChanged = false, gotUPts = false; + int seq = 0; + try + { + if (updates is UpdatesTooLong) + { + var local_pts = _local[L_PTS]; + ptsChanged = await GetDifference(L_PTS, local_pts.pts, local_pts); + return; + } + foreach (var update in updateList) + { + if (update == null) continue; + var (mbox_id, pts, pts_count) = update.GetMBox(); + if (pts == 0) (mbox_id, pts, pts_count) = updates.GetMBox(); + MBoxState local = null; + if (pts != 0) + { + local = _local.GetOrCreate(mbox_id); + if (mbox_id > 0 && local.access_hash == 0) + if (updates.Chats.TryGetValue(mbox_id, out var chat) && chat is Channel channel && !channel.flags.HasFlag(Channel.Flags.min)) + local.access_hash = channel.access_hash; + var diff = local.pts + pts_count - pts; + if (diff > 0 && pts_count != 0) // the update was already applied, and must be ignored. + { + Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} ignored {ExtendedLog(update)}"); + continue; + } + if (diff < 0) // there's an update gap that must be filled. + { + Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} pending {ExtendedLog(update)}"); + _pending.Add((update, updates, own, now + HalfSec)); + _recoveringGaps ??= Task.Delay(HalfSec).ContinueWith(RecoverGaps); + continue; + } + // the update can be applied. + } + Log?.Invoke(1, $"({mbox_id,10}, {local?.pts,6}+{pts_count}->{pts,-6}) {update,-30} applied {ExtendedLog(update)}"); + if (mbox_id == L_SEQ && update is UpdatePtsChanged) gotUPts = true; + if (pts_count > 0 && pts != 0) + { + ptsChanged = true; + if (mbox_id == L_SEQ) + seq = pts; + else if (pts_count != 0) + local.pts = pts; + } + await RaiseUpdate(update, own); + } + } + finally + { + if (seq > 0) // update local_seq & date after the updates were applied + { + var local_seq = _local[L_SEQ]; + local_seq.pts = seq; + local_seq.access_hash = updates.Date.Ticks; + } + if (gotUPts) ptsChanged = await GetDifference(L_PTS, _local[L_PTS].pts = 1, _local[L_PTS]); + if (ptsChanged) await ApplyFilledGaps(); + } + } + + private async Task ApplyFilledGaps() + { + if (_pending.Count != 0) Log?.Invoke(2, $"Trying to apply {_pending.Count} pending updates after filled gaps"); + int removed = 0; + for (int i = 0; i < _pending.Count; ) + { + var (update, updates, own, _) = _pending[i]; + var (mbox_id, pts, pts_count) = update.GetMBox(); + if (pts == 0) (mbox_id, pts, pts_count) = updates.GetMBox(); + var local = _local[mbox_id]; + var diff = local.pts + pts_count - pts; + if (diff < 0) + ++i; // there's still a gap, skip it + else + { + _pending.RemoveAt(i); + ++removed; + if (diff > 0) // the update was already applied, remove & ignore + Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} obsolete {ExtendedLog(update)}"); + else + { + Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} applied now {ExtendedLog(update)}"); + // the update can be applied. + local.pts = pts; + if (mbox_id == L_SEQ) local.access_hash = updates.Date.Ticks; + await RaiseUpdate(update, own); + i = 0; // rescan pending updates from start + } + } + } + return removed; + } + + private async Task RecoverGaps(Task _) // https://corefork.telegram.org/api/updates#recovering-gaps + { + await _sem.WaitAsync(); + try + { + _recoveringGaps = null; + if (_pending.Count == 0) return; + Log?.Invoke(2, $"Trying to recover gaps for {_pending.Count} pending updates"); + var now = DateTime.UtcNow; + while (_pending.Count != 0) + { + var (update, updates, own, stamp) = _pending[0]; + if (stamp > now) + { + _recoveringGaps = Task.Delay(stamp - now).ContinueWith(RecoverGaps); + return; + } + var (mbox_id, pts, pts_count) = update.GetMBox(); + if (pts == 0) (mbox_id, pts, pts_count) = updates.GetMBox(); + var local = _local[mbox_id]; + bool getDiffSuccess = false; + if (local.pts == 0) + Log?.Invoke(2, $"({mbox_id,10}, new +{pts_count}->{pts,-6}) {update,-30} First appearance of MBox {ExtendedLog(update)}"); + else if (local.access_hash == -1) // no valid access_hash for this channel, so just raise this update + Log?.Invoke(3, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} No access_hash to recover {ExtendedLog(update)}"); + else + { + Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} Calling GetDifference {ExtendedLog(update)}"); + getDiffSuccess = await GetDifference(mbox_id, pts - pts_count, local); + } + if (!getDiffSuccess) // no getDiff => just raise received pending updates in order + { + local.pts = pts - pts_count; + for (int i = 1; i < _pending.Count; i++) // find lowest pending pts-pts_count for this mbox + { + var pending = _pending[i]; + var mbox = pending.update.GetMBox(); + if (mbox.pts == 0) mbox = pending.updates.GetMBox(); + if (mbox.mbox_id == mbox_id) local.pts = Math.Min(local.pts, mbox.pts - mbox.pts_count); + } + } + + if (await ApplyFilledGaps() == 0) + { + Log?.Invoke(3, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} forcibly removed!"); + _pending.RemoveAt(0); + local.pts = pts; + await RaiseUpdate(update, own); + } + } + } + finally { _sem.Release(); } + } + + private async Task GetInputChannel(long channel_id, MBoxState local) + { + if (channel_id <= 0) return null; + if (local?.access_hash is not null and not 0) + return new InputChannel(channel_id, local.access_hash); + var inputChannel = new InputChannel(channel_id, 0); + try + { + var mc = await _client.Channels_GetChannels(inputChannel); + if (mc.chats.TryGetValue(channel_id, out var chat) && chat is Channel channel) + inputChannel.access_hash = channel.access_hash; + } + catch (Exception) + { + inputChannel.access_hash = -1; // no valid access_hash available + } + local ??= _local[channel_id] = new(); + local.access_hash = inputChannel.access_hash; + return inputChannel; + } + + private async Task GetDifference(long mbox_id, int expected_pts, MBoxState local) + { + try + { + moreDiffNeeded: + if (mbox_id <= 0) + { + Log?.Invoke(0, $"Local states {string.Join(" ", _local.Select(l => $"{l.Key}:{l.Value.pts}"))}"); + var local_seq = _local[L_SEQ]; + var diff = await _client.Updates_GetDifference(_local[L_PTS].pts, qts: _local[L_QTS].pts, + date: new DateTime(local_seq.access_hash, DateTimeKind.Utc)); + Log?.Invoke(1, $"{diff.GetType().Name[8..]}: {diff.NewMessages.Length} msg, {diff.OtherUpdates.Length} upd, pts={diff.State?.pts}, date={diff.State?.date}, seq={diff.State?.seq}, msgIDs={string.Join(" ", diff.NewMessages.Select(m => m.ID))}"); + switch (diff) + { + case Updates_Difference ud: + await HandleDifference(ud.new_messages, ud.new_encrypted_messages, ud.state, + new UpdatesCombined { updates = ud.other_updates, users = ud.users, chats = ud.chats, + date = ud.state.date, seq_start = local_seq.pts + 1, seq = ud.state.seq }); + break; + case Updates_DifferenceSlice uds: + await HandleDifference(uds.new_messages, uds.new_encrypted_messages, uds.intermediate_state, + new UpdatesCombined { updates = uds.other_updates, users = uds.users, chats = uds.chats, + date = uds.intermediate_state.date, seq_start = local_seq.pts + 1, seq = uds.intermediate_state.seq }); + goto moreDiffNeeded; + case Updates_DifferenceTooLong udtl: + _local[L_PTS].pts = udtl.pts; + goto moreDiffNeeded; + case Updates_DifferenceEmpty ude: + local_seq.pts = ude.seq; + local_seq.access_hash = ude.date.Ticks; + _lastUpdateStamp = DateTime.UtcNow; + break; + } + } + else + { + var channel = await GetInputChannel(mbox_id, local); + if (channel.access_hash == -1) return false; + try + { + var diff = await _client.Updates_GetChannelDifference(channel, null, local.pts); + Log?.Invoke(1, $"{diff.GetType().Name[8..]}({mbox_id}): {diff.NewMessages.Length} msg, {diff.OtherUpdates.Length} upd, pts={diff.Pts}, msgIDs={string.Join(" ", diff.NewMessages.Select(m => m.ID))}"); + switch (diff) + { + case Updates_ChannelDifference ucd: + local.pts = ucd.pts; + await HandleDifference(ucd.new_messages, null, null, + new UpdatesCombined { updates = ucd.other_updates, users = ucd.users, chats = ucd.chats }); + if (!ucd.flags.HasFlag(Updates_ChannelDifference.Flags.final)) goto moreDiffNeeded; + break; + case Updates_ChannelDifferenceTooLong ucdtl: + if (ucdtl.dialog is Dialog dialog) local.pts = dialog.pts; + await HandleDifference(ucdtl.messages, null, null, + new UpdatesCombined { updates = null, users = ucdtl.users, chats = ucdtl.chats }); + break; + case Updates_ChannelDifferenceEmpty ucde: + local.pts = ucde.pts; + break; + } + } + catch (RpcException ex) when (ex.Message is "CHANNEL_PRIVATE" or "CHANNEL_INVALID") + { + local.access_hash = -1; // access_hash is no longer valid + throw; + } + } + return true; + } + catch (Exception ex) + { + Log?.Invoke(4, $"GetDifference({mbox_id}, {local.pts}->{expected_pts}) raised {ex}"); + } + finally + { + if (local.pts < expected_pts) local.pts = expected_pts; + } + return false; + } + + private async Task HandleDifference(MessageBase[] new_messages, EncryptedMessageBase[] enc_messages, Updates_State state, UpdatesCombined updates) + { + if (updates != null) + RaiseCollect(updates.users, updates.chats); + try + { + if (updates?.updates != null) + for (int i = 0; i < updates.updates.Length; i++) + { + var update = updates.updates[i]; + if (update is UpdateMessageID or UpdateStoryID) + { + await RaiseUpdate(update, false); + updates.updates[i] = null; + } + } + if (new_messages?.Length > 0) + { + var update = state == null ? new UpdateNewChannelMessage() : new UpdateNewMessage() { pts = state.pts, pts_count = 1 }; + foreach (var msg in new_messages) + { + update.message = msg; + await RaiseUpdate(update, false); + } + } + if (enc_messages?.Length > 0) + { + var update = new UpdateNewEncryptedMessage(); + if (state != null) update.qts = state.qts; + foreach (var msg in enc_messages) + { + update.message = msg; + await RaiseUpdate(update, false); + } + } + if (updates?.updates != null) + await HandleUpdates(updates, false); + } + finally + { + if (state != null) + { + _local[L_PTS].pts = state.pts; + _local[L_QTS].pts = state.qts; + var local_seq = _local[L_SEQ]; + local_seq.pts = state.seq; + local_seq.access_hash = state.date.Ticks; + } + } + } + + private void RaiseCollect(Dictionary users, Dictionary chats) + { + try + { + foreach (var chat in chats.Values) + if (chat is Channel channel && !channel.flags.HasFlag(Channel.Flags.min)) + if (_local.TryGetValue(channel.id, out var local)) + local.access_hash = channel.access_hash; + _onCollect(users, chats); + } + catch (Exception ex) + { + Log?.Invoke(4, $"onCollect({users?.Count},{chats?.Count}) raised {ex}"); + } + } + + private async Task RaiseUpdate(Update update, bool own) + { + if (own) return; + try + { + var task = _onUpdate(update); + if (!_reentrant) await task; + } + catch (Exception ex) + { + Log?.Invoke(4, $"onUpdate({update?.GetType().Name}) raised {ex}"); + } + } + + private static string ExtendedLog(Update update) => update switch + { + UpdateNewMessage unm => $"| msgID={unm.message.ID}", + UpdateEditMessage uem => $"| msgID={uem.message.ID}", + UpdateDeleteMessages udm => $"| count={udm.messages.Length}", + _ => null + }; + + /// Load latest dialogs states, checking for missing updates + /// structure returned by Messages_Get*Dialogs calls + /// Dangerous! Load full history of unknown new channels as updates + public async Task LoadDialogs(Messages_Dialogs dialogs, bool fullLoadNewChans = false) + { + await _sem.WaitAsync(); + try + { + foreach (var dialog in dialogs.dialogs.OfType()) + { + if (dialog.peer is not PeerChannel pc) continue; + var local = _local.GetOrCreate(pc.channel_id); + if (dialogs.chats.TryGetValue(pc.channel_id, out var chat) && chat is Channel channel) + local.access_hash = channel.access_hash; + if (local.pts is 0) + if (fullLoadNewChans) local.pts = 1; + else local.pts = dialog.pts; + if (local.pts < dialog.pts) + { + Log?.Invoke(1, $"LoadDialogs {pc.channel_id} has {local.pts} < {dialog.pts} ({dialog.folder_id})"); + await GetDifference(pc.channel_id, dialog.pts, local); + } + } + } + finally { _sem.Release(); } + } + + /// Save the current state of the manager to JSON file + /// File path to write + /// Note: This does not save the the content of collected Users/Chats dictionaries + public void SaveState(string statePath) + => System.IO.File.WriteAllText(statePath, System.Text.Json.JsonSerializer.Serialize(State, Helpers.JsonOptions)); + public static Dictionary LoadState(string statePath) => !System.IO.File.Exists(statePath) ? null + : System.Text.Json.JsonSerializer.Deserialize>(System.IO.File.ReadAllText(statePath), Helpers.JsonOptions); + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(Users, Chats); + } +} + +namespace TL +{ + using WTelegram; + + [EditorBrowsable(EditorBrowsableState.Never)] + public static class UpdateManagerExtensions + { + /// Manager ensuring that you receive Telegram updates in correct order, without missing any + /// Event to be called on sequential individual update + /// Resume session by recovering all updates that occured since the state saved in this file + /// Custom users/chats collector. By default, those are collected in properties Users/Chats + /// if your method can be called again even when last async call didn't return yet + public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, string statePath, UserChatCollector collector = null, bool reentrant = false) + => new(client, onUpdate, UpdateManager.LoadState(statePath), collector, reentrant); + + /// Manager ensuring that you receive Telegram updates in correct order, without missing any + /// Event to be called on sequential individual update + /// (optional) Resume session by recovering all updates that occured since this state + /// Custom users/chats collector. By default, those are collected in properties Users/Chats + /// if your method can be called again even when last async call didn't return yet + public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, IDictionary state = null, UserChatCollector collector = null, bool reentrant = false) + => new(client, onUpdate, state, collector, reentrant); + } +} \ No newline at end of file diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 73e5418..bf00d11 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -51,6 +51,7 @@ + From abeed476e7ac5f0d30c605849c8c288a6fff3e70 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 3 Apr 2024 21:05:07 +0200 Subject: [PATCH 190/336] several enhancements: - fixed UpdateAffectedMessages on wrong mbox - MarkdownToEntities allow reserved characters in code block - collector system more flexible & open - improved UpdateManager resilience - some MTPG improvements --- FAQ.md | 8 +- README.md | 6 +- generator/MTProtoGenerator.cs | 189 ++++++++++++++++++---------------- src/Client.cs | 13 ++- src/Helpers.cs | 2 + src/TL.Extensions.cs | 186 +++++++++++++++++---------------- src/TL.Helpers.cs | 2 +- src/TL.SchemaFuncs.cs | 48 ++++----- src/TL.cs | 10 +- src/UpdateManager.cs | 68 +++++++----- src/WTelegramClient.csproj | 2 +- 11 files changed, 290 insertions(+), 244 deletions(-) diff --git a/FAQ.md b/FAQ.md index e24b20c..6e58d2f 100644 --- a/FAQ.md +++ b/FAQ.md @@ -349,13 +349,11 @@ var manager = client.WithUpdateManager(OnUpdate); var manager = client.WithUpdateManager(OnUpdate, "Updates.state"); // to save the state later, preferably after disposing the client: manager.SaveState("Updates.state") - -// (WithUpdateManager has other parameters for advanced use) ``` -Your `OnUpdate` method will directly take a single `Update` as parameter, instead of a container of updates. -The `manager.Users` and `manager.Chats` dictionaries will collect the users/chats data from updates. -You can also feed them manually from result of your API calls by calling `result.CollectUsersChats(manager.Users, manager.Chats);` and resolve Peer fields via `manager.UserOrChat(peer)` +Your `OnUpdate` method will directly take a single `Update` as parameter, instead of a container of updates. +The `manager.Users` and `manager.Chats` dictionaries will collect the users/chats data from updates. +You can also feed them manually from result of your API calls by calling `result.CollectUsersChats(manager.Users, manager.Chats);` and resolve Peer fields via `manager.UserOrChat(peer)` See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21) for an example of implementation. Notes: diff --git a/README.md b/README.md index 15877e3..eab56a5 100644 --- a/README.md +++ b/README.md @@ -164,14 +164,14 @@ See [FAQ #4](https://wiz0u.github.io/WTelegramClient/FAQ#access-hash) to learn m # Other things to know -The Client class offers `OnUpdates` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. -You can also use the [UpdateManager class](https://wiz0u.github.io/WTelegramClient/FAQ#manager) to simplify the handling of such updates. +The Client class offers `OnUpdates` and `OnOther` events that are triggered when Telegram servers sends Updates (like new messages or status) or other notifications, independently of your API requests. +You can also use the [UpdateManager class](https://wiz0u.github.io/WTelegramClient/FAQ#manager) to simplify the handling of such updates. See [Examples/Program_ListenUpdates.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ListenUpdates.cs?ts=4#L21) and [Examples/Program_ReactorError.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_ReactorError.cs?ts=4#L30) An invalid API request can result in a `RpcException` being raised, reflecting the [error code and status text](https://revgram.github.io/errors.html) of the problem. To [prevent getting banned](https://wiz0u.github.io/WTelegramClient/FAQ#prevent-ban) during dev, you can connect to [test servers](https://docs.pyrogram.org/topics/test-servers), by adding this line in your Config callback: -`case "server_address": return "149.154.167.40:443"; // test DC` +`case "server_address": return "2>149.154.167.40:443"; // test DC` The other configuration items that you can provide include: **session_pathname, email, email_verification_code, session_key, device_model, system_version, app_version, system_lang_code, lang_pack, lang_code, firebase, user_id, bot_token** diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 4901bd8..5bd831a 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -14,34 +14,44 @@ namespace TL.Generator; [Generator] public class MTProtoGenerator : IIncrementalGenerator { - public void Initialize(IncrementalGeneratorInitializationContext context) - { - var classDeclarations = context.SyntaxProvider.ForAttributeWithMetadataName("TL.TLDefAttribute", - (_, _) => true, (context, _) => (ClassDeclarationSyntax)context.TargetNode); + public void Initialize(IncrementalGeneratorInitializationContext context) + { + var classDeclarations = context.SyntaxProvider.ForAttributeWithMetadataName("TL.TLDefAttribute", + (_, _) => true, (context, _) => (ClassDeclarationSyntax)context.TargetNode); var source = context.CompilationProvider.Combine(classDeclarations.Collect()); context.RegisterSourceOutput(source, Execute); } static void Execute(SourceProductionContext context, (Compilation compilation, ImmutableArray classes) unit) - { - var object_ = unit.compilation.GetSpecialType(SpecialType.System_Object); - if (unit.compilation.GetTypeByMetadataName("TL.TLDefAttribute") is not { } tlDefAttribute) return; - if (unit.compilation.GetTypeByMetadataName("TL.IfFlagAttribute") is not { } ifFlagAttribute) return; + { + var object_ = unit.compilation.GetSpecialType(SpecialType.System_Object); + if (unit.compilation.GetTypeByMetadataName("TL.TLDefAttribute") is not { } tlDefAttribute) return; + if (unit.compilation.GetTypeByMetadataName("TL.IfFlagAttribute") is not { } ifFlagAttribute) return; if (unit.compilation.GetTypeByMetadataName("TL.Layer") is not { } layer) return; if (unit.compilation.GetTypeByMetadataName("TL.IObject") is not { } iobject) return; - var nullables = LoadNullables(layer); - var namespaces = new Dictionary>(); // namespace,class,methods - var readTL = new StringBuilder(); - readTL - .AppendLine("\t\tpublic static IObject ReadTL(this BinaryReader reader, uint ctorId = 0) => (ctorId != 0 ? ctorId : reader.ReadUInt32()) switch") - .AppendLine("\t\t{"); + var nullables = LoadNullables(layer); + var namespaces = new Dictionary>(); // namespace,class,methods + var makeTL = new StringBuilder(); + var source = new StringBuilder(); + source + .AppendLine("using System;") + .AppendLine("using System.ComponentModel;") + .AppendLine("using System.IO;") + .AppendLine("using System.Linq;") + .AppendLine("using TL;") + .AppendLine() + .AppendLine("#pragma warning disable CS0109") + .AppendLine(); + makeTL + .AppendLine("\t\tpublic static IObject ReadTL(this BinaryReader reader, uint ctorId = 0) => (ctorId != 0 ? ctorId : reader.ReadUInt32()) switch") + .AppendLine("\t\t{"); foreach (var classDecl in unit.classes) - { - var semanticModel = unit.compilation.GetSemanticModel(classDecl.SyntaxTree); - if (semanticModel.GetDeclaredSymbol(classDecl) is not { } symbol) continue; - var tldef = symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); - if (tldef == null) continue; + { + var semanticModel = unit.compilation.GetSemanticModel(classDecl.SyntaxTree); + if (semanticModel.GetDeclaredSymbol(classDecl) is not { } symbol) continue; + var tldef = symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); + if (tldef == null) continue; var id = (uint)tldef.ConstructorArguments[0].Value; var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; StringBuilder writeTl = new(), ctorTL = new(); @@ -55,7 +65,10 @@ public class MTProtoGenerator : IIncrementalGenerator { if (parentMethods == null) { - writeTl.AppendLine("\t\tpublic abstract void WriteTL(BinaryWriter writer);"); + if (name is "Peer") + writeTl.AppendLine("\t\tpublic virtual void WriteTL(BinaryWriter writer) => throw new NotSupportedException();"); + else + writeTl.AppendLine("\t\tpublic abstract void WriteTL(BinaryWriter writer);"); parentClasses[name] = writeTl.ToString(); writeTl.Clear(); } @@ -72,40 +85,43 @@ public class MTProtoGenerator : IIncrementalGenerator continue; } if (id == 0x3072CFA1) // GzipPacked - readTL.AppendLine($"\t\t\t0x{id:X8} => reader.ReadTLGzipped(),"); + makeTL.AppendLine($"\t\t\t0x{id:X8} => reader.ReadTLGzipped(),"); else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) - readTL.AppendLine($"\t\t\t0x{id:X8} => new {(ns == "TL" ? "" : ns + '.')}{name}(reader),"); - var override_ = symbol.BaseType == object_ ? "" : "override "; + makeTL.AppendLine($"\t\t\t0x{id:X8} => new {(ns == "TL" ? "" : ns + '.')}{name}().ReadTL(reader),"); + var override_ = symbol.BaseType == object_ ? "" : "override "; if (name == "Messages_AffectedMessages") override_ = "virtual "; - if (symbol.Constructors[0].IsImplicitlyDeclared) - ctorTL.AppendLine($"\t\tpublic {name}() {{ }}"); + //if (symbol.Constructors[0].IsImplicitlyDeclared) + // ctorTL.AppendLine($"\t\tpublic {name}() {{ }}"); + if (symbol.IsGenericType) name += ""; ctorTL - .AppendLine($"\t\tpublic {name}(BinaryReader reader)") - .AppendLine("\t\t{"); + .AppendLine("\t\t[EditorBrowsable(EditorBrowsableState.Never)]") + .AppendLine($"\t\tpublic new {name} ReadTL(BinaryReader reader)") + .AppendLine("\t\t{"); writeTl - .AppendLine($"\t\tpublic {override_}void WriteTL(BinaryWriter writer)") - .AppendLine("\t\t{") - .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); - var members = symbol.GetMembers().ToList(); - for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) - if (inheritBefore) members.InsertRange(0, parent.GetMembers()); - else members.AddRange(parent.GetMembers()); + .AppendLine("\t\t[EditorBrowsable(EditorBrowsableState.Never)]") + .AppendLine($"\t\tpublic {override_}void WriteTL(BinaryWriter writer)") + .AppendLine("\t\t{") + .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); + var members = symbol.GetMembers().ToList(); + for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) + if (inheritBefore) members.InsertRange(0, parent.GetMembers()); + else members.AddRange(parent.GetMembers()); foreach (var member in members.OfType()) - { - if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; - ctorTL.Append("\t\t\t"); + { + if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; + ctorTL.Append("\t\t\t"); writeTl.Append("\t\t\t"); var ifFlag = (int?)member.GetAttributes().FirstOrDefault(a => a.AttributeClass == ifFlagAttribute)?.ConstructorArguments[0].Value; - if (ifFlag != null) + if (ifFlag != null) { - var condition = ifFlag < 32 ? $"if (((uint)flags & 0x{1 << ifFlag:X}) != 0) " - : $"if (((uint)flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "; - ctorTL.Append(condition); - writeTl.Append(condition); + var condition = ifFlag < 32 ? $"if (((uint)flags & 0x{1 << ifFlag:X}) != 0) " + : $"if (((uint)flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "; + ctorTL.Append(condition); + writeTl.Append(condition); } string memberType = member.Type.ToString(); switch (memberType) - { + { case "int": ctorTL.AppendLine($"{member.Name} = reader.ReadInt32();"); writeTl.AppendLine($"writer.Write({member.Name});"); @@ -127,34 +143,34 @@ public class MTProtoGenerator : IIncrementalGenerator writeTl.AppendLine($"writer.WriteTLStamp({member.Name});"); break; case "string": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLString();"); - writeTl.AppendLine($"writer.WriteTLString({member.Name});"); + ctorTL.AppendLine($"{member.Name} = reader.ReadTLString();"); + writeTl.AppendLine($"writer.WriteTLString({member.Name});"); + break; + case "byte[]": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLBytes();"); + writeTl.AppendLine($"writer.WriteTLBytes({member.Name});"); break; - case "byte[]": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLBytes();"); - writeTl.AppendLine($"writer.WriteTLBytes({member.Name});"); - break; case "TL.Int128": ctorTL.AppendLine($"{member.Name} = new Int128(reader);"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "TL.Int256": ctorTL.AppendLine($"{member.Name} = new Int256(reader);"); - writeTl.AppendLine($"writer.Write({member.Name});"); + writeTl.AppendLine($"writer.Write({member.Name});"); break; - case "TL._Message[]": - ctorTL.AppendLine($"throw new NotSupportedException();"); - writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); - break; - case "TL.IObject": case "TL.IMethod": + case "TL._Message[]": + ctorTL.AppendLine($"{member.Name} = reader.ReadTLRawVector<_Message>(0x5BB8E511);"); + writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); + break; + case "TL.IObject": case "TL.IMethod": ctorTL.AppendLine($"{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTL();"); writeTl.AppendLine($"{member.Name}.WriteTL(writer);"); - break; - case "System.Collections.Generic.Dictionary": + break; + case "System.Collections.Generic.Dictionary": ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; - case "System.Collections.Generic.Dictionary": + case "System.Collections.Generic.Dictionary": ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; @@ -180,56 +196,49 @@ public class MTProtoGenerator : IIncrementalGenerator } else writeTl.AppendLine($"Cannot serialize {memberType}"); - break; + break; } } + ctorTL.AppendLine("\t\t\treturn this;"); ctorTL.AppendLine("\t\t}"); writeTl.AppendLine("\t\t}"); ctorTL.Append(writeTl.ToString()); - if (symbol.IsGenericType) name += ""; classes[name] = ctorTL.ToString(); } - var source = new StringBuilder(); - source - .AppendLine("using System;") - .AppendLine("using System.IO;") - .AppendLine("using System.Linq;") - .AppendLine("using TL;") - .AppendLine(); foreach (var nullable in nullables) - readTL.AppendLine($"\t\t\t0x{nullable.Value:X8} => null,"); - readTL.AppendLine("\t\t\tvar ctorNb => throw new Exception($\"Cannot find type for ctor #{ctorNb:x}\")"); - readTL.AppendLine("\t\t};"); - namespaces["TL"]["Layer"] = readTL.ToString(); - foreach (var namesp in namespaces) - { - source.Append("namespace ").AppendLine(namesp.Key).Append('{'); - foreach (var method in namesp.Value) - source.AppendLine().Append("\tpartial class ").AppendLine(method.Key).AppendLine("\t{").Append(method.Value).AppendLine("\t}"); + makeTL.AppendLine($"\t\t\t0x{nullable.Value:X8} => null,"); + makeTL.AppendLine("\t\t\tvar ctorNb => throw new Exception($\"Cannot find type for ctor #{ctorNb:x}\")"); + makeTL.AppendLine("\t\t};"); + namespaces["TL"]["Layer"] = makeTL.ToString(); + foreach (var namesp in namespaces) + { + source.Append("namespace ").AppendLine(namesp.Key).Append('{'); + foreach (var method in namesp.Value) + source.AppendLine().Append("\tpartial class ").AppendLine(method.Key).AppendLine("\t{").Append(method.Value).AppendLine("\t}"); source.AppendLine("}").AppendLine(); } string text = source.ToString(); - Debug.Write(text); + Debug.Write(text); context.AddSource("TL.Generated.cs", text); } private static Dictionary LoadNullables(INamedTypeSymbol layer) { - var nullables = layer.GetMembers("Nullables").Single() as IFieldSymbol; - var initializer = nullables.DeclaringSyntaxReferences[0].GetSyntax().ToString(); + var nullables = layer.GetMembers("Nullables").Single() as IFieldSymbol; + var initializer = nullables.DeclaringSyntaxReferences[0].GetSyntax().ToString(); var table = new Dictionary(); foreach (var line in initializer.Split('\n')) - { - int index = line.IndexOf("[typeof("); - if (index == -1) continue; - int index2 = line.IndexOf(')', index += 8); - string className = "TL." + line.Substring(index, index2 - index); - index = line.IndexOf("= 0x", index2); - if (index == -1) continue; - index2 = line.IndexOf(',', index += 4); - table[className] = uint.Parse(line.Substring(index, index2 - index), System.Globalization.NumberStyles.HexNumber); - } - return table; + { + int index = line.IndexOf("[typeof("); + if (index == -1) continue; + int index2 = line.IndexOf(')', index += 8); + string className = "TL." + line.Substring(index, index2 - index); + index = line.IndexOf("= 0x", index2); + if (index == -1) continue; + index2 = line.IndexOf(',', index += 4); + table[className] = uint.Parse(line.Substring(index, index2 - index), System.Globalization.NumberStyles.HexNumber); + } + return table; } } diff --git a/src/Client.cs b/src/Client.cs index 4e34177..8cf1339 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -586,8 +586,6 @@ namespace WTelegram if (OnOwnUpdates != null) if (result is UpdatesBase updates) RaiseOwnUpdates(updates); - else if (result is Messages_AffectedMessages affected) - RaiseOwnUpdates(new UpdateShort { update = new UpdateAffectedMessages { affected = affected }, date = MsgIdToStamp(_lastRecvMsgId) }); } rpc.tcs.SetResult(result); @@ -1454,5 +1452,16 @@ namespace WTelegram throw new WTException($"{query.GetType().Name} call got a result of type {result.GetType().Name} instead of {typeof(T).Name}"); } } + + public async Task InvokeAffected(IMethod query, long peerId) where T : Messages_AffectedMessages + { + var result = await Invoke(query); + RaiseOwnUpdates(new UpdateShort + { + update = new UpdateAffectedMessages { mbox_id = peerId, pts = result.pts, pts_count = result.pts_count}, + date = MsgIdToStamp(_lastRecvMsgId) + }); + return result; + } } } diff --git a/src/Helpers.cs b/src/Helpers.cs index d483cb6..5562e9f 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -267,7 +267,9 @@ namespace WTelegram public class WTException : ApplicationException { + public readonly int ErrorCode; public WTException(string message) : base(message) { } + public WTException(string message, int code) : base(message) => ErrorCode = code; public WTException(string message, Exception innerException) : base(message, innerException) { } } } diff --git a/src/TL.Extensions.cs b/src/TL.Extensions.cs index 8aa400a..7a51640 100644 --- a/src/TL.Extensions.cs +++ b/src/TL.Extensions.cs @@ -5,98 +5,104 @@ using System.Linq; using System.Text; using System.Threading.Tasks; using System.Web; -using WTelegram; // for GetValueOrDefault +using WTelegram; namespace TL { public static class Extensions { - internal sealed partial class CollectorPeer : Peer + public sealed partial class CollectorPeer(IDictionary _users, IDictionary _chats) : Peer, IPeerCollector { public override long ID => 0; - internal IDictionary _users; - internal IDictionary _chats; protected internal override IPeerInfo UserOrChat(Dictionary users, Dictionary chats) { - if (_users != null) - lock (_users) - foreach (var user in users.Values) - if (user != null) - if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) - _users[user.id] = user; - else - { // update previously full user from min user: - const User.Flags updated_flags = (User.Flags)0x5DAFE000; - const User.Flags2 updated_flags2 = (User.Flags2)0x711; - // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo - // | support | scam | fake | bot_attach_menu | premium - // tdesktop non-updated flags: bot | bot_chat_history | bot_nochats | bot_attach_menu - // updated flags2: stories_unavailable (tdlib) | contact_require_premium (tdesktop) - prevUser.flags = (prevUser.flags & ~updated_flags) | (user.flags & updated_flags); - prevUser.flags2 = (prevUser.flags2 & ~updated_flags2) | (user.flags2 & updated_flags2); - prevUser.first_name ??= user.first_name; // tdlib: not updated ; tdesktop: updated only if unknown - prevUser.last_name ??= user.last_name; // tdlib: not updated ; tdesktop: updated only if unknown - //prevUser.username ??= user.username; // tdlib/tdesktop: not updated - prevUser.phone ??= user.phone; // tdlib: updated only if unknown ; tdesktop: not updated - if (prevUser.flags.HasFlag(User.Flags.apply_min_photo) && user.photo != null) - { - prevUser.photo = user.photo; // tdlib/tdesktop: updated on apply_min_photo - prevUser.flags |= User.Flags.has_photo; - } - prevUser.bot_info_version = user.bot_info_version; // tdlib: updated ; tdesktop: not updated - prevUser.restriction_reason = user.restriction_reason; // tdlib: updated ; tdesktop: not updated - prevUser.bot_inline_placeholder = user.bot_inline_placeholder;// tdlib: updated ; tdesktop: ignored - if (user.lang_code != null) - prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored - prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated - prevUser.usernames = user.usernames; // tdlib: not updated ; tdesktop: updated - if (user.stories_max_id > 0) - prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated - prevUser.color = user.color; // tdlib/tdesktop: updated - prevUser.profile_color = user.profile_color; // tdlib/tdesktop: unimplemented yet - _users[user.id] = prevUser; - } - if (_chats != null) - lock (_chats) - foreach (var kvp in chats) - if (kvp.Value is not Channel channel) - _chats[kvp.Key] = kvp.Value; - else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(kvp.Key, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) - _chats[kvp.Key] = channel; - else - { // update previously full channel from min channel: - const Channel.Flags updated_flags = (Channel.Flags)0x7FDC0BE0; - const Channel.Flags2 updated_flags2 = (Channel.Flags2)0x781; - // tdesktop updated flags: broadcast | verified | megagroup | signatures | scam | has_link | slowmode_enabled - // | call_active | call_not_empty | fake | gigagroup | noforwards | join_to_send | join_request | forum - // tdlib nonupdated flags: broadcast | signatures | call_active | call_not_empty | noforwards - prevChannel.flags = (prevChannel.flags & ~updated_flags) | (channel.flags & updated_flags); - prevChannel.flags2 = (prevChannel.flags2 & ~updated_flags2) | (channel.flags2 & updated_flags2); - prevChannel.title = channel.title; // tdlib/tdesktop: updated - prevChannel.username = channel.username; // tdlib/tdesktop: updated - prevChannel.photo = channel.photo; // tdlib: updated if not banned ; tdesktop: updated - prevChannel.restriction_reason = channel.restriction_reason; // tdlib: updated ; tdesktop: not updated - prevChannel.default_banned_rights = channel.default_banned_rights; // tdlib/tdesktop: updated - if (channel.participants_count > 0) - prevChannel.participants_count = channel.participants_count; // tdlib/tdesktop: updated if present - prevChannel.usernames = channel.usernames; // tdlib/tdesktop: updated - prevChannel.color = channel.color; // tdlib: not updated ; tdesktop: updated - prevChannel.profile_color = channel.profile_color; // tdlib/tdesktop: ignored - prevChannel.emoji_status = channel.emoji_status; // tdlib: not updated ; tdesktop: updated - prevChannel.level = channel.level; // tdlib: not updated ; tdesktop: updated - _chats[kvp.Key] = prevChannel; - } + if (users != null) Collect(users.Values); + if (chats != null) Collect(chats.Values); return null; } -#if MTPG - public override void WriteTL(System.IO.BinaryWriter writer) => throw new NotImplementedException(); -#endif + + public void Collect(IEnumerable users) + { + lock (_users) + foreach (var user in users) + if (user != null) + if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) + _users[user.id] = user; + else + { // update previously full user from min user: + const User.Flags updated_flags = (User.Flags)0x5DAFE000; + const User.Flags2 updated_flags2 = (User.Flags2)0x711; + // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo + // | support | scam | fake | bot_attach_menu | premium + // tdesktop non-updated flags: bot | bot_chat_history | bot_nochats | bot_attach_menu + // updated flags2: stories_unavailable (tdlib) | contact_require_premium (tdesktop) + prevUser.flags = (prevUser.flags & ~updated_flags) | (user.flags & updated_flags); + prevUser.flags2 = (prevUser.flags2 & ~updated_flags2) | (user.flags2 & updated_flags2); + prevUser.first_name ??= user.first_name; // tdlib: not updated ; tdesktop: updated only if unknown + prevUser.last_name ??= user.last_name; // tdlib: not updated ; tdesktop: updated only if unknown + //prevUser.username ??= user.username; // tdlib/tdesktop: not updated + prevUser.phone ??= user.phone; // tdlib: updated only if unknown ; tdesktop: not updated + if (prevUser.flags.HasFlag(User.Flags.apply_min_photo) && user.photo != null) + { + prevUser.photo = user.photo; // tdlib/tdesktop: updated on apply_min_photo + prevUser.flags |= User.Flags.has_photo; + } + prevUser.bot_info_version = user.bot_info_version; // tdlib: updated ; tdesktop: not updated + prevUser.restriction_reason = user.restriction_reason; // tdlib: updated ; tdesktop: not updated + prevUser.bot_inline_placeholder = user.bot_inline_placeholder;// tdlib: updated ; tdesktop: ignored + if (user.lang_code != null) + prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored + prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated + prevUser.usernames = user.usernames; // tdlib: not updated ; tdesktop: updated + if (user.stories_max_id > 0) + prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated + prevUser.color = user.color; // tdlib/tdesktop: updated + prevUser.profile_color = user.profile_color; // tdlib/tdesktop: unimplemented yet + _users[user.id] = prevUser; + } + } + + public void Collect(IEnumerable chats) + { + lock (_chats) + foreach (var chat in chats) + if (chat is not Channel channel) + _chats[chat.ID] = chat; + else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) + _chats[channel.id] = channel; + else + { // update previously full channel from min channel: + const Channel.Flags updated_flags = (Channel.Flags)0x7FDC0BE0; + const Channel.Flags2 updated_flags2 = (Channel.Flags2)0x781; + // tdesktop updated flags: broadcast | verified | megagroup | signatures | scam | has_link | slowmode_enabled + // | call_active | call_not_empty | fake | gigagroup | noforwards | join_to_send | join_request | forum + // tdlib nonupdated flags: broadcast | signatures | call_active | call_not_empty | noforwards + prevChannel.flags = (prevChannel.flags & ~updated_flags) | (channel.flags & updated_flags); + prevChannel.flags2 = (prevChannel.flags2 & ~updated_flags2) | (channel.flags2 & updated_flags2); + prevChannel.title = channel.title; // tdlib/tdesktop: updated + prevChannel.username = channel.username; // tdlib/tdesktop: updated + prevChannel.photo = channel.photo; // tdlib: updated if not banned ; tdesktop: updated + prevChannel.restriction_reason = channel.restriction_reason; // tdlib: updated ; tdesktop: not updated + prevChannel.default_banned_rights = channel.default_banned_rights; // tdlib/tdesktop: updated + if (channel.participants_count > 0) + prevChannel.participants_count = channel.participants_count; // tdlib/tdesktop: updated if present + prevChannel.usernames = channel.usernames; // tdlib/tdesktop: updated + prevChannel.color = channel.color; // tdlib: not updated ; tdesktop: updated + prevChannel.profile_color = channel.profile_color; // tdlib/tdesktop: ignored + prevChannel.emoji_status = channel.emoji_status; // tdlib: not updated ; tdesktop: updated + prevChannel.level = channel.level; // tdlib: not updated ; tdesktop: updated + _chats[channel.id] = prevChannel; + } + } + + public bool HasUser(long id) { lock (_users) return _users.ContainsKey(id); } + public bool HasChat(long id) { lock (_chats) return _chats.ContainsKey(id); } } /// Accumulate users/chats found in this structure in your dictionaries, ignoring Min constructors when the full object is already stored /// The structure having a users public static void CollectUsersChats(this IPeerResolver structure, IDictionary users, IDictionary chats) - => structure.UserOrChat(new CollectorPeer { _users = users, _chats = chats }); + => structure.UserOrChat(new CollectorPeer(users, chats)); [EditorBrowsable(EditorBrowsableState.Never)] public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); @@ -120,6 +126,7 @@ namespace TL { var entities = new List(); MessageEntityBlockquote lastBlockQuote = null; + int inCode = 0; var sb = new StringBuilder(text); for (int offset = 0; offset < sb.Length;) { @@ -127,9 +134,9 @@ namespace TL { case '\r': sb.Remove(offset, 1); break; case '\\': sb.Remove(offset++, 1); break; - case '*': ProcessEntity(); break; - case '~': ProcessEntity(); break; - case '_': + case '*' when inCode == 0: ProcessEntity(); break; + case '~' when inCode == 0: ProcessEntity(); break; + case '_' when inCode == 0: if (offset + 1 < sb.Length && sb[offset + 1] == '_') { sb.Remove(offset, 1); @@ -139,7 +146,7 @@ namespace TL ProcessEntity(); break; case '|': - if (offset + 1 < sb.Length && sb[offset + 1] == '|') + if (inCode == 0 && offset + 1 < sb.Length && sb[offset + 1] == '|') { sb.Remove(offset, 1); ProcessEntity(); @@ -148,6 +155,7 @@ namespace TL offset++; break; case '`': + int count = entities.Count; if (offset + 2 < sb.Length && sb[offset + 1] == '`' && sb[offset + 2] == '`') { int len = 3; @@ -164,8 +172,9 @@ namespace TL } else ProcessEntity(); + if (entities.Count > count) inCode++; else inCode--; break; - case '>' when offset == 0 || sb[offset - 1] == '\n': + case '>' when inCode == 0 && offset == 0 || sb[offset - 1] == '\n': sb.Remove(offset, 1); if (lastBlockQuote is null || lastBlockQuote.length < offset - lastBlockQuote.offset) entities.Add(lastBlockQuote = new MessageEntityBlockquote { offset = offset, length = -1 }); @@ -175,15 +184,15 @@ namespace TL case '\n' when lastBlockQuote is { length: -1 }: lastBlockQuote.length = ++offset - lastBlockQuote.offset; break; - case '!' when offset + 1 < sb.Length && sb[offset + 1] == '[': + case '!' when inCode == 0 && offset + 1 < sb.Length && sb[offset + 1] == '[': sb.Remove(offset, 1); - goto case '['; - case '[': + break; + case '[' when inCode == 0: entities.Add(new MessageEntityTextUrl { offset = offset, length = -1 }); sb.Remove(offset, 1); break; case ']': - if (offset + 2 < sb.Length && sb[offset + 1] == '(') + if (inCode == 0 && offset + 2 < sb.Length && sb[offset + 1] == '(') { var lastIndex = entities.FindLastIndex(e => e.length == -1); if (lastIndex >= 0 && entities[lastIndex] is MessageEntityTextUrl textUrl) @@ -213,11 +222,14 @@ namespace TL void ProcessEntity() where T : MessageEntity, new() { + sb.Remove(offset, 1); if (entities.LastOrDefault(e => e.length == -1) is T prevEntity) - prevEntity.length = offset - prevEntity.offset; + if (offset == prevEntity.offset) + entities.Remove(prevEntity); + else + prevEntity.length = offset - prevEntity.offset; else entities.Add(new T { offset = offset, length = -1 }); - sb.Remove(offset, 1); } } if (lastBlockQuote is { length: -1 }) diff --git a/src/TL.Helpers.cs b/src/TL.Helpers.cs index 4755b21..6726515 100644 --- a/src/TL.Helpers.cs +++ b/src/TL.Helpers.cs @@ -105,7 +105,7 @@ namespace TL { file = inputFile; mime_type = mimeType; - if (inputFile.Name is string filename) attributes = new[] { new DocumentAttributeFilename { file_name = filename } }; + if (inputFile.Name is string filename) attributes = [new DocumentAttributeFilename { file_name = filename }]; } public InputMediaUploadedDocument(InputFileBase inputFile, string mimeType, params DocumentAttribute[] attribs) { diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 8240551..e67c12b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1604,11 +1604,11 @@ namespace TL /// Target user or group /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read public static Task Messages_ReadHistory(this Client client, InputPeer peer, int max_id = default) - => client.Invoke(new Messages_ReadHistory + => client.InvokeAffected(new Messages_ReadHistory { peer = peer, max_id = max_id, - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// Deletes communication history. See Possible codes: 400 (details) /// Just clear history for the current user, without actually removing messages for every chat user @@ -1618,24 +1618,24 @@ namespace TL /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp public static Task Messages_DeleteHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null, bool just_clear = false, bool revoke = false) - => client.Invoke(new Messages_DeleteHistory + => client.InvokeAffected(new Messages_DeleteHistory { flags = (Messages_DeleteHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0) | (just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0)), peer = peer, max_id = max_id, min_date = min_date.GetValueOrDefault(), max_date = max_date.GetValueOrDefault(), - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// 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
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
/// Whether to delete messages for all participants of the chat /// Message ID list public static Task Messages_DeleteMessages(this Client client, int[] id, bool revoke = false) - => client.Invoke(new Messages_DeleteMessages + => client.InvokeAffected(new Messages_DeleteMessages { flags = (Messages_DeleteMessages.Flags)(revoke ? 0x1 : 0), id = id, - }); + }, 0); /// 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
Confirms receipt of messages by a client, cancels PUSH-notification sending. See
/// Maximum message ID available in a client. @@ -1977,10 +1977,10 @@ namespace TL /// 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
Notifies the sender about the recipient having listened a voice message or watched a video. See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) - => client.Invoke(new Messages_ReadMessageContents + => client.InvokeAffected(new Messages_ReadMessageContents { id = id, - }); + }, 0); /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji @@ -2646,12 +2646,12 @@ namespace TL /// Dialog /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) - => client.Invoke(new Messages_ReadMentions + => client.InvokeAffected(new Messages_ReadMentions { flags = (Messages_ReadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, top_msg_id = top_msg_id.GetValueOrDefault(), - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// Get live location history of a certain user See /// User @@ -3057,12 +3057,12 @@ namespace TL /// Chat where to unpin /// Forum topic where to unpin public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) - => client.Invoke(new Messages_UnpinAllMessages + => client.InvokeAffected(new Messages_UnpinAllMessages { flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, top_msg_id = top_msg_id.GetValueOrDefault(), - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// 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
Delete a chat See Possible codes: 400 (details)
/// Chat ID @@ -3075,10 +3075,10 @@ namespace TL /// Delete the entire phone call history. See /// Whether to remove phone call history for participants as well public static Task Messages_DeletePhoneCallHistory(this Client client, bool revoke = false) - => client.Invoke(new Messages_DeletePhoneCallHistory + => client.InvokeAffected(new Messages_DeletePhoneCallHistory { flags = (Messages_DeletePhoneCallHistory.Flags)(revoke ? 0x1 : 0), - }); + }, 0); /// Obtains information about a chat export file, generated by a foreign chat app, click here for more info about imported chats ». See Possible codes: 400 (details) /// Beginning of the message file; up to 100 lines. @@ -3446,12 +3446,12 @@ namespace TL /// Peer /// Mark as read only reactions to messages within the specified forum topic public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) - => client.Invoke(new Messages_ReadReactions + => client.InvokeAffected(new Messages_ReadReactions { flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, top_msg_id = top_msg_id.GetValueOrDefault(), - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// View and search recently sent media.
This method does not support pagination. See Possible codes: 400 (details)
/// Optional search query @@ -3859,14 +3859,14 @@ namespace TL /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) - => client.Invoke(new Messages_DeleteSavedHistory + => client.InvokeAffected(new Messages_DeleteSavedHistory { flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), peer = peer, max_id = max_id, min_date = min_date.GetValueOrDefault(), max_date = max_date.GetValueOrDefault(), - }); + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// Get pinned saved dialogs, see here » for more info. See public static Task Messages_GetPinnedSavedDialogs(this Client client) @@ -4421,11 +4421,11 @@ namespace TL /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) - => client.Invoke(new Channels_DeleteMessages + => client.InvokeAffected(new Channels_DeleteMessages { channel = channel, id = id, - }); + }, channel.ChannelId); /// Reports some messages from a user in a supergroup as spam; requires administrator rights in the supergroup See Possible codes: 400 (details) /// Supergroup @@ -4811,11 +4811,11 @@ namespace TL /// Supergroup /// The participant whose messages should be deleted public static Task Channels_DeleteParticipantHistory(this Client client, InputChannelBase channel, InputPeer participant) - => client.Invoke(new Channels_DeleteParticipantHistory + => client.InvokeAffected(new Channels_DeleteParticipantHistory { channel = channel, participant = participant, - }); + }, channel.ChannelId); /// Set whether all users should join a discussion group in order to comment on a post » See Possible codes: 400 (details) /// Discussion group @@ -4960,11 +4960,11 @@ namespace TL /// Forum /// Topic ID public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) - => client.Invoke(new Channels_DeleteTopicHistory + => client.InvokeAffected(new Channels_DeleteTopicHistory { channel = channel, top_msg_id = top_msg_id, - }); + }, channel.ChannelId); /// Reorder pinned forum topics See [bots: ✓] /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) diff --git a/src/TL.cs b/src/TL.cs index e526e40..ff07a6b 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -32,9 +32,9 @@ namespace TL public readonly int Bit = bit; } - public sealed class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) + public sealed class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message, code) { - public readonly int Code = code; + public int Code => ErrorCode; /// The value of X in the message, -1 if no variable X was found public readonly int X = x; public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } @@ -398,8 +398,10 @@ namespace TL public sealed partial class UpdateAffectedMessages : Update // auto-generated for OnOwnUpdates in case of such API call result { - public Messages_AffectedMessages affected; - public override (long, int, int) GetMBox() => (0, affected.pts, affected.pts_count); + public long mbox_id; + public int pts; + public int pts_count; + public override (long, int, int) GetMBox() => (mbox_id, pts, pts_count); #if MTPG public override void WriteTL(BinaryWriter writer) => throw new NotSupportedException(); #endif diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index b26fa70..615f8ae 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -9,8 +9,6 @@ using TL; namespace WTelegram { - public delegate IPeerInfo UserChatCollector(Dictionary users, Dictionary chats); - public class UpdateManager : IPeerResolver { /// Collected info about Users (only if using the default collector) @@ -37,10 +35,9 @@ namespace WTelegram private readonly Client _client; private readonly Func _onUpdate; - private readonly UserChatCollector _onCollect; + private readonly IPeerCollector _collector; private readonly bool _reentrant; private readonly SemaphoreSlim _sem = new(1); - private readonly Extensions.CollectorPeer _collector; private readonly List<(Update update, UpdatesBase updates, bool own, DateTime stamp)> _pending = []; private readonly Dictionary _local; // -2 for seq/date, -1 for qts, 0 for common pts, >0 for channel pts private const int L_SEQ = -2, L_QTS = -1, L_PTS = 0; @@ -55,17 +52,11 @@ namespace WTelegram /// (optional) Resume session by recovering all updates that occured since this state /// Custom users/chats collector. By default, those are collected in properties Users/Chats /// if your method can be called again even when last async call didn't return yet - public UpdateManager(Client client, Func onUpdate, IDictionary state = null, UserChatCollector collector = null, bool reentrant = false) + public UpdateManager(Client client, Func onUpdate, IDictionary state = null, IPeerCollector collector = null, bool reentrant = false) { _client = client; _onUpdate = onUpdate; - if (collector != null) - _onCollect = collector; - else - { - _collector = new() { _users = Users = [], _chats = Chats = [] }; - _onCollect = _collector.UserOrChat; - } + _collector = collector ?? new Extensions.CollectorPeer(Users = [], Chats = []); if (state == null) _local = new() { [L_SEQ] = new() { access_hash = UndefinedSeqDate }, [L_QTS] = new(), [L_PTS] = new() }; @@ -85,7 +76,7 @@ namespace WTelegram if (_local[L_PTS].pts != 0) await ResyncState(); break; case User user when user.flags.HasFlag(User.Flags.self): - if (Users != null) Users[user.id] = user; + _collector.Collect([user]); goto newSession; case NewSessionCreated when _client.User != null: newSession: @@ -130,15 +121,14 @@ namespace WTelegram var now = _lastUpdateStamp = DateTime.UtcNow; var updateList = updates.UpdateList; if (updates is UpdateShortSentMessage sent) - updateList = new[] { new UpdateNewMessage { pts = sent.pts, pts_count = sent.pts_count, message = new Message { - flags = (Message.Flags)sent.flags, - id = sent.id, date = sent.date, entities = sent.entities, media = sent.media, ttl_period = sent.ttl_period, - } } }; - else if (Users != null) - if (updates is UpdateShortMessage usm && !Users.ContainsKey(usm.user_id)) - (await _client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0)).UserOrChat(_collector); - else if (updates is UpdateShortChatMessage uscm && (!Users.ContainsKey(uscm.from_id) || !Chats.ContainsKey(uscm.chat_id))) - (await _client.Updates_GetDifference(uscm.pts - uscm.pts_count, uscm.date, 0)).UserOrChat(_collector); + updateList = [new UpdateNewMessage { pts = sent.pts, pts_count = sent.pts_count, message = new Message { + flags = (Message.Flags)sent.flags, + id = sent.id, date = sent.date, entities = sent.entities, media = sent.media, ttl_period = sent.ttl_period, + } }]; + else if (updates is UpdateShortMessage usm && !_collector.HasUser(usm.user_id)) + RaiseCollect(await _client.Updates_GetDifference(usm.pts - usm.pts_count, usm.date, 0)); + else if (updates is UpdateShortChatMessage uscm && (!_collector.HasUser(uscm.from_id) || !_collector.HasChat(uscm.chat_id))) + RaiseCollect(await _client.Updates_GetDifference(uscm.pts - uscm.pts_count, uscm.date, 0)); bool ptsChanged = false, gotUPts = false; int seq = 0; @@ -261,10 +251,12 @@ namespace WTelegram Log?.Invoke(2, $"({mbox_id,10}, new +{pts_count}->{pts,-6}) {update,-30} First appearance of MBox {ExtendedLog(update)}"); else if (local.access_hash == -1) // no valid access_hash for this channel, so just raise this update Log?.Invoke(3, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} No access_hash to recover {ExtendedLog(update)}"); + else if (local.pts + pts_count - pts >= 0) + getDiffSuccess = true; else { Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} Calling GetDifference {ExtendedLog(update)}"); - getDiffSuccess = await GetDifference(mbox_id, pts - pts_count, local); + getDiffSuccess = await GetDifference(mbox_id, pts, local); } if (!getDiffSuccess) // no getDiff => just raise received pending updates in order { @@ -382,6 +374,11 @@ namespace WTelegram catch (Exception ex) { Log?.Invoke(4, $"GetDifference({mbox_id}, {local.pts}->{expected_pts}) raised {ex}"); + if (ex.Message == "PERSISTENT_TIMESTAMP_INVALID") // oh boy, we're lost! + if (mbox_id <= 0) + await HandleDifference(null, null, await _client.Updates_GetState(), null); + else if ((await _client.Channels_GetFullChannel(await GetInputChannel(mbox_id, local))).full_chat is ChannelFull full) + local.pts = full.pts; } finally { @@ -441,6 +438,14 @@ namespace WTelegram } } + private void RaiseCollect(Updates_DifferenceBase diff) + { + if (diff is Updates_DifferenceSlice uds) + RaiseCollect(uds.users, uds.chats); + else if (diff is Updates_Difference ud) + RaiseCollect(ud.users, ud.chats); + } + private void RaiseCollect(Dictionary users, Dictionary chats) { try @@ -449,11 +454,12 @@ namespace WTelegram if (chat is Channel channel && !channel.flags.HasFlag(Channel.Flags.min)) if (_local.TryGetValue(channel.id, out var local)) local.access_hash = channel.access_hash; - _onCollect(users, chats); + _collector.Collect(users.Values); + _collector.Collect(chats.Values); } catch (Exception ex) { - Log?.Invoke(4, $"onCollect({users?.Count},{chats?.Count}) raised {ex}"); + Log?.Invoke(4, $"Collect({users?.Count},{chats?.Count}) raised {ex}"); } } @@ -516,6 +522,14 @@ namespace WTelegram /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(Users, Chats); } + + public interface IPeerCollector + { + void Collect(IEnumerable users); + void Collect(IEnumerable chats); + bool HasUser(long id); + bool HasChat(long id); + } } namespace TL @@ -530,7 +544,7 @@ namespace TL /// Resume session by recovering all updates that occured since the state saved in this file /// Custom users/chats collector. By default, those are collected in properties Users/Chats /// if your method can be called again even when last async call didn't return yet - public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, string statePath, UserChatCollector collector = null, bool reentrant = false) + public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, string statePath, IPeerCollector collector = null, bool reentrant = false) => new(client, onUpdate, UpdateManager.LoadState(statePath), collector, reentrant); /// Manager ensuring that you receive Telegram updates in correct order, without missing any @@ -538,7 +552,7 @@ namespace TL /// (optional) Resume session by recovering all updates that occured since this state /// Custom users/chats collector. By default, those are collected in properties Users/Chats /// if your method can be called again even when last async call didn't return yet - public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, IDictionary state = null, UserChatCollector collector = null, bool reentrant = false) + public static UpdateManager WithUpdateManager(this Client client, Func onUpdate, IDictionary state = null, IPeerCollector collector = null, bool reentrant = false) => new(client, onUpdate, state, collector, reentrant); } } \ No newline at end of file diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index bf00d11..694692f 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -44,7 +44,7 @@ --> - + From f3ca76bb8f981a61acd974ca74c28964e99e5d6b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 4 Apr 2024 11:12:59 +0200 Subject: [PATCH 191/336] fix #242: correctly handle UserEmpty in ReadTLDictionary --- generator/MTProtoGenerator.cs | 2 +- src/Helpers.cs | 2 -- src/TL.cs | 10 ++++++---- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 5bd831a..e0025e3 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -208,7 +208,7 @@ public class MTProtoGenerator : IIncrementalGenerator foreach (var nullable in nullables) makeTL.AppendLine($"\t\t\t0x{nullable.Value:X8} => null,"); - makeTL.AppendLine("\t\t\tvar ctorNb => throw new Exception($\"Cannot find type for ctor #{ctorNb:x}\")"); + makeTL.AppendLine("\t\t\tvar ctorNb => throw new WTelegram.WTException($\"Cannot find type for ctor #{ctorNb:x}\")"); makeTL.AppendLine("\t\t};"); namespaces["TL"]["Layer"] = makeTL.ToString(); foreach (var namesp in namespaces) diff --git a/src/Helpers.cs b/src/Helpers.cs index 5562e9f..d483cb6 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -267,9 +267,7 @@ namespace WTelegram public class WTException : ApplicationException { - public readonly int ErrorCode; public WTException(string message) : base(message) { } - public WTException(string message, int code) : base(message) => ErrorCode = code; public WTException(string message, Exception innerException) : base(message, innerException) { } } } diff --git a/src/TL.cs b/src/TL.cs index ff07a6b..0045cef 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -32,9 +32,9 @@ namespace TL public readonly int Bit = bit; } - public sealed class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message, code) + public sealed class RpcException(int code, string message, int x = -1) : WTelegram.WTException(message) { - public int Code => ErrorCode; + public readonly int Code = code; /// The value of X in the message, -1 if no variable X was found public readonly int X = x; public override string ToString() { var str = base.ToString(); return str.Insert(str.IndexOf(':') + 1, " " + Code); } @@ -278,8 +278,10 @@ namespace TL var dict = new Dictionary(count); for (int i = 0; i < count; i++) { - var value = (T)reader.ReadTLObject(); - dict[value.ID] = value is UserEmpty ? null : value; + var obj = reader.ReadTLObject(); + if (obj is T value) dict[value.ID] = value; + else if (obj is UserEmpty ue) dict[ue.id] = null; + else throw new InvalidCastException($"ReadTLDictionary got '{obj?.GetType().Name}' instead of '{typeof(T).Name}'"); } return dict; } From fc08140995be672be88830c3de7a3a97806a8b81 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 5 Apr 2024 13:57:47 +0200 Subject: [PATCH 192/336] renaming 2 files --- src/{TL.Extensions.cs => Services.cs} | 10 +++++----- src/{TL.Helpers.cs => TL.Xtended.cs} | 0 src/UpdateManager.cs | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) rename src/{TL.Extensions.cs => Services.cs} (97%) rename src/{TL.Helpers.cs => TL.Xtended.cs} (100%) diff --git a/src/TL.Extensions.cs b/src/Services.cs similarity index 97% rename from src/TL.Extensions.cs rename to src/Services.cs index 7a51640..0be43f1 100644 --- a/src/TL.Extensions.cs +++ b/src/Services.cs @@ -9,7 +9,7 @@ using WTelegram; namespace TL { - public static class Extensions + public static class Services { public sealed partial class CollectorPeer(IDictionary _users, IDictionary _chats) : Peer, IPeerCollector { @@ -104,13 +104,13 @@ namespace TL public static void CollectUsersChats(this IPeerResolver structure, IDictionary users, IDictionary chats) => structure.UserOrChat(new CollectorPeer(users, chats)); - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)][Obsolete("The method you're looking for is Messages_GetAllChats", true)] public static Task Messages_GetChats(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)][Obsolete("The method you're looking for is Messages_GetAllChats", true)] public static Task Channels_GetChannels(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllChats"); - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)][Obsolete("The method you're looking for is Messages_GetAllDialogs", true)] public static Task Users_GetUsers(this Client _) => throw new WTException("The method you're looking for is Messages_GetAllDialogs"); - [EditorBrowsable(EditorBrowsableState.Never)] + [EditorBrowsable(EditorBrowsableState.Never)][Obsolete("If you want to get all messages from a chat, use method Messages_GetHistory", true)] public static Task Messages_GetMessages(this Client _) => throw new WTException("If you want to get all messages from a chat, use method Messages_GetHistory"); } diff --git a/src/TL.Helpers.cs b/src/TL.Xtended.cs similarity index 100% rename from src/TL.Helpers.cs rename to src/TL.Xtended.cs diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 615f8ae..99d9886 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -56,7 +56,7 @@ namespace WTelegram { _client = client; _onUpdate = onUpdate; - _collector = collector ?? new Extensions.CollectorPeer(Users = [], Chats = []); + _collector = collector ?? new Services.CollectorPeer(Users = [], Chats = []); if (state == null) _local = new() { [L_SEQ] = new() { access_hash = UndefinedSeqDate }, [L_QTS] = new(), [L_PTS] = new() }; From 1a4b606216d1185d64eecc6d0fa46e8805bc2119 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 5 Apr 2024 14:14:39 +0200 Subject: [PATCH 193/336] API Layer 177: more business stuff, new profile infos, revenue stats --- README.md | 2 +- src/Client.Helpers.cs | 2 +- src/TL.Schema.cs | 526 +++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 367 ++++++++++++++++++++++++-- src/TL.Table.cs | 52 +++- src/WTelegramClient.csproj | 2 +- 6 files changed, 900 insertions(+), 51 deletions(-) diff --git a/README.md b/README.md index eab56a5..78e7a9c 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-176-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-177-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://www.buymeacoffee.com/wizou) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 04be756..3870a2f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -580,7 +580,7 @@ namespace WTelegram ///
Generic helper: Adds a single user to a Chat or Channel See
and
Possible codes: 400,403
/// Chat/Channel /// User to be added - public Task AddChatUser(InputPeer peer, InputUserBase user) => peer switch + public Task AddChatUser(InputPeer peer, InputUserBase user) => peer switch { InputPeerChat chat => this.Messages_AddChatUser(chat.chat_id, user, int.MaxValue), InputPeerChannel channel => this.Channels_InviteToChannel(channel, user), diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 984dc17..32bb1ac 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -865,6 +865,7 @@ namespace TL /// Field has a value has_profile_color = 0x200, contact_require_premium = 0x400, + bot_business = 0x800, } } @@ -1497,6 +1498,8 @@ namespace TL has_boosts_unrestrict = 0x200, /// Field has a value has_emojiset = 0x400, + restricted_sponsored = 0x800, + can_view_revenue = 0x1000, } /// ID of the channel @@ -1670,11 +1673,12 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xA66C7EFC)] + [TLDef(0x2357BF25)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + public Flags2 flags2; /// ID of the message public int id; /// ID of the sender of the message @@ -1688,6 +1692,7 @@ namespace TL [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message [IfFlag(11)] public long via_bot_id; + [IfFlag(32)] public long via_business_bot_id; /// Reply information [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Date of the message @@ -1782,6 +1787,13 @@ namespace TL has_quick_reply_shortcut_id = 0x40000000, } + [Flags] public enum Flags2 : uint + { + /// Field has a value + has_via_business_bot_id = 0x1, + offline = 0x2, + } + /// ID of the message public override int ID => id; /// ID of the sender of the message @@ -2604,6 +2616,13 @@ namespace TL { public int boosts; } + /// See + [TLDef(0x93B31848)] + public sealed partial class MessageActionRequestedPeerSentMe : MessageAction + { + public int button_id; + public RequestedPeer[] peers; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3062,7 +3081,7 @@ namespace TL } /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat action bar », see here » for more info. See - [TLDef(0xA518110D)] + [TLDef(0xACD66C5E)] public sealed partial class PeerSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3073,6 +3092,8 @@ namespace TL [IfFlag(9)] public string request_chat_title; /// If set, this is a private chat with an administrator of a chat or channel to which the user sent a join request, and this field contains the timestamp when the join request » was sent. [IfFlag(9)] public DateTime request_chat_date; + [IfFlag(13)] public long business_bot_id; + [IfFlag(13)] public string business_bot_manage_url; [Flags] public enum Flags : uint { @@ -3098,6 +3119,10 @@ namespace TL has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, + business_bot_paused = 0x800, + business_bot_can_reply = 0x1000, + /// Fields and have a value + has_business_bot_id = 0x2000, } } @@ -3198,7 +3223,7 @@ namespace TL } /// Extended user info See - [TLDef(0x22FF3E85)] + [TLDef(0xCC997720)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3246,6 +3271,10 @@ namespace TL [IfFlag(33)] public BusinessLocation business_location; [IfFlag(34)] public BusinessGreetingMessage business_greeting_message; [IfFlag(35)] public BusinessAwayMessage business_away_message; + [IfFlag(36)] public BusinessIntro business_intro; + [IfFlag(37)] public Birthday birthday; + [IfFlag(38)] public long personal_channel_id; + [IfFlag(38)] public int personal_channel_message; [Flags] public enum Flags : uint { @@ -3315,6 +3344,12 @@ namespace TL has_business_greeting_message = 0x4, /// Field has a value has_business_away_message = 0x8, + /// Field has a value + has_business_intro = 0x10, + /// Field has a value + has_birthday = 0x20, + /// Fields and have a value + has_personal_channel_id = 0x40, } } @@ -5003,13 +5038,6 @@ namespace TL /// Media autosave settings have changed and must be refetched using Account_GetAutoSaveSettings. See [TLDef(0xEC05B097)] public sealed partial class UpdateAutoSaveSettings : Update { } - /// 0-N updates of this type may be returned only when invoking Messages_AddChatUser, Channels_InviteToChannel or Messages_CreateChat: it indicates we couldn't add a user to a chat because of their privacy settings; if required, an invite link can be shared with the user, instead. See - [TLDef(0xCCF08AD6)] - public sealed partial class UpdateGroupInvitePrivacyForbidden : Update - { - /// ID of the user we couldn't add. - public long user_id; - } /// A new story was posted. See [TLDef(0x75B3B798)] public sealed partial class UpdateStory : Update @@ -5201,6 +5229,60 @@ namespace TL { public int[] messages; } + /// See + [TLDef(0x8AE5C97A)] + public sealed partial class UpdateBotBusinessConnect : Update + { + public BotBusinessConnection connection; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } + /// See + [TLDef(0x9DDB347C)] + public sealed partial class UpdateBotNewBusinessMessage : Update + { + public Flags flags; + public string connection_id; + public MessageBase message; + [IfFlag(0)] public MessageBase reply_to_message; + public int qts; + + [Flags] public enum Flags : uint + { + has_reply_to_message = 0x1, + } + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } + /// See + [TLDef(0x07DF587C)] + public sealed partial class UpdateBotEditBusinessMessage : Update + { + public Flags flags; + public string connection_id; + public MessageBase message; + [IfFlag(0)] public MessageBase reply_to_message; + public int qts; + + [Flags] public enum Flags : uint + { + has_reply_to_message = 0x1, + } + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } + /// See + [TLDef(0xA02A982E)] + public sealed partial class UpdateBotDeleteBusinessMessage : Update + { + public string connection_id; + public Peer peer; + public int[] messages; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6339,6 +6421,8 @@ namespace TL VoiceMessages = 0xAEE69D68, ///Whether people can see your bio About = 0x3823CC40, + ///See + Birthday = 0xD65A11CC, } /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See @@ -6364,6 +6448,8 @@ namespace TL VoiceMessages = 0x0697F414, ///Whether people can see your bio About = 0xA486B761, + ///See + Birthday = 0x2000A518, } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , @@ -6411,6 +6497,9 @@ namespace TL /// Allow only close friends » See [TLDef(0x2F453E49)] public sealed partial class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } + /// See + [TLDef(0x77CDC9F1)] + public sealed partial class InputPrivacyValueAllowPremium : InputPrivacyRule { } /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , public abstract partial class PrivacyRule : IObject { } @@ -6457,6 +6546,9 @@ namespace TL /// Allow only close friends » See [TLDef(0xF7E8D89B)] public sealed partial class PrivacyValueAllowCloseFriends : PrivacyRule { } + /// See + [TLDef(0xECE9814B)] + public sealed partial class PrivacyValueAllowPremium : PrivacyRule { } /// Privacy rules See [TLDef(0x50A04E45)] @@ -7163,10 +7255,6 @@ namespace TL masks = 0x8, /// Fields , and have a value has_thumbs = 0x10, - /// Is this an animated stickerpack - animated = 0x20, - /// Is this a video stickerpack - videos = 0x40, /// This is a custom emoji stickerset emojis = 0x80, /// Field has a value @@ -7175,6 +7263,7 @@ namespace TL text_color = 0x200, /// If set, this custom emoji stickerset can be used in channel emoji statuses. channel_emoji_status = 0x400, + creator = 0x800, } } @@ -7433,6 +7522,25 @@ namespace TL /// Maximum number of peers that can be chosne. public int max_quantity; } + /// See + [TLDef(0xC9662D05)] + public sealed partial class InputKeyboardButtonRequestPeer : KeyboardButtonBase + { + public Flags flags; + public string text; + public int button_id; + public RequestPeerType peer_type; + public int max_quantity; + + [Flags] public enum Flags : uint + { + name_requested = 0x1, + username_requested = 0x2, + photo_requested = 0x4, + } + + public override string Text => text; + } /// Inline keyboard row See [TLDef(0x77608B83)] @@ -10413,7 +10521,7 @@ namespace TL public override PhoneCallProtocol Protocol => protocol; } /// Phone call See - [TLDef(0x967F7C67)] + [TLDef(0x30535AF5)] public sealed partial class PhoneCall : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -10438,6 +10546,7 @@ namespace TL public PhoneConnectionBase[] connections; /// When was the call actually started public DateTime start_date; + [IfFlag(7)] public DataJSON custom_parameters; [Flags] public enum Flags : uint { @@ -10445,6 +10554,8 @@ namespace TL p2p_allowed = 0x20, /// Whether this is a video call video = 0x40, + /// Field has a value + has_custom_parameters = 0x80, } /// Call ID @@ -14292,6 +14403,7 @@ namespace TL has_app = 0x400, /// Field has a value has_button_text = 0x800, + can_report = 0x1000, } } @@ -17286,12 +17398,12 @@ namespace TL } /// See - [TLDef(0xE7E999E7)] + [TLDef(0xBD068601)] public sealed partial class ConnectedBot : IObject { public Flags flags; public long bot_id; - public BusinessRecipients recipients; + public BusinessBotRecipients recipients; [Flags] public enum Flags : uint { @@ -17319,4 +17431,384 @@ namespace TL tags_enabled = 0x1, } } + + /// See + [TLDef(0x6C8E1E06)] + public sealed partial class Birthday : IObject + { + public Flags flags; + public int day; + public int month; + [IfFlag(0)] public int year; + + [Flags] public enum Flags : uint + { + has_year = 0x1, + } + } + + /// See + [TLDef(0x896433B4)] + public sealed partial class BotBusinessConnection : IObject + { + public Flags flags; + public string connection_id; + public long user_id; + public int dc_id; + public DateTime date; + + [Flags] public enum Flags : uint + { + can_reply = 0x1, + disabled = 0x2, + } + } + + /// See + [TLDef(0x09C469CD)] + public sealed partial class InputBusinessIntro : IObject + { + public Flags flags; + public string title; + public string description; + [IfFlag(0)] public InputDocument sticker; + + [Flags] public enum Flags : uint + { + has_sticker = 0x1, + } + } + + /// See + [TLDef(0x5A0A066D)] + public sealed partial class BusinessIntro : IObject + { + public Flags flags; + public string title; + public string description; + [IfFlag(0)] public DocumentBase sticker; + + [Flags] public enum Flags : uint + { + has_sticker = 0x1, + } + } + + /// See + [TLDef(0xFAFF629D)] + public sealed partial class Messages_MyStickers : IObject + { + public int count; + public StickerSetCoveredBase[] sets; + } + + /// See + public abstract partial class InputCollectible : IObject { } + /// See + [TLDef(0xE39460A9)] + public sealed partial class InputCollectibleUsername : InputCollectible + { + public string username; + } + /// See + [TLDef(0xA2E214A4)] + public sealed partial class InputCollectiblePhone : InputCollectible + { + public string phone; + } + + /// See + [TLDef(0x6EBDFF91)] + public sealed partial class Fragment_CollectibleInfo : IObject + { + public DateTime purchase_date; + public string currency; + public long amount; + public string crypto_currency; + public long crypto_amount; + public string url; + } + + /// See + [TLDef(0xC4E5921E)] + public sealed partial class InputBusinessBotRecipients : IObject + { + public Flags flags; + [IfFlag(4)] public InputUserBase[] users; + [IfFlag(6)] public InputUserBase[] exclude_users; + + [Flags] public enum Flags : uint + { + existing_chats = 0x1, + new_chats = 0x2, + contacts = 0x4, + non_contacts = 0x8, + has_users = 0x10, + exclude_selected = 0x20, + has_exclude_users = 0x40, + } + } + + /// See + [TLDef(0xB88CF373)] + public sealed partial class BusinessBotRecipients : IObject + { + public Flags flags; + [IfFlag(4)] public long[] users; + [IfFlag(6)] public long[] exclude_users; + + [Flags] public enum Flags : uint + { + existing_chats = 0x1, + new_chats = 0x2, + contacts = 0x4, + non_contacts = 0x8, + has_users = 0x10, + exclude_selected = 0x20, + has_exclude_users = 0x40, + } + } + + /// See + [TLDef(0x1D998733)] + public sealed partial class ContactBirthday : IObject + { + public long contact_id; + public Birthday birthday; + } + + /// See + [TLDef(0x114FF30D)] + public sealed partial class Contacts_ContactBirthdays : IObject + { + public ContactBirthday[] contacts; + public Dictionary users; + } + + /// See + [TLDef(0x628C9224)] + public sealed partial class MissingInvitee : IObject + { + public Flags flags; + public long user_id; + + [Flags] public enum Flags : uint + { + premium_would_allow_invite = 0x1, + premium_required_for_pm = 0x2, + } + } + + /// See + [TLDef(0x7F5DEFA6)] + public sealed partial class Messages_InvitedUsers : IObject + { + public UpdatesBase updates; + public MissingInvitee[] missing_invitees; + } + + /// See + [TLDef(0x11679FA7)] + public sealed partial class InputBusinessChatLink : IObject + { + public Flags flags; + public string message; + [IfFlag(0)] public MessageEntity[] entities; + [IfFlag(1)] public string title; + + [Flags] public enum Flags : uint + { + has_entities = 0x1, + has_title = 0x2, + } + } + + /// See + [TLDef(0xB4AE666F)] + public sealed partial class BusinessChatLink : IObject + { + public Flags flags; + public string link; + public string message; + [IfFlag(0)] public MessageEntity[] entities; + [IfFlag(1)] public string title; + public int views; + + [Flags] public enum Flags : uint + { + has_entities = 0x1, + has_title = 0x2, + } + } + + /// See + [TLDef(0xEC43A2D1)] + public sealed partial class Account_BusinessChatLinks : IObject, IPeerResolver + { + public BusinessChatLink[] links; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x9A23AF21)] + public sealed partial class Account_ResolvedBusinessChatLinks : IObject + { + public Flags flags; + public Peer peer; + public string message; + [IfFlag(0)] public MessageEntity[] entities; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_entities = 0x1, + } + /// returns a or for the result + public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); + } + + /// See + public abstract partial class RequestedPeer : IObject { } + /// See + [TLDef(0xD62FF46A)] + public sealed partial class RequestedPeerUser : RequestedPeer + { + public Flags flags; + public long user_id; + [IfFlag(0)] public string first_name; + [IfFlag(0)] public string last_name; + [IfFlag(1)] public string username; + [IfFlag(2)] public PhotoBase photo; + + [Flags] public enum Flags : uint + { + has_first_name = 0x1, + has_username = 0x2, + has_photo = 0x4, + } + } + /// See + [TLDef(0x7307544F)] + public sealed partial class RequestedPeerChat : RequestedPeer + { + public Flags flags; + public long chat_id; + [IfFlag(0)] public string title; + [IfFlag(2)] public PhotoBase photo; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_photo = 0x4, + } + } + /// See + [TLDef(0x8BA403E4)] + public sealed partial class RequestedPeerChannel : RequestedPeer + { + public Flags flags; + public long channel_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public string username; + [IfFlag(2)] public PhotoBase photo; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_username = 0x2, + has_photo = 0x4, + } + } + + /// See + [TLDef(0x430D3150)] + public sealed partial class SponsoredMessageReportOption : IObject + { + public string text; + public byte[] option; + } + + /// See + public abstract partial class Channels_SponsoredMessageReportResult : IObject { } + /// See + [TLDef(0x846F9E42)] + public sealed partial class Channels_SponsoredMessageReportResultChooseOption : Channels_SponsoredMessageReportResult + { + public string title; + public SponsoredMessageReportOption[] options; + } + /// See + [TLDef(0x3E3BCF2F)] + public sealed partial class Channels_SponsoredMessageReportResultAdsHidden : Channels_SponsoredMessageReportResult { } + /// See + [TLDef(0xAD798849)] + public sealed partial class Channels_SponsoredMessageReportResultReported : Channels_SponsoredMessageReportResult { } + + /// See + [TLDef(0xD07B4BAD)] + public sealed partial class Stats_BroadcastRevenueStats : IObject + { + public StatsGraphBase top_hours_graph; + public StatsGraphBase revenue_graph; + public long current_balance; + public long available_balance; + public long overall_revenue; + public double usd_rate; + } + + /// See + [TLDef(0xEC659737)] + public sealed partial class Stats_BroadcastRevenueWithdrawalUrl : IObject + { + public string url; + } + + /// See + public abstract partial class BroadcastRevenueTransaction : IObject { } + /// See + [TLDef(0x557E2CC4)] + public sealed partial class BroadcastRevenueTransactionProceeds : BroadcastRevenueTransaction + { + public long amount; + public DateTime from_date; + public DateTime to_date; + } + /// See + [TLDef(0x5A590978)] + public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction + { + public Flags flags; + public long amount; + public DateTime date; + public string provider; + [IfFlag(1)] public DateTime transaction_date; + [IfFlag(1)] public string transaction_url; + + [Flags] public enum Flags : uint + { + pending = 0x1, + has_transaction_date = 0x2, + failed = 0x4, + } + } + /// See + [TLDef(0x42D30D2E)] + public sealed partial class BroadcastRevenueTransactionRefund : BroadcastRevenueTransaction + { + public long amount; + public DateTime date; + public string provider; + } + + /// See + [TLDef(0x87158466)] + public sealed partial class Stats_BroadcastRevenueTransactions : IObject + { + public int count; + public BroadcastRevenueTransaction[] transactions; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e67c12b..7cfad11 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -92,6 +92,14 @@ namespace TL query = query, }); + /// See + public static Task InvokeWithBusinessConnection(this Client client, string connection_id, IMethod query) + => client.Invoke(new InvokeWithBusinessConnection + { + connection_id = connection_id, + query = query, + }); + /// Send the verification code for login See Possible codes: 400,406,500 (details) /// Phone number in international format /// Application identifier (see App configuration) @@ -1228,7 +1236,7 @@ namespace TL }); /// See - public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessRecipients recipients, bool can_reply = false, bool deleted = false) + public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, bool can_reply = false, bool deleted = false) => client.Invoke(new Account_UpdateConnectedBot { flags = (Account_UpdateConnectedBot.Flags)((can_reply ? 0x1 : 0) | (deleted ? 0x2 : 0)), @@ -1242,6 +1250,86 @@ namespace TL { }); + /// See + public static Task Account_GetBotBusinessConnection(this Client client, string connection_id) + => client.Invoke(new Account_GetBotBusinessConnection + { + connection_id = connection_id, + }); + + /// See + public static Task Account_UpdateBusinessIntro(this Client client, InputBusinessIntro intro = null) + => client.Invoke(new Account_UpdateBusinessIntro + { + flags = (Account_UpdateBusinessIntro.Flags)(intro != null ? 0x1 : 0), + intro = intro, + }); + + /// See + public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused) + => client.Invoke(new Account_ToggleConnectedBotPaused + { + peer = peer, + paused = paused, + }); + + /// See + public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer) + => client.Invoke(new Account_DisablePeerConnectedBot + { + peer = peer, + }); + + /// See + public static Task Account_UpdateBirthday(this Client client, Birthday birthday = null) + => client.Invoke(new Account_UpdateBirthday + { + flags = (Account_UpdateBirthday.Flags)(birthday != null ? 0x1 : 0), + birthday = birthday, + }); + + /// See + public static Task Account_CreateBusinessChatLink(this Client client, InputBusinessChatLink link) + => client.Invoke(new Account_CreateBusinessChatLink + { + link = link, + }); + + /// See + public static Task Account_EditBusinessChatLink(this Client client, string slug, InputBusinessChatLink link) + => client.Invoke(new Account_EditBusinessChatLink + { + slug = slug, + link = link, + }); + + /// See + public static Task Account_DeleteBusinessChatLink(this Client client, string slug) + => client.Invoke(new Account_DeleteBusinessChatLink + { + slug = slug, + }); + + /// See + public static Task Account_GetBusinessChatLinks(this Client client) + => client.Invoke(new Account_GetBusinessChatLinks + { + }); + + /// See + public static Task Account_ResolveBusinessChatLink(this Client client, string slug) + => client.Invoke(new Account_ResolveBusinessChatLink + { + slug = slug, + }); + + /// See + public static Task Account_UpdatePersonalChannel(this Client client, InputChannelBase channel) + => client.Invoke(new Account_UpdatePersonalChannel + { + channel = channel, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1514,6 +1602,12 @@ namespace TL limit = limit, }); + /// See + public static Task Contacts_GetBirthdays(this Client client) + => client.Invoke(new Contacts_GetBirthdays + { + }); + /// 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) @@ -1819,7 +1913,7 @@ namespace TL /// Chat ID /// User ID to be added /// Number of last messages to be forwarded - public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) + public static Task Messages_AddChatUser(this Client client, long chat_id, InputUserBase user_id, int fwd_limit) => client.Invoke(new Messages_AddChatUser { chat_id = chat_id, @@ -1843,7 +1937,7 @@ namespace TL /// List of user IDs to be invited /// Chat name /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. - public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) + public static Task Messages_CreateChat(this Client client, InputUserBase[] users, string title, int? ttl_period = null) => client.Invoke(new Messages_CreateChat { flags = (Messages_CreateChat.Flags)(ttl_period != null ? 0x1 : 0), @@ -2583,9 +2677,11 @@ namespace TL /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty - public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media) + public static Task Messages_UploadMedia(this Client client, InputPeer peer, InputMedia media, string business_connection_id = null) => client.Invoke(new Messages_UploadMedia { + flags = (Messages_UploadMedia.Flags)(business_connection_id != null ? 0x1 : 0), + business_connection_id = business_connection_id, peer = peer, media = media, }); @@ -3977,11 +4073,13 @@ namespace TL }); /// See - public static Task Messages_SendQuickReplyMessages(this Client client, InputPeer peer, int shortcut_id) + public static Task Messages_SendQuickReplyMessages(this Client client, InputPeer peer, int shortcut_id, int[] id, params long[] random_id) => client.Invoke(new Messages_SendQuickReplyMessages { peer = peer, shortcut_id = shortcut_id, + id = id, + random_id = random_id, }); /// 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
See
@@ -3999,6 +4097,14 @@ namespace TL enabled = enabled, }); + /// See + public static Task Messages_GetMyStickers(this Client client, long offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Messages_GetMyStickers + { + offset_id = offset_id, + limit = limit, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4586,7 +4692,7 @@ namespace TL /// Invite users to a channel/supergroup See Possible codes: 400,403,406 (details) /// Channel/supergroup /// Users to invite - public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, params InputUserBase[] users) + public static Task Channels_InviteToChannel(this Client client, InputChannelBase channel, params InputUserBase[] users) => client.Invoke(new Channels_InviteToChannel { channel = channel, @@ -4627,10 +4733,10 @@ namespace TL /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) /// Get geogroups /// If set and the user has reached the limit of owned public channels/supergroups/geogroups, instead of returning the channel list one of the specified errors will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in Channels_CheckUsername/Channels_UpdateUsername. - public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false) + public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false, bool for_personal = false) => client.Invoke(new Channels_GetAdminedPublicChannels { - flags = (Channels_GetAdminedPublicChannels.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0)), + flags = (Channels_GetAdminedPublicChannels.Flags)((by_location ? 0x1 : 0) | (check_limit ? 0x2 : 0) | (for_personal ? 0x4 : 0)), }); /// Ban/unban/kick a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) @@ -5076,6 +5182,23 @@ namespace TL stickerset = stickerset, }); + /// See + public static Task Channels_ReportSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, byte[] option) + => client.Invoke(new Channels_ReportSponsoredMessage + { + channel = channel, + random_id = random_id, + option = option, + }); + + /// See + public static Task Channels_RestrictSponsoredMessages(this Client client, InputChannelBase channel, bool restricted) + => client.Invoke(new Channels_RestrictSponsoredMessages + { + channel = channel, + restricted = restricted, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5401,8 +5524,6 @@ namespace TL /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset - /// Whether this is an animated stickerset - /// Whether this is a video stickerset /// Whether this is a custom emoji stickerset. /// Whether the color of TGS custom emojis contained in this set should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. For custom emoji stickersets only. /// Stickerset owner @@ -5412,10 +5533,10 @@ namespace TL /// Stickers /// Used when importing stickers using the sticker import SDKs, specifies the name of the software that created the stickers /// a null value means messages.stickerSetNotModified - public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, InputDocument thumb = null, string software = null, bool masks = false, bool animated = false, bool videos = false, bool emojis = false, bool text_color = false) + public static Task Stickers_CreateStickerSet(this Client client, InputUserBase user_id, string title, string short_name, InputStickerSetItem[] stickers, InputDocument thumb = null, string software = null, bool masks = false, bool emojis = false, bool text_color = false) => client.Invoke(new Stickers_CreateStickerSet { - flags = (Stickers_CreateStickerSet.Flags)((thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0) | (masks ? 0x1 : 0) | (animated ? 0x2 : 0) | (videos ? 0x10 : 0) | (emojis ? 0x20 : 0) | (text_color ? 0x40 : 0)), + flags = (Stickers_CreateStickerSet.Flags)((thumb != null ? 0x4 : 0) | (software != null ? 0x8 : 0) | (masks ? 0x1 : 0) | (emojis ? 0x20 : 0) | (text_color ? 0x40 : 0)), user_id = user_id, title = title, short_name = short_name, @@ -5520,6 +5641,15 @@ namespace TL stickerset = stickerset, }); + /// See + /// a null value means messages.stickerSetNotModified + public static Task Stickers_ReplaceSticker(this Client client, InputDocument sticker, InputStickerSetItem new_sticker) + => client.Invoke(new Stickers_ReplaceSticker + { + sticker = sticker, + new_sticker = new_sticker, + }); + /// Get phone call configuration to be passed to libtgvoip's shared config See public static Task Phone_GetCallConfig(this Client client) => client.Invoke(new Phone_GetCallConfig @@ -6018,6 +6148,31 @@ namespace TL limit = limit, }); + /// See + public static Task Stats_GetBroadcastRevenueStats(this Client client, InputChannelBase channel, bool dark = false) + => client.Invoke(new Stats_GetBroadcastRevenueStats + { + flags = (Stats_GetBroadcastRevenueStats.Flags)(dark ? 0x1 : 0), + channel = channel, + }); + + /// See + public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputChannelBase channel, InputCheckPasswordSRP password) + => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl + { + channel = channel, + password = password, + }); + + /// See + public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputChannelBase channel, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Stats_GetBroadcastRevenueTransactions + { + channel = channel, + offset = offset, + limit = limit, + }); + /// Export a folder », creating a chat folder deep link ». See Possible codes: 400 (details) /// The folder to export /// An optional name for the link @@ -6507,6 +6662,13 @@ namespace TL job_id = job_id, error = error, }); + + /// See + public static Task Fragment_GetCollectibleInfo(this Client client, InputCollectible collectible) + => client.Invoke(new Fragment_GetCollectibleInfo + { + collectible = collectible, + }); } } @@ -6576,6 +6738,13 @@ namespace TL.Methods public IMethod query; } + [TLDef(0xDD289F8E)] + public sealed partial class InvokeWithBusinessConnection : IMethod + { + public string connection_id; + public IMethod query; + } + [TLDef(0xA677244F)] public sealed partial class Auth_SendCode : IMethod { @@ -7479,12 +7648,12 @@ namespace TL.Methods } } - [TLDef(0x9C2D527D)] + [TLDef(0x43D8521D)] public sealed partial class Account_UpdateConnectedBot : IMethod { public Flags flags; public InputUserBase bot; - public InputBusinessRecipients recipients; + public InputBusinessBotRecipients recipients; [Flags] public enum Flags : uint { @@ -7496,6 +7665,83 @@ namespace TL.Methods [TLDef(0x4EA4C80F)] public sealed partial class Account_GetConnectedBots : IMethod { } + [TLDef(0x76A86270)] + public sealed partial class Account_GetBotBusinessConnection : IMethod + { + public string connection_id; + } + + [TLDef(0xA614D034)] + public sealed partial class Account_UpdateBusinessIntro : IMethod + { + public Flags flags; + [IfFlag(0)] public InputBusinessIntro intro; + + [Flags] public enum Flags : uint + { + has_intro = 0x1, + } + } + + [TLDef(0x646E1097)] + public sealed partial class Account_ToggleConnectedBotPaused : IMethod + { + public InputPeer peer; + public bool paused; + } + + [TLDef(0x5E437ED9)] + public sealed partial class Account_DisablePeerConnectedBot : IMethod + { + public InputPeer peer; + } + + [TLDef(0xCC6E0C11)] + public sealed partial class Account_UpdateBirthday : IMethod + { + public Flags flags; + [IfFlag(0)] public Birthday birthday; + + [Flags] public enum Flags : uint + { + has_birthday = 0x1, + } + } + + [TLDef(0x8851E68E)] + public sealed partial class Account_CreateBusinessChatLink : IMethod + { + public InputBusinessChatLink link; + } + + [TLDef(0x8C3410AF)] + public sealed partial class Account_EditBusinessChatLink : IMethod + { + public string slug; + public InputBusinessChatLink link; + } + + [TLDef(0x60073674)] + public sealed partial class Account_DeleteBusinessChatLink : IMethod + { + public string slug; + } + + [TLDef(0x6F70DDE1)] + public sealed partial class Account_GetBusinessChatLinks : IMethod { } + + [TLDef(0x5492E5EE)] + public sealed partial class Account_ResolveBusinessChatLink : IMethod + { + public string slug; + } + + [TLDef(0xD94305E0)] + public sealed partial class Account_UpdatePersonalChannel : IMethod + { + public InputChannelBase channel; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -7727,6 +7973,9 @@ namespace TL.Methods } } + [TLDef(0xDAEDA864)] + public sealed partial class Contacts_GetBirthdays : IMethod { } + [TLDef(0x63C66506)] public sealed partial class Messages_GetMessages : IMethod { @@ -7989,8 +8238,8 @@ namespace TL.Methods public InputChatPhotoBase photo; } - [TLDef(0xF24753E3)] - public sealed partial class Messages_AddChatUser : IMethod + [TLDef(0xCBC6D107)] + public sealed partial class Messages_AddChatUser : IMethod { public long chat_id; public InputUserBase user_id; @@ -8010,8 +8259,8 @@ namespace TL.Methods } } - [TLDef(0x0034A818)] - public sealed partial class Messages_CreateChat : IMethod + [TLDef(0x92CEDDD4)] + public sealed partial class Messages_CreateChat : IMethod { public Flags flags; public InputUserBase[] users; @@ -8665,11 +8914,18 @@ namespace TL.Methods } } - [TLDef(0x519BC2B1)] + [TLDef(0x14967978)] public sealed partial class Messages_UploadMedia : IMethod { + public Flags flags; + [IfFlag(0)] public string business_connection_id; public InputPeer peer; public InputMedia media; + + [Flags] public enum Flags : uint + { + has_business_connection_id = 0x1, + } } [TLDef(0xA1405817)] @@ -9846,11 +10102,13 @@ namespace TL.Methods } } - [TLDef(0x33153AD4)] + [TLDef(0x6C750DE1)] public sealed partial class Messages_SendQuickReplyMessages : IMethod { public InputPeer peer; public int shortcut_id; + public int[] id; + public long[] random_id; } [TLDef(0xE105E910)] @@ -9866,6 +10124,13 @@ namespace TL.Methods public bool enabled; } + [TLDef(0xD0B5E1FC)] + public sealed partial class Messages_GetMyStickers : IMethod + { + public long offset_id; + public int limit; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -10299,8 +10564,8 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0x199F3A6C)] - public sealed partial class Channels_InviteToChannel : IMethod + [TLDef(0xC9E33D54)] + public sealed partial class Channels_InviteToChannel : IMethod { public InputChannelBase channel; public InputUserBase[] users; @@ -10342,6 +10607,7 @@ namespace TL.Methods { by_location = 0x1, check_limit = 0x2, + for_personal = 0x4, } } @@ -10691,6 +10957,21 @@ namespace TL.Methods public InputStickerSet stickerset; } + [TLDef(0xAF8FF6B9)] + public sealed partial class Channels_ReportSponsoredMessage : IMethod + { + public InputChannelBase channel; + public byte[] random_id; + public byte[] option; + } + + [TLDef(0x9AE91519)] + public sealed partial class Channels_RestrictSponsoredMessages : IMethod + { + public InputChannelBase channel; + public bool restricted; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -10971,10 +11252,8 @@ namespace TL.Methods [Flags] public enum Flags : uint { masks = 0x1, - animated = 0x2, has_thumb = 0x4, has_software = 0x8, - videos = 0x10, emojis = 0x20, text_color = 0x40, } @@ -11057,6 +11336,13 @@ namespace TL.Methods public InputStickerSet stickerset; } + [TLDef(0x4696459A)] + public sealed partial class Stickers_ReplaceSticker : IMethod + { + public InputDocument sticker; + public InputStickerSetItem new_sticker; + } + [TLDef(0x55451FA9)] public sealed partial class Phone_GetCallConfig : IMethod { } @@ -11474,6 +11760,33 @@ namespace TL.Methods public int limit; } + [TLDef(0x75DFB671)] + public sealed partial class Stats_GetBroadcastRevenueStats : IMethod + { + public Flags flags; + public InputChannelBase channel; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } + + [TLDef(0x2A65EF73)] + public sealed partial class Stats_GetBroadcastRevenueWithdrawalUrl : IMethod + { + public InputChannelBase channel; + public InputCheckPasswordSRP password; + } + + [TLDef(0x0069280F)] + public sealed partial class Stats_GetBroadcastRevenueTransactions : IMethod + { + public InputChannelBase channel; + public int offset; + public int limit; + } + [TLDef(0x8472478E)] public sealed partial class Chatlists_ExportChatlistInvite : IMethod { @@ -11878,4 +12191,10 @@ namespace TL.Methods has_error = 0x1, } } + + [TLDef(0xBE1E85BA)] + public sealed partial class Fragment_GetCollectibleInfo : IMethod + { + public InputCollectible collectible; + } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index e68173d..e4c5faf 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 = 176; // fetched 08/03/2024 11:12:00 + public const int Version = 177; // fetched 03/04/2024 02:27:33 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,7 +145,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xA66C7EFC] = typeof(Message), + [0x2357BF25] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -205,6 +205,7 @@ namespace TL [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), [0x2A9FADC5] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), + [0x93B31848] = typeof(MessageActionRequestedPeerSentMe), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -229,10 +230,10 @@ namespace TL [0x5C467992] = typeof(InputNotifyForumTopic), [0xCACB6AE2] = typeof(InputPeerNotifySettings), [0x99622C0C] = typeof(PeerNotifySettings), - [0xA518110D] = typeof(PeerSettings), + [0xACD66C5E] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x22FF3E85] = typeof(UserFull), + [0xCC997720] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -380,7 +381,6 @@ namespace TL [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), - [0xCCF08AD6] = typeof(UpdateGroupInvitePrivacyForbidden), [0x75B3B798] = typeof(UpdateStory), [0xF74E932B] = typeof(UpdateReadStories), [0x1BF335B9] = typeof(UpdateStoryID), @@ -400,6 +400,10 @@ namespace TL [0x53E6F1EC] = typeof(UpdateDeleteQuickReply), [0x3E050D0F] = typeof(UpdateQuickReplyMessage), [0x566FE7CD] = typeof(UpdateDeleteQuickReplyMessages), + [0x8AE5C97A] = typeof(UpdateBotBusinessConnect), + [0x9DDB347C] = typeof(UpdateBotNewBusinessMessage), + [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), + [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -479,6 +483,7 @@ namespace TL [0x840649CF] = typeof(InputPrivacyValueAllowChatParticipants), [0xE94F0F86] = typeof(InputPrivacyValueDisallowChatParticipants), [0x2F453E49] = typeof(InputPrivacyValueAllowCloseFriends), + [0x77CDC9F1] = typeof(InputPrivacyValueAllowPremium), [0xFFFE1BAC] = typeof(PrivacyValueAllowContacts), [0x65427B82] = typeof(PrivacyValueAllowAll), [0xB8905FB2] = typeof(PrivacyValueAllowUsers), @@ -488,6 +493,7 @@ namespace TL [0x6B134E8E] = typeof(PrivacyValueAllowChatParticipants), [0x41C87565] = typeof(PrivacyValueDisallowChatParticipants), [0xF7E8D89B] = typeof(PrivacyValueAllowCloseFriends), + [0xECE9814B] = typeof(PrivacyValueAllowPremium), [0x50A04E45] = typeof(Account_PrivacyRules), [0xB8D0AFDF] = typeof(AccountDaysTTL), [0x6C37C15C] = typeof(DocumentAttributeImageSize), @@ -552,6 +558,7 @@ namespace TL [0x13767230] = typeof(KeyboardButtonWebView), [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), [0x53D7BFD8] = typeof(KeyboardButtonRequestPeer), + [0xC9662D05] = typeof(InputKeyboardButtonRequestPeer), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -750,7 +757,7 @@ namespace TL [0xC5226F17] = typeof(PhoneCallWaiting), [0x14B0ED0C] = typeof(PhoneCallRequested), [0x3660C311] = typeof(PhoneCallAccepted), - [0x967F7C67] = typeof(PhoneCall), + [0x30535AF5] = typeof(PhoneCall), [0x50CA4DE1] = typeof(PhoneCallDiscarded), [0x9CC123C7] = typeof(PhoneConnection), [0x635FE375] = typeof(PhoneConnectionWebrtc), @@ -1220,9 +1227,40 @@ namespace TL [0x01190CF1] = typeof(InputQuickReplyShortcutId), [0xC68D6695] = typeof(Messages_QuickReplies), [0x5F91EB5B] = null,//Messages_QuickRepliesNotModified - [0xE7E999E7] = typeof(ConnectedBot), + [0xBD068601] = typeof(ConnectedBot), [0x17D7F87B] = typeof(Account_ConnectedBots), [0x2AD93719] = typeof(Messages_DialogFilters), + [0x6C8E1E06] = typeof(Birthday), + [0x896433B4] = typeof(BotBusinessConnection), + [0x09C469CD] = typeof(InputBusinessIntro), + [0x5A0A066D] = typeof(BusinessIntro), + [0xFAFF629D] = typeof(Messages_MyStickers), + [0xE39460A9] = typeof(InputCollectibleUsername), + [0xA2E214A4] = typeof(InputCollectiblePhone), + [0x6EBDFF91] = typeof(Fragment_CollectibleInfo), + [0xC4E5921E] = typeof(InputBusinessBotRecipients), + [0xB88CF373] = typeof(BusinessBotRecipients), + [0x1D998733] = typeof(ContactBirthday), + [0x114FF30D] = typeof(Contacts_ContactBirthdays), + [0x628C9224] = typeof(MissingInvitee), + [0x7F5DEFA6] = typeof(Messages_InvitedUsers), + [0x11679FA7] = typeof(InputBusinessChatLink), + [0xB4AE666F] = typeof(BusinessChatLink), + [0xEC43A2D1] = typeof(Account_BusinessChatLinks), + [0x9A23AF21] = typeof(Account_ResolvedBusinessChatLinks), + [0xD62FF46A] = typeof(RequestedPeerUser), + [0x7307544F] = typeof(RequestedPeerChat), + [0x8BA403E4] = typeof(RequestedPeerChannel), + [0x430D3150] = typeof(SponsoredMessageReportOption), + [0x846F9E42] = typeof(Channels_SponsoredMessageReportResultChooseOption), + [0x3E3BCF2F] = typeof(Channels_SponsoredMessageReportResultAdsHidden), + [0xAD798849] = typeof(Channels_SponsoredMessageReportResultReported), + [0xD07B4BAD] = typeof(Stats_BroadcastRevenueStats), + [0xEC659737] = typeof(Stats_BroadcastRevenueWithdrawalUrl), + [0x557E2CC4] = typeof(BroadcastRevenueTransactionProceeds), + [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), + [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), + [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 694692f..b528e74 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: 176 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 177 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient From f8fab6c3e9ac5ae349a393b648a54b0975506a72 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:34:50 +0200 Subject: [PATCH 194/336] some TL generic helpers --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/TL.Xtended.cs | 8 ++++++++ 3 files changed, 10 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b80f31d..611e374 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.0.0-dev.$(Rev:r) +name: 4.0.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 47e6a28..4c8040d 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 4.0.0 +name: 4.0.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 6726515..28d04ed 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -327,6 +327,7 @@ namespace TL protected override InputPhoto ToInputPhoto() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputPhotoFileLocation ToFileLocation() => ToFileLocation(LargestPhotoSize); public InputPhotoFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type }; + public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestPhotoSize => sizes.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); } @@ -507,6 +508,7 @@ namespace TL public string Filename => GetAttribute()?.file_name; protected override InputDocument ToInputDocument() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type }; + public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestThumbSize => thumbs?.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); public T GetAttribute() where T : DocumentAttribute => attributes.OfType().FirstOrDefault(); } @@ -733,4 +735,10 @@ namespace TL partial class Theme { public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; } partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + + partial class RequestedPeer { public abstract long ID { get; } } + partial class RequestedPeerUser { public override long ID => user_id; } + partial class RequestedPeerChat { public override long ID => chat_id; } + partial class RequestedPeerChannel { public override long ID => channel_id; } + } From 741422e17fd14979dfc3f1d0c73b5e9a3cec2017 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 13 Apr 2024 02:36:46 +0200 Subject: [PATCH 195/336] Manager: prevent raising own updates in HandleDifference --- src/UpdateManager.cs | 60 +++++++++++++++++++++++++++++++++++--------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 99d9886..2323148 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -177,7 +177,7 @@ namespace WTelegram else if (pts_count != 0) local.pts = pts; } - await RaiseUpdate(update, own); + if (!own) await RaiseUpdate(update); } } finally @@ -218,7 +218,7 @@ namespace WTelegram // the update can be applied. local.pts = pts; if (mbox_id == L_SEQ) local.access_hash = updates.Date.Ticks; - await RaiseUpdate(update, own); + if (!own) await RaiseUpdate(update); i = 0; // rescan pending updates from start } } @@ -275,7 +275,7 @@ namespace WTelegram Log?.Invoke(3, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} forcibly removed!"); _pending.RemoveAt(0); local.pts = pts; - await RaiseUpdate(update, own); + if (!own) await RaiseUpdate(update); } } } @@ -393,14 +393,16 @@ namespace WTelegram RaiseCollect(updates.users, updates.chats); try { - if (updates?.updates != null) + int updatesCount = updates?.updates.Length ?? 0; + if (updatesCount != 0) for (int i = 0; i < updates.updates.Length; i++) { var update = updates.updates[i]; if (update is UpdateMessageID or UpdateStoryID) { - await RaiseUpdate(update, false); + await RaiseUpdate(update); updates.updates[i] = null; + --updatesCount; } } if (new_messages?.Length > 0) @@ -408,8 +410,11 @@ namespace WTelegram var update = state == null ? new UpdateNewChannelMessage() : new UpdateNewMessage() { pts = state.pts, pts_count = 1 }; foreach (var msg in new_messages) { + if (_pending.Any(p => p is { own: true, update: UpdateNewMessage { message: { Peer.ID: var peer_id, ID: var msg_id } } } + && peer_id == msg.Peer.ID && msg_id == msg.ID)) + continue; update.message = msg; - await RaiseUpdate(update, false); + await RaiseUpdate(update); } } if (enc_messages?.Length > 0) @@ -418,12 +423,44 @@ namespace WTelegram if (state != null) update.qts = state.qts; foreach (var msg in enc_messages) { + if (_pending.Any(p => p is { own: true, update: UpdateNewEncryptedMessage { message: { ChatId: var chat_id, RandomId: var random_id } } } + && chat_id == msg.ChatId && random_id == msg.RandomId)) + continue; update.message = msg; - await RaiseUpdate(update, false); + await RaiseUpdate(update); } } - if (updates?.updates != null) - await HandleUpdates(updates, false); + if (updatesCount != 0) + { + // try to remove matching pending OwnUpdates from this updates list (starting from most-recent) + for (int p = _pending.Count - 1, u = updates.updates.Length; p >= 0 && u > 0; p--) + { + if (_pending[p].own == false) continue; + var updateP = _pending[p].update; + var (mbox_idP, ptsP, pts_countP) = updateP.GetMBox(); + if (ptsP == 0) (mbox_idP, ptsP, pts_countP) = _pending[p].updates.GetMBox(); + Type updatePtype = null; + while (--u >= 0) + { + var update = updates.updates[u]; + if (update == null) continue; + var (mbox_id, pts, pts_count) = update.GetMBox(); + if (pts == 0) (mbox_id, pts, pts_count) = updates.GetMBox(); + if (mbox_idP == mbox_id && ptsP <= pts) + { + updatePtype ??= updateP.GetType(); + if (updatePtype == (update is UpdateDeleteMessages ? typeof(UpdateAffectedMessages) : update.GetType())) + { + updates.updates[u] = null; + --updatesCount; + break; + } + } + } + } + if (updatesCount != 0) + await HandleUpdates(updates, false); + } } finally { @@ -463,9 +500,8 @@ namespace WTelegram } } - private async Task RaiseUpdate(Update update, bool own) + private async Task RaiseUpdate(Update update) { - if (own) return; try { var task = _onUpdate(update); @@ -519,7 +555,7 @@ namespace WTelegram => System.IO.File.WriteAllText(statePath, System.Text.Json.JsonSerializer.Serialize(State, Helpers.JsonOptions)); public static Dictionary LoadState(string statePath) => !System.IO.File.Exists(statePath) ? null : System.Text.Json.JsonSerializer.Deserialize>(System.IO.File.ReadAllText(statePath), Helpers.JsonOptions); - /// returns a or for the given Peer + /// returns a or for the given Peer (only if using the default collector) public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(Users, Chats); } From 8c271f50f6af977bd517b3b0f9bd3e9d7a77d3f9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 14 Apr 2024 13:25:45 +0200 Subject: [PATCH 196/336] Fix crash on Gzipped Vector result --- Examples/Program_ListenUpdates.cs | 4 +++- generator/MTProtoGenerator.cs | 2 +- src/Client.cs | 2 +- src/TL.cs | 4 ++-- 4 files changed, 7 insertions(+), 5 deletions(-) diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 0bf7f4a..1233764 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -25,8 +25,10 @@ namespace WTelegramClientTest // We collect all infos about the users/chats so that updates can be printed with their names var dialogs = await Client.Messages_GetAllDialogs(); // dialogs = groups/channels/users dialogs.CollectUsersChats(Manager.Users, Manager.Chats); + Console.ReadKey(); - } + } // WTelegram.Client gets disposed when exiting this scope + //Manager.SaveState("Updates.state"); // if you want to resume missed updates on the next run (see WithUpdateManager above) } diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index e0025e3..14db231 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -85,7 +85,7 @@ public class MTProtoGenerator : IIncrementalGenerator continue; } if (id == 0x3072CFA1) // GzipPacked - makeTL.AppendLine($"\t\t\t0x{id:X8} => reader.ReadTLGzipped(),"); + makeTL.AppendLine($"\t\t\t0x{id:X8} => (IObject)reader.ReadTLGzipped(typeof(IObject)),"); else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) makeTL.AppendLine($"\t\t\t0x{id:X8} => new {(ns == "TL" ? "" : ns + '.')}{name}().ReadTL(reader),"); var override_ = symbol.BaseType == object_ ? "" : "override "; diff --git a/src/Client.cs b/src/Client.cs index 8cf1339..39c9c7b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -570,7 +570,7 @@ namespace WTelegram if (peek == Layer.RpcErrorCtor) result = reader.ReadTLObject(Layer.RpcErrorCtor); else if (peek == Layer.GZipedCtor) - result = reader.ReadTLGzipped(); + result = reader.ReadTLGzipped(rpc.type); else { reader.BaseStream.Position -= 4; diff --git a/src/TL.cs b/src/TL.cs index 0045cef..6d620ed 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -350,10 +350,10 @@ namespace TL writer.Write(0); // null arrays/strings are serialized as empty } - internal static IObject ReadTLGzipped(this BinaryReader reader) + internal static object ReadTLGzipped(this BinaryReader reader, Type type) { using var gzipReader = new BinaryReader(new GZipStream(new MemoryStream(reader.ReadTLBytes()), CompressionMode.Decompress)); - return ReadTLObject(gzipReader); + return gzipReader.ReadTLValue(type); } internal static bool ReadTLBool(this BinaryReader reader) => reader.ReadUInt32() switch From 1d07039f04f70730465b26c0e011957b1b9ae16b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 16 Apr 2024 15:19:12 +0200 Subject: [PATCH 197/336] Fix potential conflict on System.Collections.Immutable --- EXAMPLES.md | 8 ++++---- Examples/Program_DownloadSavedMedia.cs | 2 +- Examples/Program_GetAllChats.cs | 2 +- Examples/Program_Heroku.cs | 4 ++-- Examples/Program_ListenUpdates.cs | 2 +- Examples/Program_ReactorError.cs | 2 +- Examples/Program_SecretChats.cs | 2 +- src/TL.cs | 2 +- src/UpdateManager.cs | 2 +- src/WTelegramClient.csproj | 7 +++++-- 10 files changed, 18 insertions(+), 15 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index 9c5b463..290879e 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -11,7 +11,7 @@ await client.LoginUserIfNeeded(); ``` In this case, environment variables are used for configuration so make sure to -go to your **Project Properties > Debug > Environment variables** +go to your **Project Properties > Debug > Launch Profiles > Environment variables** and add at least these variables with adequate values: **api_id, api_hash, phone_number** Remember that these are just simple example codes that you should adjust to your needs. @@ -389,9 +389,9 @@ var chat = chats.chats[1234567890]; // the target chat After the above code, once you [have obtained](FAQ.md#access-hash) an `InputUser` or `User`, you can: ```csharp // • Directly add the user to a Chat/Channel/group: -await client.AddChatUser(chat, user); -// You may get exception USER_PRIVACY_RESTRICTED if the user has denied the right to be added to a chat -// or exception USER_NOT_MUTUAL_CONTACT if the user left the chat previously and you want to add him again +var miu = await client.AddChatUser(chat, user); +// You may get exception USER_NOT_MUTUAL_CONTACT if the user left the chat previously and you want to add him again +// or a result with miu.missing_invitees listing users that denied the right to be added to a chat // • Obtain the main invite link for the chat, and send it to the user: var mcf = await client.GetFullChat(chat); diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 11e2271..72c1f2b 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -7,7 +7,7 @@ namespace WTelegramClientTest { static class Program_DownloadSavedMedia { - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + // go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 8d1c442..6e4a9c2 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -9,7 +9,7 @@ namespace WTelegramClientTest // This code is similar to what you should have obtained if you followed the README introduction // I've just added a few comments to explain further what's going on - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + // go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number static string Config(string what) { if (what == "api_id") return Environment.GetEnvironmentVariable("api_id"); diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index f1baa5a..f1f9cbe 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -75,7 +75,7 @@ namespace WTelegramClientTest var parts = databaseUrl.Split(':', '/', '@'); _sql = new NpgsqlConnection($"User ID={parts[3]};Password={parts[4]};Host={parts[5]};Port={parts[6]};Database={parts[7]};Pooling=true;SSL Mode=Require;Trust Server Certificate=True;"); _sql.Open(); - using (var create = new NpgsqlCommand($"CREATE TABLE IF NOT EXISTS WTelegram_sessions (name text NOT NULL PRIMARY KEY, data bytea)", _sql)) + using (var create = new NpgsqlCommand("CREATE TABLE IF NOT EXISTS WTelegram_sessions (name text NOT NULL PRIMARY KEY, data bytea)", _sql)) create.ExecuteNonQuery(); using var cmd = new NpgsqlCommand($"SELECT data FROM WTelegram_sessions WHERE name = '{_sessionName}'", _sql); using var rdr = cmd.ExecuteReader(); @@ -134,7 +134,7 @@ HOW TO USE AND DEPLOY THIS EXAMPLE HEROKU USERBOT: - In Visual Studio, Clone the Heroku git repository and add some standard .gitignore .gitattributes files - In this repository folder, create a new .NET Console project with this Program.cs file - Add these Nuget packages: WTelegramClient and Npgsql -- In Project properties > Debug > Environment variables, configure the same values for DATABASE_URL, api_hash, phone_number +- In Project properties > Debug > Launch Profiles > Environment variables, configure the same values for DATABASE_URL, api_hash, phone_number - Run the project in Visual Studio. The first time, it should ask you interactively for elements to complete the connection - On the following runs, the PostgreSQL database contains the session data and it should connect automatically - You can test the userbot by sending him "Ping" in private message (or saved messages). It should respond with "Pong" diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 1233764..05f7f28 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -10,7 +10,7 @@ namespace WTelegramClientTest static WTelegram.UpdateManager Manager; static User My; - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + // go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) { Console.WriteLine("The program will display updates received for the logged-in user. Press any key to terminate"); diff --git a/Examples/Program_ReactorError.cs b/Examples/Program_ReactorError.cs index ce0e629..370da34 100644 --- a/Examples/Program_ReactorError.cs +++ b/Examples/Program_ReactorError.cs @@ -8,7 +8,7 @@ namespace WTelegramClientTest { static WTelegram.Client Client; - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + // go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main(string[] _) { Console.WriteLine("The program demonstrate how to handle ReactorError. Press any key to terminate"); diff --git a/Examples/Program_SecretChats.cs b/Examples/Program_SecretChats.cs index bebd5ac..cff9092 100644 --- a/Examples/Program_SecretChats.cs +++ b/Examples/Program_SecretChats.cs @@ -16,7 +16,7 @@ namespace WTelegramClientTest static readonly Dictionary Users = []; static readonly Dictionary Chats = []; - // go to Project Properties > Debug > Environment variables and add at least these: api_id, api_hash, phone_number + // go to Project Properties > Debug > Launch Profiles > Environment variables and add at least these: api_id, api_hash, phone_number static async Task Main() { Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); diff --git a/src/TL.cs b/src/TL.cs index 6d620ed..209a642 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -80,7 +80,7 @@ namespace TL return reader.ReadTL(ctorNb); #else if (ctorNb == 0) ctorNb = reader.ReadUInt32(); - if (ctorNb == Layer.GZipedCtor) return reader.ReadTLGzipped(); + if (ctorNb == Layer.GZipedCtor) return (IObject)reader.ReadTLGzipped(typeof(IObject)); if (!Layer.Table.TryGetValue(ctorNb, out var type)) throw new WTelegram.WTException($"Cannot find type for ctor #{ctorNb:x}"); if (type == null) return null; // nullable ctor (class meaning is associated with null) diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 2323148..5bf0b0e 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -58,7 +58,7 @@ namespace WTelegram _onUpdate = onUpdate; _collector = collector ?? new Services.CollectorPeer(Users = [], Chats = []); - if (state == null) + if (state == null || state.Count < 3) _local = new() { [L_SEQ] = new() { access_hash = UndefinedSeqDate }, [L_QTS] = new(), [L_PTS] = new() }; else _local = state as Dictionary ?? new Dictionary(state); diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index b528e74..d41f79d 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -43,15 +43,18 @@ --> - + - + + + + From 6dcce7f784ea408c4d0a550091c69a0c87848c47 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 17 Apr 2024 17:33:48 +0200 Subject: [PATCH 198/336] Fix support for email code login --- src/Client.cs | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 39c9c7b..184ac8b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1115,7 +1115,7 @@ namespace WTelegram sentCodeBase = await this.Auth_SendCode(phone_number, _session.ApiId, _apiHash, settings); } Auth_AuthorizationBase authorization = null; - string phone_code_hash = null; + string phone_code_hash = null, email = null; try { if (sentCodeBase is Auth_SentCode { type: Auth_SentCodeTypeSetUpEmailRequired setupEmail } setupSentCode) @@ -1123,7 +1123,7 @@ namespace WTelegram phone_code_hash = setupSentCode.phone_code_hash; Helpers.Log(3, "A login email is required"); RaiseUpdates(sentCodeBase); - var email = _config("email"); + email = _config("email"); if (string.IsNullOrEmpty(email)) sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); else @@ -1140,12 +1140,7 @@ namespace WTelegram try { var code = await ConfigAsync("email_verification_code"); - if (email is "Google") - verified = await this.Account_VerifyEmail(purpose, new EmailVerificationGoogle { token = code }); - else if (email is "Apple") - verified = await this.Account_VerifyEmail(purpose, new EmailVerificationApple { token = code }); - else - verified = await this.Account_VerifyEmail(purpose, new EmailVerificationCode { code = code }); + verified = await this.Account_VerifyEmail(purpose, EmailVerification(email, code)); } catch (RpcException e) when (e.Code == 400 && e.Message is "CODE_INVALID" or "EMAIL_TOKEN_INVALID") { @@ -1195,7 +1190,10 @@ namespace WTelegram sentCodeBase = await this.Auth_ResendCode(phone_number, phone_code_hash); goto resent; } - authorization = await this.Auth_SignIn(phone_number, phone_code_hash, verification_code); + if (sentCode.type is Auth_SentCodeTypeEmailCode) + authorization = await this.Auth_SignIn(phone_number, phone_code_hash, null, EmailVerification(email ??= _config("email"), verification_code)); + else + authorization = await this.Auth_SignIn(phone_number, phone_code_hash, verification_code); } catch (RpcException e) when (e.Code == 400 && e.Message == "PHONE_CODE_INVALID") { @@ -1219,6 +1217,13 @@ namespace WTelegram } } } + + static EmailVerification EmailVerification(string email, string code) => email switch + { + "Google" => new EmailVerificationGoogle { token = code }, + "Apple" => new EmailVerificationApple { token = code }, + _ => new EmailVerificationCode { code = code } + }; } catch (Exception ex) when (ex is not RpcException { Message: "FLOOD_WAIT_X" }) { From 8228fede0f48f6289bd6aba4cfe3b6a65251214a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 18 Apr 2024 18:33:21 +0200 Subject: [PATCH 199/336] Turn "until" fields into DateTime --- src/TL.Schema.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 32bb1ac..267207b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2995,7 +2995,7 @@ namespace TL /// Peer was muted? [IfFlag(1)] public bool silent; /// Date until which all notifications shall be switched off - [IfFlag(2)] public int mute_until; + [IfFlag(2)] public DateTime mute_until; /// Identifier of an audio file to play for notifications. [IfFlag(3)] public NotificationSound sound; /// Whether story notifications should be disabled. @@ -3035,7 +3035,7 @@ namespace TL /// (Ternary value) If set, indicates whether to mute or unmute the peer; otherwise the default behavior should be used. [IfFlag(1)] public bool silent; /// Mute all notifications until this date - [IfFlag(2)] public int mute_until; + [IfFlag(2)] public DateTime mute_until; /// Notification sound for the official iOS application [IfFlag(3)] public NotificationSound ios_sound; /// Notification sound for the official android application @@ -15143,7 +15143,7 @@ namespace TL public sealed partial class EmojiStatusUntil : EmojiStatus { /// This status is valid until this date - public int until; + public DateTime until; } /// A list of emoji statuses See From b6dbf9564f26a58af8bc1edb9652d101f194beb4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 22 Apr 2024 17:28:44 +0200 Subject: [PATCH 200/336] Fix excessive stack usage (#246) --- generator/MTProtoGenerator.cs | 80 +++++++++++++++++------------------ src/TL.Table.cs | 2 + src/TL.Xtended.cs | 5 ++- src/TL.cs | 8 ++-- 4 files changed, 51 insertions(+), 44 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 14db231..06ad7d1 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -31,10 +31,11 @@ public class MTProtoGenerator : IIncrementalGenerator if (unit.compilation.GetTypeByMetadataName("TL.IObject") is not { } iobject) return; var nullables = LoadNullables(layer); var namespaces = new Dictionary>(); // namespace,class,methods - var makeTL = new StringBuilder(); + var tableTL = new StringBuilder(); var source = new StringBuilder(); source .AppendLine("using System;") + .AppendLine("using System.Collections.Generic;") .AppendLine("using System.ComponentModel;") .AppendLine("using System.IO;") .AppendLine("using System.Linq;") @@ -42,8 +43,8 @@ public class MTProtoGenerator : IIncrementalGenerator .AppendLine() .AppendLine("#pragma warning disable CS0109") .AppendLine(); - makeTL - .AppendLine("\t\tpublic static IObject ReadTL(this BinaryReader reader, uint ctorId = 0) => (ctorId != 0 ? ctorId : reader.ReadUInt32()) switch") + tableTL + .AppendLine("\t\tpublic static readonly Dictionary> Table = new()") .AppendLine("\t\t{"); foreach (var classDecl in unit.classes) @@ -54,7 +55,7 @@ public class MTProtoGenerator : IIncrementalGenerator if (tldef == null) continue; var id = (uint)tldef.ConstructorArguments[0].Value; var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; - StringBuilder writeTl = new(), ctorTL = new(); + StringBuilder writeTl = new(), readTL = new(); var ns = symbol.BaseType.ContainingNamespace.ToString(); var name = symbol.BaseType.Name; if (ns != "System") @@ -85,18 +86,18 @@ public class MTProtoGenerator : IIncrementalGenerator continue; } if (id == 0x3072CFA1) // GzipPacked - makeTL.AppendLine($"\t\t\t0x{id:X8} => (IObject)reader.ReadTLGzipped(typeof(IObject)),"); + tableTL.AppendLine($"\t\t\t[0x{id:X8}] = reader => (IObject)reader.ReadTLGzipped(typeof(IObject)),"); else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) - makeTL.AppendLine($"\t\t\t0x{id:X8} => new {(ns == "TL" ? "" : ns + '.')}{name}().ReadTL(reader),"); + tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); var override_ = symbol.BaseType == object_ ? "" : "override "; if (name == "Messages_AffectedMessages") override_ = "virtual "; //if (symbol.Constructors[0].IsImplicitlyDeclared) // ctorTL.AppendLine($"\t\tpublic {name}() {{ }}"); if (symbol.IsGenericType) name += ""; - ctorTL - .AppendLine("\t\t[EditorBrowsable(EditorBrowsableState.Never)]") - .AppendLine($"\t\tpublic new {name} ReadTL(BinaryReader reader)") - .AppendLine("\t\t{"); + readTL + .AppendLine($"\t\tpublic static new {name} ReadTL(BinaryReader reader)") + .AppendLine("\t\t{") + .AppendLine($"\t\t\tvar r = new {name}();"); writeTl .AppendLine("\t\t[EditorBrowsable(EditorBrowsableState.Never)]") .AppendLine($"\t\tpublic {override_}void WriteTL(BinaryWriter writer)") @@ -109,88 +110,88 @@ public class MTProtoGenerator : IIncrementalGenerator foreach (var member in members.OfType()) { if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; - ctorTL.Append("\t\t\t"); + readTL.Append("\t\t\t"); writeTl.Append("\t\t\t"); var ifFlag = (int?)member.GetAttributes().FirstOrDefault(a => a.AttributeClass == ifFlagAttribute)?.ConstructorArguments[0].Value; if (ifFlag != null) { - var condition = ifFlag < 32 ? $"if (((uint)flags & 0x{1 << ifFlag:X}) != 0) " - : $"if (((uint)flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "; - ctorTL.Append(condition); - writeTl.Append(condition); + readTL.Append(ifFlag < 32 ? $"if (((uint)r.flags & 0x{1 << ifFlag:X}) != 0) " + : $"if (((uint)r.flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "); + writeTl.Append(ifFlag < 32 ? $"if (((uint)flags & 0x{1 << ifFlag:X}) != 0) " + : $"if (((uint)flags2 & 0x{1 << (ifFlag - 32):X}) != 0) "); } string memberType = member.Type.ToString(); switch (memberType) { case "int": - ctorTL.AppendLine($"{member.Name} = reader.ReadInt32();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadInt32();"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "long": - ctorTL.AppendLine($"{member.Name} = reader.ReadInt64();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadInt64();"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "double": - ctorTL.AppendLine($"{member.Name} = reader.ReadDouble();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadDouble();"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "bool": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLBool();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLBool();"); writeTl.AppendLine($"writer.Write({member.Name} ? 0x997275B5 : 0xBC799737);"); break; case "System.DateTime": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLStamp();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLStamp();"); writeTl.AppendLine($"writer.WriteTLStamp({member.Name});"); break; case "string": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLString();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLString();"); writeTl.AppendLine($"writer.WriteTLString({member.Name});"); break; case "byte[]": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLBytes();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLBytes();"); writeTl.AppendLine($"writer.WriteTLBytes({member.Name});"); break; case "TL.Int128": - ctorTL.AppendLine($"{member.Name} = new Int128(reader);"); + readTL.AppendLine($"r.{member.Name} = new Int128(reader);"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "TL.Int256": - ctorTL.AppendLine($"{member.Name} = new Int256(reader);"); + readTL.AppendLine($"r.{member.Name} = new Int256(reader);"); writeTl.AppendLine($"writer.Write({member.Name});"); break; case "TL._Message[]": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLRawVector<_Message>(0x5BB8E511);"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<_Message>(0x5BB8E511);"); writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); break; case "TL.IObject": case "TL.IMethod": - ctorTL.AppendLine($"{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTL();"); + readTL.AppendLine($"r.{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTLObject();"); writeTl.AppendLine($"{member.Name}.WriteTL(writer);"); break; case "System.Collections.Generic.Dictionary": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; case "System.Collections.Generic.Dictionary": - ctorTL.AppendLine($"{member.Name} = reader.ReadTLDictionary();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; default: if (member.Type is IArrayTypeSymbol arrayType) { if (name is "FutureSalts") - ctorTL.AppendLine($"{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC);"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC);"); else - ctorTL.AppendLine($"{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); } else if (member.Type.BaseType.SpecialType == SpecialType.System_Enum) { - ctorTL.AppendLine($"{member.Name} = ({memberType})reader.ReadUInt32();"); + readTL.AppendLine($"r.{member.Name} = ({memberType})reader.ReadUInt32();"); writeTl.AppendLine($"writer.Write((uint){member.Name});"); } else if (memberType.StartsWith("TL.")) { - ctorTL.AppendLine($"{member.Name} = ({memberType})reader.ReadTL();"); + readTL.AppendLine($"r.{member.Name} = ({memberType})reader.ReadTLObject();"); var nullStr = nullables.TryGetValue(memberType, out uint nullCtor) ? $"0x{nullCtor:X8}" : "Layer.NullCtor"; writeTl.AppendLine($"if ({member.Name} != null) {member.Name}.WriteTL(writer); else writer.Write({nullStr});"); } @@ -199,18 +200,17 @@ public class MTProtoGenerator : IIncrementalGenerator break; } } - ctorTL.AppendLine("\t\t\treturn this;"); - ctorTL.AppendLine("\t\t}"); + readTL.AppendLine("\t\t\treturn r;"); + readTL.AppendLine("\t\t}"); writeTl.AppendLine("\t\t}"); - ctorTL.Append(writeTl.ToString()); - classes[name] = ctorTL.ToString(); + readTL.Append(writeTl.ToString()); + classes[name] = readTL.ToString(); } foreach (var nullable in nullables) - makeTL.AppendLine($"\t\t\t0x{nullable.Value:X8} => null,"); - makeTL.AppendLine("\t\t\tvar ctorNb => throw new WTelegram.WTException($\"Cannot find type for ctor #{ctorNb:x}\")"); - makeTL.AppendLine("\t\t};"); - namespaces["TL"]["Layer"] = makeTL.ToString(); + tableTL.AppendLine($"\t\t\t[0x{nullable.Value:X8}] = null,"); + tableTL.AppendLine("\t\t};"); + namespaces["TL"]["Layer"] = tableTL.ToString(); foreach (var namesp in namespaces) { source.Append("namespace ").AppendLine(namesp.Key).Append('{'); diff --git a/src/TL.Table.cs b/src/TL.Table.cs index e4c5faf..0e6ea71 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -17,6 +17,7 @@ namespace TL internal const uint BadMsgCtor = 0xA7EFF811; internal const uint GZipedCtor = 0x3072CFA1; +#if !MTPG [EditorBrowsable(EditorBrowsableState.Never)] public readonly static Dictionary Table = new() { @@ -1315,6 +1316,7 @@ namespace TL [0xAA48327D] = typeof(Layer8.DecryptedMessageService), [0x1F814F1F] = typeof(Layer8.DecryptedMessage), }; +#endif internal readonly static Dictionary Nullables = new() { diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 28d04ed..0433a0a 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -548,7 +548,10 @@ namespace TL partial class MessageEntity { - public string Type { get { var name = GetType().Name; return name[(name.IndexOf("MessageEntity") + 13)..]; } } + public string Type { + get { var name = GetType().Name; return name[(name.IndexOf("MessageEntity") + 13)..]; } + set { if (value != Type) throw new NotSupportedException("Can't change Type. You need to create a new instance of the right TL.MessageEntity* subclass"); } + } public int Offset { get => offset; set => offset = value; } public int Length { get => length; set => length = value; } } diff --git a/src/TL.cs b/src/TL.cs index 209a642..6884b25 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -76,10 +76,12 @@ namespace TL public static IObject ReadTLObject(this BinaryReader reader, uint ctorNb = 0) { -#if MTPG - return reader.ReadTL(ctorNb); -#else if (ctorNb == 0) ctorNb = reader.ReadUInt32(); +#if MTPG + if (!Layer.Table.TryGetValue(ctorNb, out var ctor)) + throw new WTelegram.WTException($"Cannot find type for ctor #{ctorNb:x}"); + return ctor?.Invoke(reader); +#else if (ctorNb == Layer.GZipedCtor) return (IObject)reader.ReadTLGzipped(typeof(IObject)); if (!Layer.Table.TryGetValue(ctorNb, out var type)) throw new WTelegram.WTException($"Cannot find type for ctor #{ctorNb:x}"); From 69f9e0c41875cb5857529ae165760f44997fe6b3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:25:45 +0200 Subject: [PATCH 201/336] better handle sendSemaphore on client dispose scenario --- src/Client.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index 184ac8b..c620140 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -185,6 +185,7 @@ namespace WTelegram lock (_pendingRpcs) // abort all pending requests foreach (var rpc in _pendingRpcs.Values) rpc.tcs.TrySetException(ex); + _sendSemaphore.Dispose(); _networkStream = null; if (IsMainDC) _session.Dispose(); GC.SuppressFinalize(this); @@ -1304,7 +1305,7 @@ namespace WTelegram await SendAsync(container, false); return; } - await _sendSemaphore.WaitAsync(); + await _sendSemaphore.WaitAsync(_cts.Token); try { using var memStream = new MemoryStream(1024); From 4381781af81d23a1f34efc4f2d0c3b33d87f4e5f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 24 Apr 2024 17:42:46 +0200 Subject: [PATCH 202/336] API Layer 178: mostly reactions & sponsored stuff --- README.md | 4 +- src/TL.MTProto.cs | 2 +- src/TL.Schema.cs | 136 ++++++++++++++++++++++--------------- src/TL.SchemaFuncs.cs | 81 ++++++++++++++++++++-- src/TL.Secret.cs | 2 +- src/TL.Table.cs | 14 ++-- src/WTelegramClient.csproj | 2 +- 7 files changed, 168 insertions(+), 73 deletions(-) diff --git a/README.md b/README.md index 78e7a9c..ce4f127 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-177-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-178-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://www.buymeacoffee.com/wizou) @@ -203,3 +203,5 @@ If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.gith the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) If you like this library, you can [buy me a coffee](https://www.buymeacoffee.com/wizou) ❤ This will help the project keep going. + +© 2024 Olivier Marcoux diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 8d9bd50..86d6e90 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -5,7 +5,7 @@ using Client = WTelegram.Client; namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 [TLDef(0x05162463)] //resPQ#05162463 nonce:int128 server_nonce:int128 pq:bytes server_public_key_fingerprints:Vector = ResPQ public sealed partial class ResPQ : IObject { diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 267207b..ca1da89 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3,7 +3,7 @@ using System.Collections.Generic; namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 /// Boolean type. See public enum Bool : uint { @@ -1219,9 +1219,10 @@ namespace TL public virtual long[] RecentRequesters => default; /// Allowed message reactions » public virtual ChatReactions AvailableReactions => default; + public virtual int ReactionsLimit => default; } /// Full info about a basic group. See - [TLDef(0xC9D31138)] + [TLDef(0x2633421B)] public sealed partial class ChatFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1258,6 +1259,7 @@ namespace TL [IfFlag(17)] public long[] recent_requesters; /// Allowed message reactions » [IfFlag(18)] public ChatReactions available_reactions; + [IfFlag(20)] public int reactions_limit; [Flags] public enum Flags : uint { @@ -1289,6 +1291,8 @@ namespace TL has_available_reactions = 0x40000, /// Whether the real-time chat translation popup should be hidden. translations_disabled = 0x80000, + /// Field has a value + has_reactions_limit = 0x100000, } /// ID of the chat @@ -1321,9 +1325,10 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x44C054A7)] + [TLDef(0xBBAB348D)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1400,6 +1405,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » [IfFlag(30)] public ChatReactions available_reactions; + [IfFlag(45)] public int reactions_limit; /// Channel stories [IfFlag(36)] public PeerStories stories; /// Wallpaper @@ -1500,6 +1506,8 @@ namespace TL has_emojiset = 0x400, restricted_sponsored = 0x800, can_view_revenue = 0x1000, + /// Field has a value + has_reactions_limit = 0x2000, } /// ID of the channel @@ -1532,6 +1540,7 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + public override int ReactionsLimit => reactions_limit; } /// Details of a group member. See Derived classes: , , @@ -3350,6 +3359,7 @@ namespace TL has_birthday = 0x20, /// Fields and have a value has_personal_channel_id = 0x40, + sponsored_enabled = 0x80, } } @@ -5283,6 +5293,14 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } + /// See + [TLDef(0x1824E40B)] + public sealed partial class UpdateNewStoryReaction : Update + { + public int story_id; + public Peer peer; + public Reaction reaction; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -12626,6 +12644,7 @@ namespace TL allow_firebase = 0x80, /// Fields and have a value has_token = 0x100, + unknown_number = 0x200, } } @@ -13153,6 +13172,19 @@ namespace TL has_story = 0x1, } } + /// See + [TLDef(0x50CC03D3)] + public sealed partial class WebPageAttributeStickerSet : WebPageAttribute + { + public Flags flags; + public DocumentBase[] stickers; + + [Flags] public enum Flags : uint + { + emojis = 0x1, + text_color = 0x2, + } + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -14345,33 +14377,23 @@ namespace TL public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xED5383F7)] + [TLDef(0xBDEDF566)] public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Message ID public byte[] random_id; - /// ID of the sender of the message - [IfFlag(3)] public Peer from_id; - /// Information about the chat invite hash specified in chat_invite_hash - [IfFlag(4)] public ChatInviteBase chat_invite; - /// Chat invite - [IfFlag(4)] public string chat_invite_hash; - /// Optional link to a channel post if from_id points to a channel - [IfFlag(2)] public int channel_post; - /// Parameter for the bot start message if the sponsored chat is a chat with a bot. - [IfFlag(0)] public string start_param; - /// Sponsored website - [IfFlag(9)] public SponsoredWebPage webpage; - /// Mini App » to open when the sponsored message is clicked. - [IfFlag(10)] public BotApp app; + public string url; + public string title; /// Sponsored message public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + [IfFlag(6)] public PhotoBase photo; + [IfFlag(13)] public PeerColor color; /// Text of the sponsored message button. - [IfFlag(11)] public string button_text; + public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. @@ -14379,31 +14401,19 @@ namespace TL [Flags] public enum Flags : uint { - /// Field has a value - has_start_param = 0x1, /// Field has a value has_entities = 0x2, - /// Field has a value - has_channel_post = 0x4, - /// Field has a value - has_from_id = 0x8, - /// Fields and have a value - has_chat_invite = 0x10, /// Whether the message needs to be labeled as "recommended" instead of "sponsored" recommended = 0x20, - /// Whether a profile photo bubble should be displayed for this message, like for messages sent in groups. The photo shown in the bubble is obtained either from the peer contained in from_id, or from chat_invite. - show_peer_photo = 0x40, + /// Field has a value + has_photo = 0x40, /// Field has a value has_sponsor_info = 0x80, /// Field has a value has_additional_info = 0x100, - /// Field has a value - has_webpage = 0x200, - /// Field has a value - has_app = 0x400, - /// Field has a value - has_button_text = 0x800, can_report = 0x1000, + /// Field has a value + has_color = 0x2000, } } @@ -15986,26 +15996,6 @@ namespace TL public override DateTime Date => date; } - /// Represents a sponsored website. See - [TLDef(0x3DB8EC63)] - public sealed partial class SponsoredWebPage : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Web page URL. - public string url; - /// Website name. - public string site_name; - /// Optional image preview. - [IfFlag(0)] public PhotoBase photo; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_photo = 0x1, - } - } - /// Aggregated view and reaction information of a story. See [TLDef(0x8D595CD6)] public sealed partial class StoryViews : IObject @@ -16194,17 +16184,25 @@ namespace TL } /// List of stories See - [TLDef(0x5DD8C3C8)] + [TLDef(0x63C3DD0A)] public sealed partial class Stories_Stories : IObject, IPeerResolver { + public Flags flags; /// Total number of stories that can be fetched public int count; /// Stories public StoryItemBase[] stories; + [IfFlag(0)] public int[] pinned_to_top; /// Mentioned chats public Dictionary chats; /// Mentioned users public Dictionary users; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_pinned_to_top = 0x1, + } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -17811,4 +17809,30 @@ namespace TL public int count; public BroadcastRevenueTransaction[] transactions; } + + /// See + public enum ReactionNotificationsFrom : uint + { + ///See + Contacts = 0xBAC3A61A, + ///See + All = 0x4B9E22A0, + } + + /// See + [TLDef(0x56E34970)] + public sealed partial class ReactionsNotifySettings : IObject + { + public Flags flags; + [IfFlag(0)] public ReactionNotificationsFrom messages_notify_from; + [IfFlag(1)] public ReactionNotificationsFrom stories_notify_from; + public NotificationSound sound; + public bool show_previews; + + [Flags] public enum Flags : uint + { + has_messages_notify_from = 0x1, + has_stories_notify_from = 0x2, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7cfad11..ede2879 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1330,6 +1330,26 @@ namespace TL channel = channel, }); + /// See + public static Task Account_ToggleSponsoredMessages(this Client client, bool enabled) + => client.Invoke(new Account_ToggleSponsoredMessages + { + enabled = enabled, + }); + + /// See + public static Task Account_GetReactionsNotifySettings(this Client client) + => client.Invoke(new Account_GetReactionsNotifySettings + { + }); + + /// See + public static Task Account_SetReactionsNotifySettings(this Client client, ReactionsNotifySettings settings) + => client.Invoke(new Account_SetReactionsNotifySettings + { + settings = settings, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -2226,10 +2246,10 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null) + public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null, bool broadcasts_only = false) => client.Invoke(new Messages_SearchGlobal { - flags = (Messages_SearchGlobal.Flags)(folder_id != null ? 0x1 : 0), + flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0)), folder_id = folder_id.GetValueOrDefault(), q = q, filter = filter, @@ -3478,11 +3498,13 @@ namespace TL /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details) /// Group where to apply changes /// Allowed reaction emojis - public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions) + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null) => client.Invoke(new Messages_SetChatAvailableReactions { + flags = (Messages_SetChatAvailableReactions.Flags)(reactions_limit != null ? 0x1 : 0), peer = peer, available_reactions = available_reactions, + reactions_limit = reactions_limit.GetValueOrDefault(), }); /// Obtain available message reactions » See @@ -5150,9 +5172,10 @@ namespace TL /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) /// The method will return channels related to the passed channel. - public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel) + public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations { + flags = (Channels_GetChannelRecommendations.Flags)(channel != null ? 0x1 : 0), channel = channel, }); @@ -6567,6 +6590,14 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_TogglePinnedToTop(this Client client, InputPeer peer, params int[] id) + => client.Invoke(new Stories_TogglePinnedToTop + { + peer = peer, + id = id, + }); + /// Obtains info about the boosts that were applied to a certain channel (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel » /// The channel @@ -7742,6 +7773,21 @@ namespace TL.Methods public InputChannelBase channel; } + [TLDef(0xB9D9A38D)] + public sealed partial class Account_ToggleSponsoredMessages : IMethod + { + public bool enabled; + } + + [TLDef(0x06DD654C)] + public sealed partial class Account_GetReactionsNotifySettings : IMethod { } + + [TLDef(0x316CE548)] + public sealed partial class Account_SetReactionsNotifySettings : IMethod + { + public ReactionsNotifySettings settings; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -8502,6 +8548,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { has_folder_id = 0x1, + broadcasts_only = 0x2, } } @@ -9590,11 +9637,18 @@ namespace TL.Methods } } - [TLDef(0xFEB16771)] + [TLDef(0x5A150BD4)] public sealed partial class Messages_SetChatAvailableReactions : IMethod { + public Flags flags; public InputPeer peer; public ChatReactions available_reactions; + [IfFlag(0)] public int reactions_limit; + + [Flags] public enum Flags : uint + { + has_reactions_limit = 0x1, + } } [TLDef(0x18DEA0AC)] @@ -10930,10 +10984,16 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x83B70D97)] + [TLDef(0x25A71742)] public sealed partial class Channels_GetChannelRecommendations : IMethod { - public InputChannelBase channel; + public Flags flags; + [IfFlag(0)] public InputChannelBase channel; + + [Flags] public enum Flags : uint + { + has_channel = 0x1, + } } [TLDef(0xF0D3E6A8)] @@ -12107,6 +12167,13 @@ namespace TL.Methods } } + [TLDef(0x0B297E9B)] + public sealed partial class Stories_TogglePinnedToTop : IMethod + { + public InputPeer peer; + public int[] id; + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 41d7da0..6be7feb 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -2,7 +2,7 @@ namespace TL { - #pragma warning disable IDE1006 + #pragma warning disable IDE1006, CS1574 /// Object describes the contents of an encrypted message. See public abstract partial class DecryptedMessageBase : IObject { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 0e6ea71..9fd09ad 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 = 177; // fetched 03/04/2024 02:27:33 + public const int Version = 178; // fetched 24/04/2024 15:26:10 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -136,8 +136,8 @@ namespace TL [0x6592A1A7] = typeof(ChatForbidden), [0x0AADFC8F] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), - [0xC9D31138] = typeof(ChatFull), - [0x44C054A7] = typeof(ChannelFull), + [0x2633421B] = typeof(ChatFull), + [0xBBAB348D] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -405,6 +405,7 @@ namespace TL [0x9DDB347C] = typeof(UpdateBotNewBusinessMessage), [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), + [0x1824E40B] = typeof(UpdateNewStoryReaction), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -956,6 +957,7 @@ namespace TL [0xFA58B6D4] = typeof(ThemeSettings), [0x54B56617] = typeof(WebPageAttributeTheme), [0x2E94C3E7] = typeof(WebPageAttributeStory), + [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1024,7 +1026,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xED5383F7] = typeof(SponsoredMessage), + [0xBDEDF566] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1143,14 +1145,13 @@ namespace TL [0xB6CC2D5C] = typeof(MessagePeerVote), [0x74CDA504] = typeof(MessagePeerVoteInputOption), [0x4628F6E6] = typeof(MessagePeerVoteMultiple), - [0x3DB8EC63] = typeof(SponsoredWebPage), [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), [0x79B26A24] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), - [0x5DD8C3C8] = typeof(Stories_Stories), + [0x63C3DD0A] = typeof(Stories_Stories), [0xB0BDEAC5] = typeof(StoryView), [0x9083670B] = typeof(StoryViewPublicForward), [0xBD74CF49] = typeof(StoryViewPublicRepost), @@ -1262,6 +1263,7 @@ namespace TL [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), + [0x56E34970] = typeof(ReactionsNotifySettings), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d41f79d..ba86e32 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: 177 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 178 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient From 3c19be32c761988486ee1535d93975d2841d1662 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 Apr 2024 12:34:32 +0200 Subject: [PATCH 203/336] New method LoginWithQRCode (fix #247) --- .github/dev.yml | 2 +- .github/release.yml | 2 +- src/Client.cs | 116 +++++++++++++++++++++++++++++++++++--------- 3 files changed, 95 insertions(+), 25 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 611e374..b418590 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.0.1-dev.$(Rev:r) +name: 4.1.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 4c8040d..f079d8e 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 4.0.$(Rev:r) +name: 4.1.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index c620140..6572d5c 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1203,19 +1203,7 @@ namespace WTelegram } catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") { - for (int pwdRetry = 1; authorization == null; pwdRetry++) - try - { - var accountPassword = await this.Account_GetPassword(); - RaiseUpdates(accountPassword); - var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); - authorization = await this.Auth_CheckPassword(checkPasswordSRP); - } - catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID") - { - Helpers.Log(4, "Wrong password!"); - if (pwdRetry >= MaxCodePwdAttempts) throw; - } + authorization = await LoginPasswordNeeded(); } } @@ -1248,6 +1236,83 @@ namespace WTelegram return User; } + /// Login via QR code + /// Callback to display the login url as QR code to the user (QRCoder library can help you) + /// (optional) To prevent logging as these user ids + /// If session is already connected to a user, this method will first log out.
You can also check property before calling this method. + /// If you need to abort the method before login is completed + /// Detail about the logged-in user + public async Task LoginWithQRCode(Action qrDisplay, long[] except_ids = null, bool logoutFirst = true, CancellationToken ct = default) + { + await ConnectAsync(); + if (logoutFirst && _session.UserId != 0) // a user is already logged-in + { + await this.Auth_LogOut(); + _session.UserId = _dcSession.UserId = 0; + User = null; + } + var tcs = new TaskCompletionSource(); + OnUpdates += CatchQRUpdate; + try + { + while (!ct.IsCancellationRequested) + { + var ltb = await this.Auth_ExportLoginToken(_session.ApiId, _apiHash ??= Config("api_hash"), except_ids); + retry: + switch (ltb) + { + case Auth_LoginToken lt: + var url = "tg://login?token=" + System.Convert.ToBase64String(lt.token).Replace('/', '_').Replace('+', '-'); + Helpers.Log(3, $"Waiting for this QR code login to be accepted: " + url); + qrDisplay(url); + if (lt.expires - DateTime.UtcNow is { Ticks: >= 0 } delay) + await Task.WhenAny(Task.Delay(delay, ct), tcs.Task); + break; + case Auth_LoginTokenMigrateTo ltmt: + await MigrateToDC(ltmt.dc_id); + ltb = await this.Auth_ImportLoginToken(ltmt.token); + goto retry; + case Auth_LoginTokenSuccess lts: + return LoginAlreadyDone(lts.authorization); + } + } + ct.ThrowIfCancellationRequested(); + return null; + } + catch (RpcException e) when (e.Code == 401 && e.Message == "SESSION_PASSWORD_NEEDED") + { + return LoginAlreadyDone(await LoginPasswordNeeded()); + } + finally + { + OnUpdates -= CatchQRUpdate; + } + + Task CatchQRUpdate(UpdatesBase updates) + { + if (updates.UpdateList.OfType().Any()) + tcs.TrySetResult(true); + return Task.CompletedTask; + } + } + + private async Task LoginPasswordNeeded() + { + for (int pwdRetry = 1; ; pwdRetry++) + try + { + var accountPassword = await this.Account_GetPassword(); + RaiseUpdates(accountPassword); + var checkPasswordSRP = await Check2FA(accountPassword, () => ConfigAsync("password")); + return await this.Auth_CheckPassword(checkPasswordSRP); + } + catch (RpcException pe) when (pe.Code == 400 && pe.Message == "PASSWORD_HASH_INVALID") + { + Helpers.Log(4, "Wrong password!"); + if (pwdRetry >= MaxCodePwdAttempts) throw; + } + } + /// [Not recommended] You can use this if you have already obtained a login authorization manually /// if this was not a successful Auth_Authorization, an exception is thrown /// the User that was authorized @@ -1418,16 +1483,7 @@ namespace WTelegram { if (message != "FILE_MIGRATE_X") { - // this is a hack to migrate _dcSession in-place (staying in same Client): - Session.DCSession dcSession; - lock (_session) - dcSession = GetOrCreateDCSession(x, _dcSession.DataCenter.flags); - Reset(false, false); - _session.MainDC = x; - _dcSession.Client = null; - _dcSession = dcSession; - _dcSession.Client = this; - await ConnectAsync(); + await MigrateToDC(x); goto retry; } } @@ -1459,6 +1515,20 @@ namespace WTelegram } } + private async Task MigrateToDC(int dcId) + { + // this is a hack to migrate _dcSession in-place (staying in same Client): + Session.DCSession dcSession; + lock (_session) + dcSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags); + Reset(false, false); + _session.MainDC = dcId; + _dcSession.Client = null; + _dcSession = dcSession; + _dcSession.Client = this; + await ConnectAsync(); + } + public async Task InvokeAffected(IMethod query, long peerId) where T : Messages_AffectedMessages { var result = await Invoke(query); From 3a7c5a0957d8c1829a4ff9f449e2f310246f6753 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 27 Apr 2024 13:22:05 +0200 Subject: [PATCH 204/336] API Layer 179: poll texts with entities, new SentCodeTypes --- README.md | 2 +- src/TL.Schema.cs | 32 ++++++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 17 +++++++++++++++++ src/TL.Table.cs | 8 +++++--- src/WTelegramClient.csproj | 2 +- 5 files changed, 52 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index ce4f127..a96d7a3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-178-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-179-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index ca1da89..14444f9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8965,6 +8965,30 @@ namespace TL has_receipt = 0x2, } } + /// See + [TLDef(0xA416AC81)] + public sealed partial class Auth_SentCodeTypeSmsWord : Auth_SentCodeType + { + public Flags flags; + [IfFlag(0)] public string beginning; + + [Flags] public enum Flags : uint + { + has_beginning = 0x1, + } + } + /// See + [TLDef(0xB37794AF)] + public sealed partial class Auth_SentCodeTypeSmsPhrase : Auth_SentCodeType + { + public Flags flags; + [IfFlag(0)] public string beginning; + + [Flags] public enum Flags : uint + { + has_beginning = 0x1, + } + } /// Callback answer sent by the bot in response to a button press See [TLDef(0x36585EA4)] @@ -12371,17 +12395,17 @@ namespace TL } /// A possible answer of a poll See - [TLDef(0x6CA9C2E9)] + [TLDef(0xFF16E2CA)] public sealed partial class PollAnswer : IObject { /// Textual representation of the answer - public string text; + public TextWithEntities text; /// The param that has to be passed to Messages_SendVote. public byte[] option; } /// Poll See - [TLDef(0x86E18161)] + [TLDef(0x58747131)] public sealed partial class Poll : IObject { /// ID of the poll @@ -12389,7 +12413,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The question of the poll - public string question; + public TextWithEntities question; /// The possible answers, vote using Messages_SendVote. public PollAnswer[] answers; /// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ede2879..72fcf64 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -333,6 +333,15 @@ namespace TL phone_code_hash = phone_code_hash, }); + /// See + public static Task Auth_ReportMissingCode(this Client client, string phone_number, string phone_code_hash, string mnc) + => client.Invoke(new Auth_ReportMissingCode + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + mnc = mnc, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -6952,6 +6961,14 @@ namespace TL.Methods public string phone_code_hash; } + [TLDef(0xCB9DEFF6)] + public sealed partial class Auth_ReportMissingCode : IMethod + { + public string phone_number; + public string phone_code_hash; + public string mnc; + } + [TLDef(0xEC86017A)] public sealed partial class Account_RegisterDevice : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9fd09ad..01842c9 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 = 178; // fetched 24/04/2024 15:26:10 + public const int Version = 179; // fetched 27/04/2024 11:14:23 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -650,6 +650,8 @@ namespace TL [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), [0xE57B1432] = typeof(Auth_SentCodeTypeFirebaseSms), + [0xA416AC81] = typeof(Auth_SentCodeTypeSmsWord), + [0xB37794AF] = typeof(Auth_SentCodeTypeSmsPhrase), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), [0x26B5DDE6] = typeof(Messages_MessageEditData), [0x890C3D89] = typeof(InputBotInlineMessageID), @@ -909,8 +911,8 @@ namespace TL [0x8C05F1C9] = typeof(Help_SupportName), [0xF3AE2EED] = null,//Help_UserInfoEmpty [0x01EB3758] = typeof(Help_UserInfo), - [0x6CA9C2E9] = typeof(PollAnswer), - [0x86E18161] = typeof(Poll), + [0xFF16E2CA] = typeof(PollAnswer), + [0x58747131] = typeof(Poll), [0x3B6DDAD2] = typeof(PollAnswerVoters), [0x7ADF2420] = typeof(PollResults), [0xF041E250] = typeof(ChatOnlines), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ba86e32..d3f7664 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: 178 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 179 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://github.com/wiz0u/WTelegramClient From 4422aad6bef9a77b54344f815f793f0af8604b1e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 28 Apr 2024 00:44:36 +0200 Subject: [PATCH 205/336] Catch/Log sessionStore.Write exceptions (fix #248) --- src/Session.cs | 13 ++++++++++--- src/WTelegramClient.csproj | 2 +- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/src/Session.cs b/src/Session.cs index ed184e2..86a0fec 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -149,9 +149,16 @@ namespace WTelegram if (!_encryptor.CanReuseTransform) // under Mono, AES encryptor is not reusable using (var aes = Aes.Create()) _encryptor = aes.CreateEncryptor(_reuseKey, _encrypted[0..16]); - _store.Position = 0; - _store.Write(_encrypted, 0, encryptedLen); - _store.SetLength(encryptedLen); + try + { + _store.Position = 0; + _store.Write(_encrypted, 0, encryptedLen); + _store.SetLength(encryptedLen); + } + catch (Exception ex) + { + Helpers.Log(4, $"{_store} raised {ex}"); + } } _jsonStream.Position = 0; _jsonWriter.Reset(); diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d3f7664..e2acf39 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -24,7 +24,7 @@ Telegram;MTProto;Client;Api;UserBot README.md $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - 0419;1573;1591;NETSDK1138 + NETSDK1138;CS0419;CS1573;CS1591 TRACE;OBFUSCATION;MTPG From 7d388e6e75eca148f66ab1135bbe6a510bac35b2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 1 May 2024 11:13:28 +0200 Subject: [PATCH 206/336] API Layer 179 (changed): emoji categories --- .github/dev.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 47 +++++++++++++++++++++++++++++++++++++------ src/TL.SchemaFuncs.cs | 14 +++++++++++++ src/TL.Table.cs | 7 +++++-- 5 files changed, 62 insertions(+), 10 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b418590..f2ef2db 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.1-dev.$(Rev:r) +name: 4.1.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index a96d7a3..f452bc6 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![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://www.buymeacoffee.com/wizou) -## _Telegram Client API library written 100% in C# and .NET_ +## *_Telegram Client API library written 100% in C# and .NET_* This library allows you to connect to Telegram and control a user programmatically (or a bot, but [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 14444f9..5c2a947 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -15620,9 +15620,17 @@ namespace TL public long[] document_id; } + /// Represents an emoji category. See Derived classes: + public abstract partial class EmojiGroupBase : IObject + { + /// Category name, i.e. "Animals", "Flags", "Faces" and so on... + public virtual string Title => default; + /// A single custom emoji used as preview for the category. + public virtual long IconEmojiId => default; + } /// Represents an emoji category. See [TLDef(0x7A9ABDA9)] - public sealed partial class EmojiGroup : IObject + public partial class EmojiGroup : EmojiGroupBase { /// Category name, i.e. "Animals", "Flags", "Faces" and so on... public string title; @@ -15630,6 +15638,26 @@ namespace TL public long icon_emoji_id; /// A list of UTF-8 emojis, matching the category. public string[] emoticons; + + /// Category name, i.e. "Animals", "Flags", "Faces" and so on... + public override string Title => title; + /// A single custom emoji used as preview for the category. + public override long IconEmojiId => icon_emoji_id; + } + /// See + [TLDef(0x80D26CC7)] + public sealed partial class EmojiGroupGreeting : EmojiGroup + { + } + /// See + [TLDef(0x093BCF34)] + public sealed partial class EmojiGroupPremium : EmojiGroupBase + { + public string title; + public long icon_emoji_id; + + public override string Title => title; + public override long IconEmojiId => icon_emoji_id; } /// Represents a list of emoji categories. See @@ -15640,7 +15668,7 @@ namespace TL /// Hash for pagination, for more info click here public int hash; /// A list of emoji categories. - public EmojiGroup[] groups; + public EmojiGroupBase[] groups; } /// Styled text with message entities See @@ -17771,14 +17799,12 @@ namespace TL public sealed partial class Channels_SponsoredMessageReportResultReported : Channels_SponsoredMessageReportResult { } /// See - [TLDef(0xD07B4BAD)] + [TLDef(0x5407E297)] public sealed partial class Stats_BroadcastRevenueStats : IObject { public StatsGraphBase top_hours_graph; public StatsGraphBase revenue_graph; - public long current_balance; - public long available_balance; - public long overall_revenue; + public BroadcastRevenueBalances balances; public double usd_rate; } @@ -17859,4 +17885,13 @@ namespace TL has_stories_notify_from = 0x2, } } + + /// See + [TLDef(0x8438F1C6)] + public sealed partial class BroadcastRevenueBalances : IObject + { + public long current_balance; + public long available_balance; + public long overall_revenue; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 72fcf64..d872175 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4136,6 +4136,14 @@ namespace TL limit = limit, }); + /// See + /// a null value means messages.emojiGroupsNotModified + public static Task Messages_GetEmojiStickerGroups(this Client client, int hash = default) + => client.Invoke(new Messages_GetEmojiStickerGroups + { + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -10202,6 +10210,12 @@ namespace TL.Methods public int limit; } + [TLDef(0x1DD840F5)] + public sealed partial class Messages_GetEmojiStickerGroups : IMethod + { + public int hash; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 01842c9..84b9dee 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 = 179; // fetched 27/04/2024 11:14:23 + public const int Version = 179; // fetched 01/05/2024 09:06:44 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1119,6 +1119,8 @@ namespace TL [0x481EADFA] = null,//EmojiListNotModified [0x7A1E11D1] = typeof(EmojiList), [0x7A9ABDA9] = typeof(EmojiGroup), + [0x80D26CC7] = typeof(EmojiGroupGreeting), + [0x093BCF34] = typeof(EmojiGroupPremium), [0x6FB4AD87] = null,//Messages_EmojiGroupsNotModified [0x881FB94B] = typeof(Messages_EmojiGroups), [0x751F3146] = typeof(TextWithEntities), @@ -1259,13 +1261,14 @@ namespace TL [0x846F9E42] = typeof(Channels_SponsoredMessageReportResultChooseOption), [0x3E3BCF2F] = typeof(Channels_SponsoredMessageReportResultAdsHidden), [0xAD798849] = typeof(Channels_SponsoredMessageReportResultReported), - [0xD07B4BAD] = typeof(Stats_BroadcastRevenueStats), + [0x5407E297] = typeof(Stats_BroadcastRevenueStats), [0xEC659737] = typeof(Stats_BroadcastRevenueWithdrawalUrl), [0x557E2CC4] = typeof(BroadcastRevenueTransactionProceeds), [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), [0x56E34970] = typeof(ReactionsNotifySettings), + [0x8438F1C6] = typeof(BroadcastRevenueBalances), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x91CC4674] = typeof(Layer73.DecryptedMessage), From 37b8f6c0541eee459a2a741d95a7a5508d07ede8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 7 May 2024 15:24:28 +0200 Subject: [PATCH 207/336] API Layer 179.3: UpdateBroadcastRevenueTransactions --- README.md | 2 +- src/TL.Schema.cs | 6 ++++++ src/TL.Table.cs | 3 ++- 3 files changed, 9 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index f452bc6..2daaede 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,7 @@ ## *_Telegram Client API library written 100% in C# and .NET_* -This library allows you to connect to Telegram and control a user programmatically (or a bot, but [Telegram.Bot](https://github.com/TelegramBots/Telegram.Bot) is much easier for that). +This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5c2a947..5f4c554 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -5301,6 +5301,12 @@ namespace TL public Peer peer; public Reaction reaction; } + /// See + [TLDef(0x5C65D358)] + public sealed partial class UpdateBroadcastRevenueTransactions : Update + { + public BroadcastRevenueBalances balances; + } /// Updates state. See [TLDef(0xA56C2A3E)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 84b9dee..16bbb22 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 = 179; // fetched 01/05/2024 09:06:44 + public const int Version = 179; // fetched 07/05/2024 13:21:04 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -406,6 +406,7 @@ namespace TL [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), + [0x5C65D358] = typeof(UpdateBroadcastRevenueTransactions), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), From c8a0882587f072730b568ad9551e65d089de05c2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 28 May 2024 00:37:58 +0200 Subject: [PATCH 208/336] Fix: ReactorError wasn't always triggered correctly on connection lost --- src/Client.Helpers.cs | 2 +- src/Client.cs | 4 ++-- src/WTelegramClient.csproj | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 3870a2f..0303d72 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -620,7 +620,7 @@ namespace WTelegram chats = (await this.Messages_GetChats(chat.chat_id)).chats }; case InputPeerChannel channel: return await this.Channels_EditAdmin(channel, user, - new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x8BF : 0 }, null); + new ChatAdminRights { flags = is_admin ? (ChatAdminRights.Flags)0x1E8BF : 0 }, null); default: throw new ArgumentException(OnlyChatChannel); } diff --git a/src/Client.cs b/src/Client.cs index 6572d5c..763c977 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -366,7 +366,7 @@ namespace WTelegram lock (_pendingRpcs) // abort all pending requests { foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetException(ex); + rpc.tcs.TrySetException(ex); _pendingRpcs.Clear(); _bareRpc = null; } @@ -879,9 +879,9 @@ namespace WTelegram if (defaultDc != 0) _dcSession ??= _session.DCSessions.GetValueOrDefault(defaultDc); _dcSession ??= new() { Id = Helpers.RandomLong() }; _dcSession.Client = this; + _dcSession.DataCenter = null; Helpers.Log(2, $"Connecting to {endpoint}..."); tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); - _dcSession.DataCenter = null; } } } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index e2acf39..f4dedc4 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -16,7 +16,7 @@ Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 179 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT - https://github.com/wiz0u/WTelegramClient + https://wiz0u.github.io/WTelegramClient logo.png true https://github.com/wiz0u/WTelegramClient.git From c1a18a63c006ac588e172430188f82a5fd4e0215 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 28 May 2024 17:15:39 +0200 Subject: [PATCH 209/336] API Layer 181: Fact check, Message effects, Payment stars... --- README.md | 2 +- src/TL.Schema.cs | 321 +++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 254 ++++++++++++++++++++++++++--- src/TL.Secret.cs | 6 +- src/TL.Table.cs | 32 +++- src/WTelegramClient.csproj | 2 +- 6 files changed, 581 insertions(+), 36 deletions(-) diff --git a/README.md b/README.md index 2daaede..e624246 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-179-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-181-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 5f4c554..f860984 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -364,7 +364,7 @@ namespace TL public InputGame id; } /// Generated invoice of a bot payment See - [TLDef(0x8EB5A6D5)] + [TLDef(0x405FEF0D)] public sealed partial class InputMediaInvoice : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -380,7 +380,7 @@ namespace TL /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes. public byte[] payload; /// Payments provider token, obtained via Botfather - public string provider; + [IfFlag(3)] public string provider; /// JSON-encoded data about the invoice, which will be shared with the payment provider. A detailed description of required fields should be provided by the payment provider. public DataJSON provider_data; /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. @@ -396,6 +396,8 @@ namespace TL has_start_param = 0x2, /// Field has a value has_extended_media = 0x4, + /// Field has a value + has_provider = 0x8, } } /// Live geolocation See @@ -1682,7 +1684,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x2357BF25)] + [TLDef(0x94345242)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1733,6 +1735,8 @@ namespace TL /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; [IfFlag(30)] public int quick_reply_shortcut_id; + [IfFlag(34)] public long effect; + [IfFlag(35)] public FactCheck factcheck; [Flags] public enum Flags : uint { @@ -1801,6 +1805,10 @@ namespace TL /// Field has a value has_via_business_bot_id = 0x1, offline = 0x2, + /// Field has a value + has_effect = 0x4, + /// Field has a value + has_factcheck = 0x8, } /// ID of the message @@ -5302,11 +5310,18 @@ namespace TL public Reaction reaction; } /// See - [TLDef(0x5C65D358)] + [TLDef(0xDFD961F5)] public sealed partial class UpdateBroadcastRevenueTransactions : Update { + public Peer peer; public BroadcastRevenueBalances balances; } + /// See + [TLDef(0x0FB85198)] + public sealed partial class UpdateStarsBalance : Update + { + public long balance; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7730,8 +7745,16 @@ namespace TL public long document_id; } /// Message entity representing a block quote. See - [TLDef(0x020DF5D0)] - public sealed partial class MessageEntityBlockquote : MessageEntity { } + [TLDef(0xF1CCAAAC)] + public sealed partial class MessageEntityBlockquote : MessageEntity + { + public Flags flags; + + [Flags] public enum Flags : uint + { + collapsed = 0x1, + } + } /// Represents a channel See Derived classes: , /// a value means inputChannelEmpty @@ -8951,13 +8974,14 @@ namespace TL public string url; } /// An authentication code should be delivered via SMS after Firebase attestation, as described in the auth documentation ». See - [TLDef(0xE57B1432)] + [TLDef(0x13C90F17)] public sealed partial class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; + [IfFlag(2)] public byte[] play_integrity_nonce; /// On iOS, must be compared with the receipt extracted from the received push notification. [IfFlag(1)] public string receipt; /// On iOS: if a push notification with the ios_push_secret isn't received within push_timeout seconds, the next_type authentication method must be used, with Auth_ResendCode. @@ -8969,6 +8993,8 @@ namespace TL has_nonce = 0x1, /// Fields and have a value has_receipt = 0x2, + /// Field has a value + has_play_integrity_nonce = 0x4, } } /// See @@ -10166,9 +10192,27 @@ namespace TL public byte[] bytes; } + /// Payment form See Derived classes: + public abstract partial class Payments_PaymentFormBase : IObject + { + /// Form ID + public virtual long FormId => default; + /// Bot ID + public virtual long BotId => default; + /// Form title + public virtual string Title => default; + /// Description + public virtual string Description => default; + /// Product photo + public virtual WebDocumentBase Photo => default; + /// Invoice + public virtual Invoice Invoice => default; + /// Users + public virtual Dictionary Users => default; + } /// Payment form See [TLDef(0xA0058751)] - public sealed partial class Payments_PaymentForm : IObject + public sealed partial class Payments_PaymentForm : Payments_PaymentFormBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10218,6 +10262,47 @@ namespace TL /// Field has a value has_additional_methods = 0x40, } + + /// Form ID + public override long FormId => form_id; + /// Bot ID + public override long BotId => bot_id; + /// Form title + public override string Title => title; + /// Description + public override string Description => description; + /// Product photo + public override WebDocumentBase Photo => photo; + /// Invoice + public override Invoice Invoice => invoice; + /// Users + public override Dictionary Users => users; + } + /// See + [TLDef(0x7BF6B15C)] + public sealed partial class Payments_PaymentFormStars : Payments_PaymentFormBase + { + public Flags flags; + public long form_id; + public long bot_id; + public string title; + public string description; + [IfFlag(5)] public WebDocumentBase photo; + public Invoice invoice; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_photo = 0x20, + } + + public override long FormId => form_id; + public override long BotId => bot_id; + public override string Title => title; + public override string Description => description; + public override WebDocumentBase Photo => photo; + public override Invoice Invoice => invoice; + public override Dictionary Users => users; } /// Validated user-provided info See @@ -10257,9 +10342,31 @@ namespace TL public string url; } + /// Payment receipt See Derived classes: + public abstract partial class Payments_PaymentReceiptBase : IObject + { + /// Date of generation + public virtual DateTime Date => default; + /// Bot ID + public virtual long BotId => default; + /// Title + public virtual string Title => default; + /// Description + public virtual string Description => default; + /// Photo + public virtual WebDocumentBase Photo => default; + /// Invoice + public virtual Invoice Invoice => default; + /// Three-letter ISO 4217 currency code + public virtual string Currency => default; + /// Total amount 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 virtual long TotalAmount => default; + /// Users + public virtual Dictionary Users => default; + } /// Receipt See [TLDef(0x70C4FE03)] - public sealed partial class Payments_PaymentReceipt : IObject + public sealed partial class Payments_PaymentReceipt : Payments_PaymentReceiptBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -10303,6 +10410,56 @@ namespace TL /// Field has a value has_tip_amount = 0x8, } + + /// Date of generation + public override DateTime Date => date; + /// Bot ID + public override long BotId => bot_id; + /// Title + public override string Title => title; + /// Description + public override string Description => description; + /// Photo + public override WebDocumentBase Photo => photo; + /// Invoice + public override Invoice Invoice => invoice; + /// Three-letter ISO 4217 currency code + public override string Currency => currency; + /// Total amount 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 override long TotalAmount => total_amount; + /// Users + public override Dictionary Users => users; + } + /// See + [TLDef(0xDABBF83A)] + public sealed partial class Payments_PaymentReceiptStars : Payments_PaymentReceiptBase + { + public Flags flags; + public DateTime date; + public long bot_id; + public string title; + public string description; + [IfFlag(2)] public WebDocumentBase photo; + public Invoice invoice; + public string currency; + public long total_amount; + public string transaction_id; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_photo = 0x4, + } + + public override DateTime Date => date; + public override long BotId => bot_id; + public override string Title => title; + public override string Description => description; + public override WebDocumentBase Photo => photo; + public override Invoice Invoice => invoice; + public override string Currency => currency; + public override long TotalAmount => total_amount; + public override Dictionary Users => users; } /// Saved server-side order information See @@ -14998,6 +15155,12 @@ namespace TL /// Should be populated with one of the giveaway options returned by Payments_GetPremiumGiftCodeOptions, see the giveaways » documentation for more info. public PremiumGiftCodeOption option; } + /// See + [TLDef(0x1DA33AD8)] + public sealed partial class InputInvoiceStars : InputInvoice + { + public StarsTopupOption option; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -15135,6 +15298,19 @@ namespace TL has_prize_description = 0x10, } } + /// See + [TLDef(0x4F0EE8DF)] + public sealed partial class InputStorePaymentStars : InputStorePaymentPurpose + { + public Flags flags; + public long stars; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + } + } /// Telegram Premium gift option See [TLDef(0x74C34319)] @@ -17900,4 +18076,131 @@ namespace TL public long available_balance; public long overall_revenue; } + + /// See + [TLDef(0x93C3E27E)] + public sealed partial class AvailableEffect : IObject + { + public Flags flags; + public long id; + public string emoticon; + [IfFlag(0)] public long static_icon_id; + public long effect_sticker_id; + [IfFlag(1)] public long effect_animation_id; + + [Flags] public enum Flags : uint + { + has_static_icon_id = 0x1, + has_effect_animation_id = 0x2, + premium_required = 0x4, + } + } + + /// See + /// a value means messages.availableEffectsNotModified + [TLDef(0xBDDB616E)] + public sealed partial class Messages_AvailableEffects : IObject + { + public int hash; + public AvailableEffect[] effects; + public DocumentBase[] documents; + } + + /// See + [TLDef(0xB89BFCCF)] + public sealed partial class FactCheck : IObject + { + public Flags flags; + [IfFlag(1)] public string country; + [IfFlag(1)] public TextWithEntities text; + public long hash; + + [Flags] public enum Flags : uint + { + need_check = 0x1, + has_country = 0x2, + } + } + + /// See + public abstract partial class StarsTransactionPeerBase : IObject { } + /// See + [TLDef(0x95F2BFE4)] + public sealed partial class StarsTransactionPeerUnsupported : StarsTransactionPeerBase { } + /// See + [TLDef(0xB457B375)] + public sealed partial class StarsTransactionPeerAppStore : StarsTransactionPeerBase { } + /// See + [TLDef(0x7B560A0B)] + public sealed partial class StarsTransactionPeerPlayMarket : StarsTransactionPeerBase { } + /// See + [TLDef(0x250DBAF8)] + public sealed partial class StarsTransactionPeerPremiumBot : StarsTransactionPeerBase { } + /// See + [TLDef(0xE92FD902)] + public sealed partial class StarsTransactionPeerFragment : StarsTransactionPeerBase { } + /// See + [TLDef(0xD80DA15D)] + public sealed partial class StarsTransactionPeer : StarsTransactionPeerBase + { + public Peer peer; + } + + /// See + [TLDef(0x0BD915C0)] + public sealed partial class StarsTopupOption : IObject + { + public Flags flags; + public long stars; + [IfFlag(0)] public string store_product; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + extended = 0x2, + } + } + + /// See + [TLDef(0xCC7079B2)] + public sealed partial class StarsTransaction : IObject + { + public Flags flags; + public string id; + public long stars; + public DateTime date; + public StarsTransactionPeerBase peer; + [IfFlag(0)] public string title; + [IfFlag(1)] public string description; + [IfFlag(2)] public WebDocumentBase photo; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_description = 0x2, + has_photo = 0x4, + refund = 0x8, + } + } + + /// See + [TLDef(0x8CF4EE60)] + public sealed partial class Payments_StarsStatus : IObject, IPeerResolver + { + public Flags flags; + public long balance; + public StarsTransaction[] history; + [IfFlag(0)] public string next_offset; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + /// 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 d872175..0f9c38c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -100,6 +100,24 @@ namespace TL query = query, }); + /// See + public static Task InvokeWithGooglePlayIntegrity(this Client client, string nonce, string token, IMethod query) + => client.Invoke(new InvokeWithGooglePlayIntegrity + { + nonce = nonce, + token = token, + query = query, + }); + + /// See + public static Task InvokeWithApnsSecret(this Client client, string nonce, string secret, IMethod query) + => client.Invoke(new InvokeWithApnsSecret + { + nonce = nonce, + secret = secret, + query = query, + }); + /// Send the verification code for login See Possible codes: 400,406,500 (details) /// Phone number in international format /// Application identifier (see App configuration) @@ -234,11 +252,13 @@ namespace TL /// The phone number /// The phone code hash obtained from Auth_SendCode [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] - public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash) + public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash, string reason = null) => client.Invoke(new Auth_ResendCode { + flags = (Auth_ResendCode.Flags)(reason != null ? 0x1 : 0), phone_number = phone_number, phone_code_hash = phone_code_hash, + reason = reason, }); /// Cancel the login verification code See Possible codes: 400,406 (details) @@ -313,13 +333,14 @@ namespace TL /// Phone code hash returned by Auth_SendCode /// On Android, a JWS object obtained as described in the auth documentation » /// Secret token received via an apple push notification - public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null) + public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null, string play_integrity_token = null) => client.Invoke(new Auth_RequestFirebaseSms { - flags = (Auth_RequestFirebaseSms.Flags)((safety_net_token != null ? 0x1 : 0) | (ios_push_secret != null ? 0x2 : 0)), + flags = (Auth_RequestFirebaseSms.Flags)((safety_net_token != null ? 0x1 : 0) | (ios_push_secret != null ? 0x2 : 0) | (play_integrity_token != null ? 0x4 : 0)), phone_number = phone_number, phone_code_hash = phone_code_hash, safety_net_token = safety_net_token, + play_integrity_token = play_integrity_token, ios_push_secret = ios_push_secret, }); @@ -1797,10 +1818,10 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1810,6 +1831,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + effect = effect.GetValueOrDefault(), }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1828,10 +1850,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1842,6 +1864,7 @@ namespace TL schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + effect = effect.GetValueOrDefault(), }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -2802,16 +2825,17 @@ namespace TL /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, reply_to = reply_to, multi_media = multi_media, schedule_date = schedule_date.GetValueOrDefault(), send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + effect = effect.GetValueOrDefault(), }); /// Upload encrypted file and associate it to a secret chat See @@ -4144,6 +4168,39 @@ namespace TL hash = hash, }); + /// See + /// a null value means messages.availableEffectsNotModified + public static Task Messages_GetAvailableEffects(this Client client, int hash = default) + => client.Invoke(new Messages_GetAvailableEffects + { + hash = hash, + }); + + /// See + public static Task Messages_EditFactCheck(this Client client, InputPeer peer, int msg_id, TextWithEntities text) + => client.Invoke(new Messages_EditFactCheck + { + peer = peer, + msg_id = msg_id, + text = text, + }); + + /// See + public static Task Messages_DeleteFactCheck(this Client client, InputPeer peer, int msg_id) + => client.Invoke(new Messages_DeleteFactCheck + { + peer = peer, + msg_id = msg_id, + }); + + /// See + public static Task Messages_GetFactCheck(this Client client, InputPeer peer, params int[] msg_id) + => client.Invoke(new Messages_GetFactCheck + { + peer = peer, + msg_id = msg_id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5239,6 +5296,17 @@ namespace TL restricted = restricted, }); + /// See + public static Task Channels_SearchPosts(this Client client, string hashtag, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) + => client.Invoke(new Channels_SearchPosts + { + hashtag = hashtag, + offset_rate = offset_rate, + offset_peer = offset_peer, + offset_id = offset_id, + limit = limit, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5407,7 +5475,7 @@ namespace TL /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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, InputInvoice invoice, 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), @@ -5418,7 +5486,7 @@ namespace TL /// Get payment receipt See Possible codes: 400 (details) /// The peer where the payment receipt was sent /// Message ID of receipt - public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) + public static Task Payments_GetPaymentReceipt(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Payments_GetPaymentReceipt { peer = peer, @@ -5562,6 +5630,45 @@ namespace TL purpose = purpose, }); + /// See + public static Task Payments_GetStarsTopupOptions(this Client client) + => client.Invoke(new Payments_GetStarsTopupOptions + { + }); + + /// See + public static Task Payments_GetStarsStatus(this Client client, InputPeer peer) + => client.Invoke(new Payments_GetStarsStatus + { + peer = peer, + }); + + /// See + public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, bool inbound = false, bool outbound = false) + => client.Invoke(new Payments_GetStarsTransactions + { + flags = (Payments_GetStarsTransactions.Flags)((inbound ? 0x1 : 0) | (outbound ? 0x2 : 0)), + peer = peer, + offset = offset, + }); + + /// See + public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) + => client.Invoke(new Payments_SendStarsForm + { + flags = 0, + form_id = form_id, + invoice = invoice, + }); + + /// See + public static Task Payments_RefundStarsCharge(this Client client, InputUserBase user_id, string charge_id) + => client.Invoke(new Payments_RefundStarsCharge + { + user_id = user_id, + charge_id = charge_id, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -6793,6 +6900,22 @@ namespace TL.Methods public IMethod query; } + [TLDef(0x1DF92984)] + public sealed partial class InvokeWithGooglePlayIntegrity : IMethod + { + public string nonce; + public string token; + public IMethod query; + } + + [TLDef(0x0DAE54F8)] + public sealed partial class InvokeWithApnsSecret : IMethod + { + public string nonce; + public string secret; + public IMethod query; + } + [TLDef(0xA677244F)] public sealed partial class Auth_SendCode : IMethod { @@ -6892,11 +7015,18 @@ namespace TL.Methods } } - [TLDef(0x3EF1A9BF)] + [TLDef(0xCAE47523)] public sealed partial class Auth_ResendCode : IMethod { + public Flags flags; public string phone_number; public string phone_code_hash; + [IfFlag(0)] public string reason; + + [Flags] public enum Flags : uint + { + has_reason = 0x1, + } } [TLDef(0x1F040578)] @@ -6946,19 +7076,21 @@ namespace TL.Methods public string web_auth_token; } - [TLDef(0x89464B50)] + [TLDef(0x8E39261E)] public sealed partial class Auth_RequestFirebaseSms : IMethod { public Flags flags; public string phone_number; public string phone_code_hash; [IfFlag(0)] public string safety_net_token; + [IfFlag(2)] public string play_integrity_token; [IfFlag(1)] public string ios_push_secret; [Flags] public enum Flags : uint { has_safety_net_token = 0x1, has_ios_push_secret = 0x2, + has_play_integrity_token = 0x4, } } @@ -8170,7 +8302,7 @@ namespace TL.Methods } } - [TLDef(0xDFF8042C)] + [TLDef(0x983F9745)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -8183,6 +8315,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(18)] public long effect; [Flags] public enum Flags : uint { @@ -8199,10 +8332,11 @@ namespace TL.Methods update_stickersets_order = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, + has_effect = 0x40000, } } - [TLDef(0x7BD66041)] + [TLDef(0x7852834E)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -8216,6 +8350,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(18)] public long effect; [Flags] public enum Flags : uint { @@ -8231,6 +8366,7 @@ namespace TL.Methods update_stickersets_order = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, + has_effect = 0x40000, } } @@ -9060,7 +9196,7 @@ namespace TL.Methods public long hash; } - [TLDef(0x0C964709)] + [TLDef(0x37B74355)] public sealed partial class Messages_SendMultiMedia : IMethod { public Flags flags; @@ -9070,6 +9206,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(18)] public long effect; [Flags] public enum Flags : uint { @@ -9083,6 +9220,7 @@ namespace TL.Methods update_stickersets_order = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, + has_effect = 0x40000, } } @@ -10216,6 +10354,34 @@ namespace TL.Methods public int hash; } + [TLDef(0xDEA20A39)] + public sealed partial class Messages_GetAvailableEffects : IMethod + { + public int hash; + } + + [TLDef(0x0589EE75)] + public sealed partial class Messages_EditFactCheck : IMethod + { + public InputPeer peer; + public int msg_id; + public TextWithEntities text; + } + + [TLDef(0xD1DA940C)] + public sealed partial class Messages_DeleteFactCheck : IMethod + { + public InputPeer peer; + public int msg_id; + } + + [TLDef(0xB9CDC5EE)] + public sealed partial class Messages_GetFactCheck : IMethod + { + public InputPeer peer; + public int[] msg_id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -11063,6 +11229,16 @@ namespace TL.Methods public bool restricted; } + [TLDef(0xD19F987B)] + public sealed partial class Channels_SearchPosts : IMethod + { + public string hashtag; + public int offset_rate; + public InputPeer offset_peer; + public int offset_id; + public int limit; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -11192,7 +11368,7 @@ namespace TL.Methods } [TLDef(0x37148DBB)] - public sealed partial class Payments_GetPaymentForm : IMethod + public sealed partial class Payments_GetPaymentForm : IMethod { public Flags flags; public InputInvoice invoice; @@ -11205,7 +11381,7 @@ namespace TL.Methods } [TLDef(0x2478D1CC)] - public sealed partial class Payments_GetPaymentReceipt : IMethod + public sealed partial class Payments_GetPaymentReceipt : IMethod { public InputPeer peer; public int msg_id; @@ -11329,6 +11505,48 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } + [TLDef(0xC00EC7D3)] + public sealed partial class Payments_GetStarsTopupOptions : IMethod { } + + [TLDef(0x104FCFA7)] + public sealed partial class Payments_GetStarsStatus : IMethod + { + public InputPeer peer; + } + + [TLDef(0x673AC2F9)] + public sealed partial class Payments_GetStarsTransactions : IMethod + { + public Flags flags; + public InputPeer peer; + public string offset; + + [Flags] public enum Flags : uint + { + inbound = 0x1, + outbound = 0x2, + } + } + + [TLDef(0x02BB731D)] + public sealed partial class Payments_SendStarsForm : IMethod + { + public Flags flags; + public long form_id; + public InputInvoice invoice; + + [Flags] public enum Flags : uint + { + } + } + + [TLDef(0x25AE8F4A)] + public sealed partial class Payments_RefundStarsCharge : IMethod + { + public InputUserBase user_id; + public string charge_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 6be7feb..c9c475b 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -825,7 +825,11 @@ namespace TL } namespace Layer101 - { } + { + /// Message entity representing a block quote. See + [TLDef(0x020DF5D0)] + public sealed partial class MessageEntityBlockquote : MessageEntity { } + } namespace Layer143 { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 16bbb22..7974bd5 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 = 179; // fetched 07/05/2024 13:21:04 + public const int Version = 181; // fetched 28/05/2024 13:03:09 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -95,7 +95,7 @@ namespace TL [0xE5BBFE1A] = typeof(InputMediaPhotoExternal), [0xFB52DC99] = typeof(InputMediaDocumentExternal), [0xD33F43F3] = typeof(InputMediaGame), - [0x8EB5A6D5] = typeof(InputMediaInvoice), + [0x405FEF0D] = typeof(InputMediaInvoice), [0x971FA843] = typeof(InputMediaGeoLive), [0x0F94E5F1] = typeof(InputMediaPoll), [0xE66FBF7B] = typeof(InputMediaDice), @@ -146,7 +146,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x2357BF25] = typeof(Message), + [0x94345242] = typeof(Message), [0x2B085862] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -406,7 +406,8 @@ namespace TL [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), - [0x5C65D358] = typeof(UpdateBroadcastRevenueTransactions), + [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), + [0x0FB85198] = typeof(UpdateStarsBalance), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -587,7 +588,7 @@ namespace TL [0x761E6AF4] = typeof(MessageEntityBankCard), [0x32CA960F] = typeof(MessageEntitySpoiler), [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), - [0x020DF5D0] = typeof(MessageEntityBlockquote), + [0xF1CCAAAC] = typeof(MessageEntityBlockquote), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -650,7 +651,7 @@ namespace TL [0xF450F59B] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), - [0xE57B1432] = typeof(Auth_SentCodeTypeFirebaseSms), + [0x13C90F17] = typeof(Auth_SentCodeTypeFirebaseSms), [0xA416AC81] = typeof(Auth_SentCodeTypeSmsWord), [0xB37794AF] = typeof(Auth_SentCodeTypeSmsPhrase), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), @@ -745,10 +746,12 @@ namespace TL [0xF46FE924] = typeof(InputWebFileAudioAlbumThumbLocation), [0x21E753BC] = typeof(Upload_WebFile), [0xA0058751] = typeof(Payments_PaymentForm), + [0x7BF6B15C] = typeof(Payments_PaymentFormStars), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), [0x70C4FE03] = typeof(Payments_PaymentReceipt), + [0xDABBF83A] = typeof(Payments_PaymentReceiptStars), [0xFB8FE43C] = typeof(Payments_SavedInfo), [0xC10EB2CF] = typeof(InputPaymentCredentialsSaved), [0x3417D728] = typeof(InputPaymentCredentials), @@ -1073,6 +1076,7 @@ namespace TL [0xC5B56859] = typeof(InputInvoiceMessage), [0xC326CAEF] = typeof(InputInvoiceSlug), [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), + [0x1DA33AD8] = typeof(InputInvoiceStars), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1080,6 +1084,7 @@ namespace TL [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0xA3805F3F] = typeof(InputStorePaymentPremiumGiftCode), [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), + [0x4F0EE8DF] = typeof(InputStorePaymentStars), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty @@ -1270,8 +1275,22 @@ namespace TL [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), [0x56E34970] = typeof(ReactionsNotifySettings), [0x8438F1C6] = typeof(BroadcastRevenueBalances), + [0x93C3E27E] = typeof(AvailableEffect), + [0xD1ED9A5B] = null,//Messages_AvailableEffectsNotModified + [0xBDDB616E] = typeof(Messages_AvailableEffects), + [0xB89BFCCF] = typeof(FactCheck), + [0x95F2BFE4] = typeof(StarsTransactionPeerUnsupported), + [0xB457B375] = typeof(StarsTransactionPeerAppStore), + [0x7B560A0B] = typeof(StarsTransactionPeerPlayMarket), + [0x250DBAF8] = typeof(StarsTransactionPeerPremiumBot), + [0xE92FD902] = typeof(StarsTransactionPeerFragment), + [0xD80DA15D] = typeof(StarsTransactionPeer), + [0x0BD915C0] = typeof(StarsTopupOption), + [0xCC7079B2] = typeof(StarsTransaction), + [0x8CF4EE60] = typeof(Payments_StarsStatus), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), + [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), [0x91CC4674] = typeof(Layer73.DecryptedMessage), [0x0EF02CE6] = typeof(Layer66.DocumentAttributeVideo), [0xBB718624] = typeof(Layer66.SendMessageUploadRoundAction), @@ -1396,6 +1415,7 @@ namespace TL [typeof(Messages_SavedReactionTags)] = 0x889B59EF, //messages.savedReactionTagsNotModified [typeof(Help_TimezonesList)] = 0x970708CC, //help.timezonesListNotModified [typeof(Messages_QuickReplies)] = 0x5F91EB5B, //messages.quickRepliesNotModified + [typeof(Messages_AvailableEffects)] = 0xD1ED9A5B, //messages.availableEffectsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index f4dedc4..50f849e 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: 179 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 181 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://wiz0u.github.io/WTelegramClient From 865c841bd61760052856cd69176f13023bc6be91 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 4 Jun 2024 19:04:22 +0200 Subject: [PATCH 210/336] Html/Markdown: fix-up potential ENTITY_BOUNDS_INVALID --- src/Services.cs | 13 +++++++++++++ src/TL.Schema.cs | 16 +++++++++++++--- 2 files changed, 26 insertions(+), 3 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 0be43f1..e051ffe 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -234,6 +234,7 @@ namespace TL } if (lastBlockQuote is { length: -1 }) lastBlockQuote.length = sb.Length - lastBlockQuote.offset; + HtmlText.FixUps(sb, entities); text = sb.ToString(); return entities.Count == 0 ? null : [.. entities]; } @@ -431,10 +432,22 @@ namespace TL else offset++; } + FixUps(sb, entities); text = sb.ToString(); return entities.Count == 0 ? null : [.. entities]; } + internal static void FixUps(StringBuilder sb, List entities) + { + int truncate = 0; + while (char.IsWhiteSpace(sb[^++truncate])); + if (truncate == 1) return; + var len = sb.Length -= --truncate; + foreach (var entity in entities) + if (entity.offset + entity.length > len) + entity.length = len - entity.offset; + } + /// Converts the (plain text + entities) format used by Telegram messages into an HTML-formatted text /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf /// The plain text, typically obtained from diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index f860984..1e447dc 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -4079,15 +4079,25 @@ namespace TL public Messages_StickerSet stickerset; } /// The order of stickersets was changed See - [TLDef(0x0BB2D201, inheritBefore = true)] - public sealed partial class UpdateStickerSetsOrder : UpdateStickerSets + [TLDef(0x0BB2D201)] + public sealed partial class UpdateStickerSetsOrder : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; /// New sticker order by sticker ID public long[] order; + + [Flags] public enum Flags : uint + { + /// Whether the updated stickers are mask stickers + masks = 0x1, + /// Whether the updated stickers are custom emoji stickers + emojis = 0x2, + } } /// Installed stickersets have changed, the client should refetch them as described in the docs. See [TLDef(0x31C24808)] - public partial class UpdateStickerSets : Update + public sealed partial class UpdateStickerSets : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; From 85cc404213368757e4be52bc4f00e8c03b7c0d8f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Jun 2024 02:35:38 +0200 Subject: [PATCH 211/336] Prevent recursive issue when client is disposed in OnOther --- FAQ.md | 2 +- src/Client.cs | 9 +++++---- src/WTelegramClient.csproj | 7 +++++-- 3 files changed, 11 insertions(+), 7 deletions(-) diff --git a/FAQ.md b/FAQ.md index 6e58d2f..c6d398d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -59,7 +59,7 @@ You also need to obtain their `access_hash` which is specific to the resource yo This serves as a proof that the logged-in user is entitled to access that channel/user/photo/document/... (otherwise, anybody with the ID could access it) -> A small private `Chat` don't need an access_hash and can be queried using their `chat_id` only. +> A small private group `Chat` don't need an access_hash and can be queried using their `chat_id` only. However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. diff --git a/src/Client.cs b/src/Client.cs index 763c977..89589af 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -181,7 +181,7 @@ namespace WTelegram { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); Reset(false, IsMainDC); - var ex = new TaskCanceledException("WTelegram.Client was disposed"); + var ex = new ObjectDisposedException("WTelegram.Client was disposed"); lock (_pendingRpcs) // abort all pending requests foreach (var rpc in _pendingRpcs.Values) rpc.tcs.TrySetException(ex); @@ -349,7 +349,7 @@ namespace WTelegram lock (_pendingRpcs) // retry all pending requests { foreach (var rpc in _pendingRpcs.Values) - rpc.tcs.SetResult(reactorError); // this leads to a retry (see Invoke method) + rpc.tcs.TrySetResult(reactorError); // this leads to a retry (see Invoke method) _pendingRpcs.Clear(); _bareRpc = null; } @@ -359,7 +359,7 @@ namespace WTelegram RaiseUpdates(updatesState); } } - catch + catch (Exception e) when (e is not ObjectDisposedException) { if (IsMainDC) RaiseUpdates(reactorError); @@ -947,7 +947,8 @@ namespace WTelegram } finally { - lock (_session) _session.Save(); + if (_reactorTask != null) // client not disposed + lock (_session) _session.Save(); } Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0x18E00U}"); } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 50f849e..cde7178 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,7 +13,10 @@ WTelegramClient 0.0.0 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 181 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 181 + +Release Notes: +$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) Copyright © Olivier Marcoux 2021-2024 MIT https://wiz0u.github.io/WTelegramClient @@ -48,7 +51,7 @@ - + From 1a00ae5a7779cc7de53365ca670bf831c4a78400 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Jun 2024 17:35:25 +0200 Subject: [PATCH 212/336] TL deserialization errors no longer cause a ReactorError. Renewing session on layer change to prevent old layer messages --- Examples/Program_ReactorError.cs | 2 +- src/Client.cs | 33 ++++++++++++++++++++------------ 2 files changed, 22 insertions(+), 13 deletions(-) diff --git a/Examples/Program_ReactorError.cs b/Examples/Program_ReactorError.cs index 370da34..83c2d6f 100644 --- a/Examples/Program_ReactorError.cs +++ b/Examples/Program_ReactorError.cs @@ -50,7 +50,7 @@ namespace WTelegramClientTest await CreateAndConnect(); break; } - catch (Exception ex) + catch (Exception ex) when (ex is not ObjectDisposedException) { Console.WriteLine("Connection still failing: " + ex.Message); } diff --git a/src/Client.cs b/src/Client.cs index 89589af..bf4ee87 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -465,21 +465,29 @@ namespace WTelegram Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.ServerTicksOffset):c}"); return null; } - if (ctorNb == Layer.MsgContainerCtor) + try { - Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"MsgContainer",-40} {msgStamp:u} (svc)"); - return ReadMsgContainer(reader); + if (ctorNb == Layer.MsgContainerCtor) + { + Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"MsgContainer",-40} {msgStamp:u} (svc)"); + return ReadMsgContainer(reader); + } + else if (ctorNb == Layer.RpcResultCtor) + { + Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"RpcResult",-40} {msgStamp:u}"); + return ReadRpcResult(reader); + } + else + { + var obj = reader.ReadTLObject(ctorNb); + Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {msgStamp:u} {((seqno & 1) != 0 ? "" : "(svc)")} {((msgId & 2) == 0 ? "" : "NAR")}"); + return obj; + } } - else if (ctorNb == Layer.RpcResultCtor) + catch (Exception ex) { - Helpers.Log(1, $"{_dcSession.DcID}>Receiving {"RpcResult",-40} {msgStamp:u}"); - return ReadRpcResult(reader); - } - else - { - var obj = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $"{_dcSession.DcID}>Receiving {obj.GetType().Name,-40} {msgStamp:u} {((seqno & 1) != 0 ? "" : "(svc)")} {((msgId & 2) == 0 ? "" : "NAR")}"); - return obj; + Helpers.Log(4, $"While deserializing frame #{ctorNb:x}: " + ex.ToString()); + return null; } } @@ -916,6 +924,7 @@ namespace WTelegram TLConfig = new Config { this_dc = _session.MainDC, dc_options = _session.DcOptions }; else { + if (_dcSession.Layer != 0 && _dcSession.Layer != Layer.Version) _dcSession.Renew(); var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonDocument.Parse(Config("init_params")).RootElement); TLConfig = await this.InvokeWithLayer(Layer.Version, new TL.Methods.InitConnection From aa75b20820d7ef47b17beb3b2b1c1fdab6dc5c34 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 2 Jul 2024 00:59:25 +0200 Subject: [PATCH 213/336] Fix some yml --- .github/dev.yml | 7 +------ .github/release.yml | 5 +---- .github/workflows/telegram-api.yml | 13 +++++++++---- 3 files changed, 11 insertions(+), 14 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index f2ef2db..a7c79d4 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -54,11 +54,6 @@ stages: { "status": "success", "complete": true, - "message": "{ - \"commitId\": \"$(Build.SourceVersion)\", - \"buildNumber\": \"$(Build.BuildNumber)\", - \"teamProjectName\": \"$(System.TeamProject)\", - \"commitMessage\": \"$(Release_Notes)\" - }" + "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\", \"commitMessage\": \"$(Release_Notes)\" }" } waitForCompletion: 'false' diff --git a/.github/release.yml b/.github/release.yml index f079d8e..fdc5f49 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -62,10 +62,7 @@ stages: { "status": "success", "complete": true, - "message": "{ - \"commitId\": \"$(Build.SourceVersion)\", - \"buildNumber\": \"$(Build.BuildNumber)\", - \"teamProjectName\": \"$(System.TeamProject)\" + "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\" }" } waitForCompletion: 'false' diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index b2e6a52..9a69fd9 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -16,8 +16,13 @@ jobs: with: support-label: 'telegram api' issue-comment: > - Please note that **Github Issues** should be used only for problems with the library code itself. - - For questions about Telegram API usage, you can search the [API official documentation](https://core.telegram.org/api#getting-started) - or [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. + Please note that **Github issues** should be used only for problems with the library code itself. + + + For questions about Telegram API usage, you can search the [API official documentation](https://core.telegram.org/api#getting-started) and the [full list of methods](https://core.telegram.org/methods). + + WTelegramClient covers 100% of the API and let you do anything you can do in an official client. + + + If the above links didn't answer your problem, [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. close-issue: true From b9299810b8e4d9a29a59f9d60a054c5669171c84 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 2 Jul 2024 01:18:09 +0200 Subject: [PATCH 214/336] API Layer 183: Paid media, more stories areas, Payment stars status methods... --- README.md | 2 +- src/TL.Schema.cs | 477 ++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 380 +++++++++++++++++++---------- src/TL.Table.cs | 32 ++- src/WTelegramClient.csproj | 2 +- 5 files changed, 670 insertions(+), 223 deletions(-) diff --git a/README.md b/README.md index e624246..3e0b5b2 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-181-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-183-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 1e447dc..829557a 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -485,6 +485,13 @@ namespace TL optional = 0x4, } } + /// See + [TLDef(0xAA661FC3)] + public sealed partial class InputMediaPaidMedia : InputMedia + { + public long stars_amount; + public InputMedia[] extended_media; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -917,6 +924,7 @@ namespace TL [TLDef(0x7B197DC8)] public sealed partial class UserStatusRecently : UserStatus { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -928,6 +936,7 @@ namespace TL [TLDef(0x541A1D1A)] public sealed partial class UserStatusLastWeek : UserStatus { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -939,6 +948,7 @@ namespace TL [TLDef(0x65899777)] public sealed partial class UserStatusLastMonth : UserStatus { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -1412,8 +1422,10 @@ namespace TL [IfFlag(36)] public PeerStories stories; /// Wallpaper [IfFlag(39)] public WallPaperBase wallpaper; + /// The number of boosts the current user has applied to the current supergroup. [IfFlag(40)] public int boosts_applied; [IfFlag(41)] public int boosts_unrestrict; + /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; [Flags] public enum Flags : uint @@ -1510,6 +1522,7 @@ namespace TL can_view_revenue = 0x1000, /// Field has a value has_reactions_limit = 0x2000, + paid_media_allowed = 0x4000, } /// ID of the channel @@ -1694,6 +1707,7 @@ namespace TL public int id; /// ID of the sender of the message [IfFlag(8)] public Peer from_id; + /// Supergroups only, contains the number of boosts this user has given the current supergroup, and should be shown in the UI in the header of the message.
Only present for incoming messages from non-anonymous supergroup members that have boosted the supergroup.
Note that this counter should be locally overridden for non-anonymous outgoing messages, according to the current value of .boosts_applied, to ensure the value is correct even for messages sent by the current user before a supergroup was boosted (or after a boost has expired or the number of boosts has changed); do not update this value for incoming messages from other users, even if their boosts have changed.
[IfFlag(29)] public int from_boosts_applied; /// Peer ID, the chat where this message was sent public Peer peer_id; @@ -2144,7 +2158,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// ID of the channel that was automatically boosted by the winners of the giveaway for duration of the Premium subscription. + /// ID of the channel/supergroup that was automatically boosted by the winners of the giveaway for duration of the Premium subscription. public long channel_id; /// Number of other channels that participated in the giveaway. [IfFlag(3)] public int additional_peers_count; @@ -2175,8 +2189,15 @@ namespace TL has_additional_peers_count = 0x8, } } + /// See + [TLDef(0xA8852491)] + public sealed partial class MessageMediaPaidMedia : MessageMedia + { + public long stars_amount; + public MessageExtendedMediaBase[] extended_media; + } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2588,7 +2609,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Identifier of the channel that created the gift code either directly or through a giveaway: if we import this giftcode link, we will also automatically boost this channel. + /// Identifier of the channel/supergroup that created the gift code either directly or through a giveaway: if we import this giftcode link, we will also automatically boost this channel/supergroup. [IfFlag(1)] public Peer boost_peer; /// Duration in months of the gifted Telegram Premium subscription. public int months; @@ -2605,7 +2626,7 @@ namespace TL [Flags] public enum Flags : uint { - /// If set, this gift code was received from a giveaway » started by a channel we're subscribed to. + /// If set, this gift code was received from a giveaway » started by a channel/supergroup we're subscribed to. via_giveaway = 0x1, /// Field has a value has_boost_peer = 0x2, @@ -3245,6 +3266,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; /// User ID public long id; @@ -3347,7 +3369,9 @@ namespace TL blocked_my_stories_from = 0x8000000, /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, + /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
contact_require_premium = 0x20000000, + /// If set, we cannot fetch the exact read date of messages we send to this user using Messages_GetOutboxReadDate.
The exact read date of messages might still be unavailable for other reasons, see here » for more info.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.hide_read_marks flag.
read_dates_private = 0x40000000, } @@ -3686,7 +3710,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -5012,7 +5036,7 @@ namespace TL } } /// Extended media update See - [TLDef(0x5A73A98C)] + [TLDef(0xD5A41724)] public sealed partial class UpdateMessageExtendedMedia : Update { /// Peer @@ -5020,7 +5044,7 @@ namespace TL /// Message ID public int msg_id; /// Extended media - public MessageExtendedMediaBase extended_media; + public MessageExtendedMediaBase[] extended_media; } /// A forum topic » was pinned or unpinned. See [TLDef(0x192EFBE3)] @@ -5111,7 +5135,7 @@ namespace TL /// The reaction that was sent public Reaction reaction; } - /// A channel boost has changed (bots only) See + /// A channel/supergroup boost has changed (bots only) See [TLDef(0x904DD49C)] public sealed partial class UpdateBotChatBoost : Update { @@ -5270,6 +5294,7 @@ namespace TL [TLDef(0x9DDB347C)] public sealed partial class UpdateBotNewBusinessMessage : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string connection_id; public MessageBase message; @@ -5278,6 +5303,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_reply_to_message = 0x1, } @@ -5287,6 +5313,7 @@ namespace TL [TLDef(0x07DF587C)] public sealed partial class UpdateBotEditBusinessMessage : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string connection_id; public MessageBase message; @@ -5295,6 +5322,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_reply_to_message = 0x1, } @@ -5332,6 +5360,32 @@ namespace TL { public long balance; } + /// See + [TLDef(0x1EA2FDA7)] + public sealed partial class UpdateBusinessBotCallbackQuery : Update + { + public Flags flags; + public long query_id; + public long user_id; + public string connection_id; + public MessageBase message; + [IfFlag(2)] public MessageBase reply_to_message; + public long chat_instance; + [IfFlag(0)] public byte[] data; + + [Flags] public enum Flags : uint + { + has_data = 0x1, + has_reply_to_message = 0x4, + } + } + /// See + [TLDef(0xA584B019)] + public sealed partial class UpdateStarsRevenueStatus : Update + { + public Peer peer; + public StarsRevenueStatus status; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6450,7 +6504,7 @@ namespace TL /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum InputPrivacyKey : uint { - ///Whether people will be able to see your exact last online timestamp + ///Whether people will be able to see our exact last online timestamp.

Note that if we decide to hide our exact last online timestamp to someone and we do not have a
Premium subscription, we won't be able to see the exact last online timestamp of any user, including those that do share it with us.
StatusTimestamp = 0x4F96CB18, ///Whether people will be able to invite you to chats ChatInvite = 0xBDFB0426, @@ -6477,7 +6531,7 @@ namespace TL /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum PrivacyKey : uint { - ///Whether we can see the last online timestamp of this user + ///Whether we can see the last online timestamp of this user.

Note that if we decide to hide our exact last online timestamp to someone and we do not have a
Premium subscription, we won't be able to see the exact last online timestamp of any user, including those that do share it with us.
StatusTimestamp = 0xBC2EAB30, ///Whether the user can be invited to chats ChatInvite = 0x500E6DFA, @@ -6501,7 +6555,7 @@ namespace TL Birthday = 0x2000A518, } - /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , + /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , public abstract partial class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] @@ -6550,7 +6604,7 @@ namespace TL [TLDef(0x77CDC9F1)] public sealed partial class InputPrivacyValueAllowPremium : InputPrivacyRule { } - /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , + /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , , public abstract partial class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -7310,7 +7364,7 @@ namespace TL has_thumb_document_id = 0x100, /// Whether the color of this TGS custom emoji stickerset should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. text_color = 0x200, - /// If set, this custom emoji stickerset can be used in channel emoji statuses. + /// If set, this custom emoji stickerset can be used in channel/supergroup emoji statuses. channel_emoji_status = 0x400, creator = 0x800, } @@ -7377,7 +7431,7 @@ namespace TL } } - /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , + /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , , public abstract partial class KeyboardButtonBase : IObject { /// Button text @@ -7575,6 +7629,7 @@ namespace TL [TLDef(0xC9662D05)] public sealed partial class InputKeyboardButtonRequestPeer : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string text; public int button_id; @@ -7758,6 +7813,7 @@ namespace TL [TLDef(0xF1CCAAAC)] public sealed partial class MessageEntityBlockquote : MessageEntity { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -8897,7 +8953,7 @@ namespace TL FragmentSms = 0x06ED998C, } - /// Type of the verification code that was sent See Derived classes: , , , , , , , , + /// Type of the verification code that was sent See Derived classes: , , , , , , , , , , public abstract partial class Auth_SentCodeType : IObject { } /// The code was sent through the telegram app See [TLDef(0x3DBB5986)] @@ -8984,13 +9040,14 @@ namespace TL public string url; } /// An authentication code should be delivered via SMS after Firebase attestation, as described in the auth documentation ». See - [TLDef(0x13C90F17)] + [TLDef(0x009FD736)] public sealed partial class Auth_SentCodeTypeFirebaseSms : Auth_SentCodeTypeSms { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; + [IfFlag(2)] public long play_integrity_project_id; [IfFlag(2)] public byte[] play_integrity_nonce; /// On iOS, must be compared with the receipt extracted from the received push notification. [IfFlag(1)] public string receipt; @@ -9003,19 +9060,21 @@ namespace TL has_nonce = 0x1, /// Fields and have a value has_receipt = 0x2, - /// Field has a value - has_play_integrity_nonce = 0x4, + /// Fields and have a value + has_play_integrity_project_id = 0x4, } } /// See [TLDef(0xA416AC81)] public sealed partial class Auth_SentCodeTypeSmsWord : Auth_SentCodeType { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint { + /// Field has a value has_beginning = 0x1, } } @@ -9023,11 +9082,13 @@ namespace TL [TLDef(0xB37794AF)] public sealed partial class Auth_SentCodeTypeSmsPhrase : Auth_SentCodeType { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint { + /// Field has a value has_beginning = 0x1, } } @@ -9226,7 +9287,7 @@ namespace TL } } /// Represents a message draft. See - [TLDef(0x3FCCF7EF)] + [TLDef(0x2D65321F)] public sealed partial class DraftMessage : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9241,6 +9302,7 @@ namespace TL [IfFlag(5)] public InputMedia media; /// Date of last update of the draft. public DateTime date; + [IfFlag(7)] public long effect; [Flags] public enum Flags : uint { @@ -9254,6 +9316,8 @@ namespace TL has_media = 0x20, /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. invert_media = 0x40, + /// Field has a value + has_effect = 0x80, } } @@ -10202,7 +10266,7 @@ namespace TL public byte[] bytes; } - /// Payment form See Derived classes: + /// Payment form See Derived classes: , public abstract partial class Payments_PaymentFormBase : IObject { /// Form ID @@ -10292,6 +10356,7 @@ namespace TL [TLDef(0x7BF6B15C)] public sealed partial class Payments_PaymentFormStars : Payments_PaymentFormBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long form_id; public long bot_id; @@ -10303,6 +10368,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_photo = 0x20, } @@ -10352,7 +10418,7 @@ namespace TL public string url; } - /// Payment receipt See Derived classes: + /// Payment receipt See Derived classes: , public abstract partial class Payments_PaymentReceiptBase : IObject { /// Date of generation @@ -10444,6 +10510,7 @@ namespace TL [TLDef(0xDABBF83A)] public sealed partial class Payments_PaymentReceiptStars : Payments_PaymentReceiptBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DateTime date; public long bot_id; @@ -10458,6 +10525,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_photo = 0x4, } @@ -11082,7 +11150,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -13329,7 +13397,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , + /// Webpage attributes See Derived classes: , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -13373,6 +13441,7 @@ namespace TL [TLDef(0x50CC03D3)] public sealed partial class WebPageAttributeStickerSet : WebPageAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DocumentBase[] stickers; @@ -13435,7 +13504,7 @@ namespace TL { /// Folder ID public virtual int ID => default; - /// Folder name + /// Folder name (max 12 UTF-8 chars) public virtual string Title => default; /// Emoji to use as icon for the folder. public virtual string Emoticon => default; @@ -13453,7 +13522,7 @@ namespace TL public Flags flags; /// Folder ID public int id; - /// Folder name + /// Folder name (max 12 UTF-8 chars) public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; @@ -13491,7 +13560,7 @@ namespace TL /// Folder ID public override int ID => id; - /// Folder name + /// Folder name (max 12 UTF-8 chars) public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; @@ -13509,7 +13578,7 @@ namespace TL public Flags flags; /// ID of the folder public int id; - /// Name of the folder + /// Name of the folder (max 12 UTF-8 chars) public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; @@ -13531,7 +13600,7 @@ namespace TL /// ID of the folder public override int ID => id; - /// Name of the folder + /// Name of the folder (max 12 UTF-8 chars) public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; @@ -13844,7 +13913,9 @@ namespace TL keep_archived_unmuted = 0x2, /// Whether unmuted chats that are always included or pinned in a folder, will be kept in the Archive chat list when they get a new message. Ignored if keep_archived_unmuted is set. keep_archived_folders = 0x4, + /// If set, (only) users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of one of their messages.
The .read_dates_private flag will be set for users that have this flag enabled.
hide_read_marks = 0x8, + /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
Premium users only, non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
new_noncontact_peers_require_premium = 0x10, } } @@ -15027,23 +15098,21 @@ namespace TL /// Contains the webview URL with appropriate theme and user info parameters added See Derived classes: public abstract partial class WebViewResult : IObject { } /// Contains the webview URL with appropriate theme and user info parameters added See - [TLDef(0x0C14557C)] + [TLDef(0x4D22FF98)] public sealed partial class WebViewResultUrl : WebViewResult { + public Flags flags; /// Webview session ID - public long query_id; + [IfFlag(0)] public long query_id; /// Webview URL to open public string url; - } - /// Contains the webview URL with appropriate theme parameters added See Derived classes: - public abstract partial class SimpleWebViewResult : IObject { } - /// Contains the webview URL with appropriate theme parameters added See - [TLDef(0x882F76BB)] - public sealed partial class SimpleWebViewResultUrl : SimpleWebViewResult - { - /// URL - public string url; + [Flags] public enum Flags : uint + { + /// Field has a value + has_query_id = 0x1, + fullsize = 0x2, + } } /// Info about a sent inline webview message See @@ -15138,7 +15207,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , + /// An invoice See Derived classes: , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message. See [TLDef(0xC5B56859)] @@ -15156,7 +15225,7 @@ namespace TL /// The invoice slug public string slug; } - /// Used if the user wishes to start a channel giveaway or send some giftcodes to members of a channel, in exchange for boosts. See + /// Used if the user wishes to start a channel/supergroup giveaway or send some giftcodes to members of a channel/supergroup, in exchange for boosts. See [TLDef(0x98986C0D)] public sealed partial class InputInvoicePremiumGiftCode : InputInvoice { @@ -15222,7 +15291,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , , , + /// Info about a Telegram Premium purchase See Derived classes: , , , , public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -15250,7 +15319,7 @@ namespace TL /// 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 amount; } - /// Used to gift Telegram Premium subscriptions only to some specific subscribers of a channel or to some of our contacts, see here » for more info on giveaways and gifts. See + /// Used to gift Telegram Premium subscriptions only to some specific subscribers of a channel/supergroup or to some of our contacts, see here » for more info on giveaways and gifts. See [TLDef(0xA3805F3F)] public sealed partial class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose { @@ -15258,7 +15327,7 @@ namespace TL public Flags flags; /// The users that will receive the Telegram Premium subscriptions. public InputUserBase[] users; - /// If set, the gifts will be sent on behalf of a channel we are an admin of, which will also assign some boosts to it. Otherwise, the gift will be sent directly from the currently logged in users, and we will gain some extra boost slots. See here » for more info on giveaways and gifts. + /// If set, the gifts will be sent on behalf of a channel/supergroup we are an admin of, which will also assign some boosts to it. Otherwise, the gift will be sent directly from the currently logged in user, and we will gain some extra boost slots. See here » for more info on giveaways and gifts. [IfFlag(0)] public InputPeer boost_peer; /// Three-letter ISO 4217 currency code public string currency; @@ -15277,7 +15346,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The channel starting the giveaway, that the user must join to participate, that will receive the giveaway boosts; see here » for more info on giveaways. + /// The channel/supergroup starting the giveaway, that the user must join to participate, that will receive the giveaway boosts; see here » for more info on giveaways. public InputPeer boost_peer; /// Additional channels that the user must join to participate to the giveaway can be specified here. [IfFlag(1)] public InputPeer[] additional_peers; @@ -15312,6 +15381,7 @@ namespace TL [TLDef(0x4F0EE8DF)] public sealed partial class InputStorePaymentStars : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; public string currency; @@ -15812,7 +15882,7 @@ namespace TL public long[] document_id; } - /// Represents an emoji category. See Derived classes: + /// Represents an emoji category. See Derived classes: , , public abstract partial class EmojiGroupBase : IObject { /// Category name, i.e. "Animals", "Flags", "Faces" and so on... @@ -16016,16 +16086,6 @@ namespace TL } } - /// Contains the link that must be used to open a direct link Mini App. See Derived classes: - public abstract partial class AppWebViewResult : IObject { } - /// Contains the link that must be used to open a direct link Mini App. See - [TLDef(0x3C1B4F0D)] - public sealed partial class AppWebViewResultUrl : AppWebViewResult - { - /// The URL to open - public string url; - } - /// Specifies an inline mode mini app button, shown on top of the inline query results list. See [TLDef(0xB57295D5)] public sealed partial class InlineBotWebView : IObject @@ -16431,6 +16491,7 @@ namespace TL [TLDef(0x63C3DD0A)] public sealed partial class Stories_Stories : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Total number of stories that can be fetched public int count; @@ -16628,9 +16689,10 @@ namespace TL } /// Coordinates and size of a clicable rectangular area on top of a story. See - [TLDef(0x03D1EA4E)] + [TLDef(0xCFC9E002)] public sealed partial class MediaAreaCoordinates : IObject { + public Flags flags; /// The abscissa of the rectangle's center, as a percentage of the media width (0-100). public double x; /// The ordinate of the rectangle's center, as a percentage of the media height (0-100). @@ -16641,6 +16703,13 @@ namespace TL public double h; /// Clockwise rotation angle of the rectangle, in degrees (0-360). public double rotation; + [IfFlag(0)] public double radius; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_radius = 0x1, + } } /// Represents a story media area » See Derived classes: , , , , , @@ -16676,13 +16745,21 @@ namespace TL public string result_id; } /// Represents a geolocation tag attached to a story. See - [TLDef(0xDF8B3B22)] + [TLDef(0xCAD5452D)] public sealed partial class MediaAreaGeoPoint : MediaArea { + public Flags flags; /// The size and position of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; /// Coordinates of the geolocation tag. public GeoPoint geo; + [IfFlag(0)] public GeoPointAddress address; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_address = 0x1, + } } /// Represents a reaction bubble. See [TLDef(0x14455871)] @@ -16725,6 +16802,13 @@ namespace TL /// ID of the channel message public int msg_id; } + /// See + [TLDef(0x37381085)] + public sealed partial class MediaAreaUrl : MediaArea + { + public MediaAreaCoordinates coordinates; + public string url; + } /// Stories associated to a peer See [TLDef(0x9A35E999)] @@ -16948,9 +17032,9 @@ namespace TL { /// Field has a value has_user_id = 0x1, - /// Whether this boost was applied because the channel directly gifted a subscription to the user. + /// Whether this boost was applied because the channel/supergroup directly gifted a subscription to the user. gift = 0x2, - /// Whether this boost was applied because the user was chosen in a giveaway started by the channel. + /// Whether this boost was applied because the user was chosen in a giveaway started by the channel/supergroup. giveaway = 0x4, /// If set, the user hasn't yet invoked Payments_ApplyGiftCode to claim a subscription gifted directly or in a giveaway by the channel. unclaimed = 0x8, @@ -17029,21 +17113,21 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The current boost level of the channel. + /// The current boost level of the channel/supergroup. public int level; /// The number of boosts acquired so far in the current level. public int current_level_boosts; /// Total number of boosts acquired so far. public int boosts; - /// The number of boosts acquired from created Telegram Premium gift codes and giveaways; only returned to channel admins. + /// The number of boosts acquired from created Telegram Premium gift codes and giveaways; only returned to channel/supergroup admins. [IfFlag(4)] public int gift_boosts; /// Total number of boosts needed to reach the next level; if absent, the next level isn't available. [IfFlag(0)] public int next_level_boosts; - /// Only returned to channel admins: contains the approximated number of Premium users subscribed to the channel, related to the total number of subscribers. + /// Only returned to channel/supergroup admins: contains the approximated number of Premium users subscribed to the channel/supergroup, related to the total number of subscribers. [IfFlag(1)] public StatsPercentValue premium_audience; /// Boost deep link » that can be used to boost the chat. public string boost_url; - /// A list of prepaid giveaways available for the chat; only returned to channel admins. + /// A list of prepaid giveaways available for the chat; only returned to channel/supergroup admins. [IfFlag(3)] public PrepaidGiveaway[] prepaid_giveaways; /// Indicates which of our boost slots we've assigned to this peer (populated if my_boost is set). [IfFlag(2)] public int[] my_boost_slots; @@ -17054,7 +17138,7 @@ namespace TL has_next_level_boosts = 0x1, /// Field has a value has_premium_audience = 0x2, - /// Whether we're currently boosting this channel, my_boost_slots will also be set. + /// Whether we're currently boosting this channel/supergroup, my_boost_slots will also be set. my_boost = 0x4, /// Field has a value has_prepaid_giveaways = 0x8, @@ -17224,6 +17308,7 @@ namespace TL [IfFlag(2)] public Help_PeerColorSetBase dark_colors; /// Channels can use this palette only after reaching at least the boost level specified in this field. [IfFlag(3)] public int channel_min_level; + /// Supergroups can use this palette only after reaching at least the boost level specified in this field. [IfFlag(4)] public int group_min_level; [Flags] public enum Flags : uint @@ -17381,6 +17466,7 @@ namespace TL [TLDef(0xCB6FF828)] public sealed partial class SavedReactionTag : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Reaction reaction; [IfFlag(0)] public string title; @@ -17388,6 +17474,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, } } @@ -17398,6 +17485,7 @@ namespace TL public sealed partial class Messages_SavedReactionTags : IObject { public SavedReactionTag[] tags; + /// Hash for pagination, for more info click here public long hash; } @@ -17408,7 +17496,7 @@ namespace TL public DateTime date; } - /// See + /// See Derived classes: public abstract partial class Smsjobs_EligibilityToJoin : IObject { } /// See [TLDef(0xDC8B44CF)] @@ -17422,6 +17510,7 @@ namespace TL [TLDef(0x2AEE9191)] public sealed partial class Smsjobs_Status : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int recent_sent; public int recent_since; @@ -17434,6 +17523,7 @@ namespace TL [Flags] public enum Flags : uint { allow_international = 0x1, + /// Field has a value has_last_gift_slug = 0x2, } } @@ -17447,24 +17537,30 @@ namespace TL public string text; } - /// See + /// A time interval, indicating the opening hours of a business. See [TLDef(0x120B1AB9)] public sealed partial class BusinessWeeklyOpen : IObject { + /// Start minute in minutes of the week, 0 to 7*24*60 inclusively. public int start_minute; + /// End minute in minutes of the week, 1 to 8*24*60 inclusively (8 and not 7 because this allows to specify intervals that, for example, start on Sunday 21:00 and end on Monday 04:00 (6*24*60+21*60 to 7*24*60+4*60) without passing an invalid end_minute < start_minute). See here » for more info. public int end_minute; } - /// See + /// Specifies a set of Telegram Business opening hours. See [TLDef(0x8C92B098)] public sealed partial class BusinessWorkHours : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// An ID of one of the timezones returned by Help_GetTimezonesList.
The timezone ID is contained .id, a human-readable, localized name of the timezone is available in .name and the .utc_offset field contains the UTC offset in seconds, which may be displayed in hh:mm format by the client together with the human-readable name (i.e. $name UTC -01:00).
public string timezone_id; + /// A list of time intervals (max 28) represented by businessWeeklyOpen », indicating the opening hours of their business. public BusinessWeeklyOpen[] weekly_open; [Flags] public enum Flags : uint { + /// Ignored if set while invoking Account_UpdateBusinessWorkHours, only returned by the server in .business_work_hours, indicating whether the business is currently open according to the current time and the values in weekly_open and timezone. open_now = 0x1, } } @@ -17473,112 +17569,148 @@ namespace TL [TLDef(0xAC5C1AF7)] public sealed partial class BusinessLocation : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public GeoPoint geo_point; public string address; [Flags] public enum Flags : uint { + /// Field has a value has_geo_point = 0x1, } } - ///
See + /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See [TLDef(0x6F8B32AA)] public sealed partial class InputBusinessRecipients : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Only private chats with the specified users. [IfFlag(4)] public InputUserBase[] users; [Flags] public enum Flags : uint { + /// All existing private chats. existing_chats = 0x1, + /// All new private chats. new_chats = 0x2, + /// All private chats with contacts. contacts = 0x4, + /// All private chats with non-contacts. non_contacts = 0x8, + /// Field has a value has_users = 0x10, + /// If set, inverts the selection. exclude_selected = 0x20, } } - /// See + /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See [TLDef(0x21108FF7)] public sealed partial class BusinessRecipients : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Only private chats with the specified users. [IfFlag(4)] public long[] users; [Flags] public enum Flags : uint { + /// All existing private chats. existing_chats = 0x1, + /// All new private chats. new_chats = 0x2, + /// All private chats with contacts. contacts = 0x4, + /// All private chats with non-contacts. non_contacts = 0x8, + /// Field has a value has_users = 0x10, + /// If set, inverts the selection. exclude_selected = 0x20, } } - /// See + /// See Derived classes: , , public abstract partial class BusinessAwayMessageSchedule : IObject { } - /// See + /// Always send Telegram Business away messages to users writing to us in private. See [TLDef(0xC9B9E2B9)] public sealed partial class BusinessAwayMessageScheduleAlways : BusinessAwayMessageSchedule { } - /// See + /// Send Telegram Business away messages to users writing to us in private outside of the configured Telegram Business working hours. See [TLDef(0xC3F2F501)] public sealed partial class BusinessAwayMessageScheduleOutsideWorkHours : BusinessAwayMessageSchedule { } - /// See + /// Send Telegram Business away messages to users writing to us in private in the specified time span. See [TLDef(0xCC4D9ECC)] public sealed partial class BusinessAwayMessageScheduleCustom : BusinessAwayMessageSchedule { + /// Start date (UNIX timestamp). public DateTime start_date; + /// End date (UNIX timestamp). public DateTime end_date; } - /// See + /// Describes a Telegram Business greeting, automatically sent to new users writing to us in private for the first time, or after a certain inactivity period. See [TLDef(0x0194CB3B)] public sealed partial class InputBusinessGreetingMessage : IObject { + /// ID of a quick reply shorcut, containing the greeting messages to send, see here » for more info. public int shortcut_id; + /// Allowed recipients for the greeting messages. public InputBusinessRecipients recipients; + /// The number of days after which a private chat will be considered as inactive; currently, must be one of 7, 14, 21, or 28. public int no_activity_days; } - /// See + /// Describes a Telegram Business greeting, automatically sent to new users writing to us in private for the first time, or after a certain inactivity period. See [TLDef(0xE519ABAB)] public sealed partial class BusinessGreetingMessage : IObject { + /// ID of a quick reply shorcut, containing the greeting messages to send, see here » for more info. public int shortcut_id; + /// Allowed recipients for the greeting messages. public BusinessRecipients recipients; + /// The number of days after which a private chat will be considered as inactive; currently, must be one of 7, 14, 21, or 28. public int no_activity_days; } - /// See + /// Describes a Telegram Business away message, automatically sent to users writing to us when we're offline, during closing hours, while we're on vacation, or in some other custom time period when we cannot immediately answer to the user. See [TLDef(0x832175E0)] public sealed partial class InputBusinessAwayMessage : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of a quick reply shorcut, containing the away messages to send, see here » for more info. public int shortcut_id; + /// Specifies when should the away messages be sent. public BusinessAwayMessageSchedule schedule; + /// Allowed recipients for the away messages. public InputBusinessRecipients recipients; [Flags] public enum Flags : uint { + /// If set, the messages will not be sent if the account was online in the last 10 minutes. offline_only = 0x1, } } - /// See + /// Describes a Telegram Business away message, automatically sent to users writing to us when we're offline, during closing hours, while we're on vacation, or in some other custom time period when we cannot immediately answer to the user. See [TLDef(0xEF156A5C)] public sealed partial class BusinessAwayMessage : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of a quick reply shorcut, containing the away messages to send, see here » for more info. public int shortcut_id; + /// Specifies when should the away messages be sent. public BusinessAwayMessageSchedule schedule; + /// Allowed recipients for the away messages. public BusinessRecipients recipients; [Flags] public enum Flags : uint { + /// If set, the messages will not be sent if the account was online in the last 10 minutes. offline_only = 0x1, } } @@ -17598,6 +17730,7 @@ namespace TL public sealed partial class Help_TimezonesList : IObject { public Timezone[] timezones; + /// Hash for pagination, for more info click here public int hash; } @@ -17611,7 +17744,7 @@ namespace TL public int count; } - /// See + /// See Derived classes: , public abstract partial class InputQuickReplyShortcutBase : IObject { } /// See [TLDef(0x24596D41)] @@ -17643,6 +17776,7 @@ namespace TL [TLDef(0xBD068601)] public sealed partial class ConnectedBot : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long bot_id; public BusinessBotRecipients recipients; @@ -17665,6 +17799,7 @@ namespace TL [TLDef(0x2AD93719)] public sealed partial class Messages_DialogFilters : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DialogFilterBase[] filters; @@ -17678,6 +17813,7 @@ namespace TL [TLDef(0x6C8E1E06)] public sealed partial class Birthday : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int day; public int month; @@ -17685,6 +17821,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_year = 0x1, } } @@ -17693,6 +17830,7 @@ namespace TL [TLDef(0x896433B4)] public sealed partial class BotBusinessConnection : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string connection_id; public long user_id; @@ -17710,6 +17848,7 @@ namespace TL [TLDef(0x09C469CD)] public sealed partial class InputBusinessIntro : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string title; public string description; @@ -17717,6 +17856,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sticker = 0x1, } } @@ -17725,6 +17865,7 @@ namespace TL [TLDef(0x5A0A066D)] public sealed partial class BusinessIntro : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string title; public string description; @@ -17732,6 +17873,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sticker = 0x1, } } @@ -17744,7 +17886,7 @@ namespace TL public StickerSetCoveredBase[] sets; } - /// See + /// See Derived classes: , public abstract partial class InputCollectible : IObject { } /// See [TLDef(0xE39460A9)] @@ -17775,6 +17917,7 @@ namespace TL [TLDef(0xC4E5921E)] public sealed partial class InputBusinessBotRecipients : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(4)] public InputUserBase[] users; [IfFlag(6)] public InputUserBase[] exclude_users; @@ -17785,8 +17928,10 @@ namespace TL new_chats = 0x2, contacts = 0x4, non_contacts = 0x8, + /// Field has a value has_users = 0x10, exclude_selected = 0x20, + /// Field has a value has_exclude_users = 0x40, } } @@ -17795,6 +17940,7 @@ namespace TL [TLDef(0xB88CF373)] public sealed partial class BusinessBotRecipients : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(4)] public long[] users; [IfFlag(6)] public long[] exclude_users; @@ -17805,8 +17951,10 @@ namespace TL new_chats = 0x2, contacts = 0x4, non_contacts = 0x8, + /// Field has a value has_users = 0x10, exclude_selected = 0x20, + /// Field has a value has_exclude_users = 0x40, } } @@ -17831,6 +17979,7 @@ namespace TL [TLDef(0x628C9224)] public sealed partial class MissingInvitee : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long user_id; @@ -17853,14 +18002,18 @@ namespace TL [TLDef(0x11679FA7)] public sealed partial class InputBusinessChatLink : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string message; + /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; [IfFlag(1)] public string title; [Flags] public enum Flags : uint { + /// Field has a value has_entities = 0x1, + /// Field has a value has_title = 0x2, } } @@ -17869,16 +18022,20 @@ namespace TL [TLDef(0xB4AE666F)] public sealed partial class BusinessChatLink : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string link; public string message; + /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; [IfFlag(1)] public string title; public int views; [Flags] public enum Flags : uint { + /// Field has a value has_entities = 0x1, + /// Field has a value has_title = 0x2, } } @@ -17898,27 +18055,31 @@ namespace TL [TLDef(0x9A23AF21)] public sealed partial class Account_ResolvedBusinessChatLinks : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public string message; + /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; public Dictionary chats; public Dictionary users; [Flags] public enum Flags : uint { + /// Field has a value has_entities = 0x1, } /// returns a or for the result public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , , public abstract partial class RequestedPeer : IObject { } /// See [TLDef(0xD62FF46A)] public sealed partial class RequestedPeerUser : RequestedPeer { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long user_id; [IfFlag(0)] public string first_name; @@ -17928,8 +18089,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Fields and have a value has_first_name = 0x1, + /// Field has a value has_username = 0x2, + /// Field has a value has_photo = 0x4, } } @@ -17937,6 +18101,7 @@ namespace TL [TLDef(0x7307544F)] public sealed partial class RequestedPeerChat : RequestedPeer { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long chat_id; [IfFlag(0)] public string title; @@ -17944,7 +18109,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, + /// Field has a value has_photo = 0x4, } } @@ -17952,6 +18119,7 @@ namespace TL [TLDef(0x8BA403E4)] public sealed partial class RequestedPeerChannel : RequestedPeer { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long channel_id; [IfFlag(0)] public string title; @@ -17960,8 +18128,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, + /// Field has a value has_username = 0x2, + /// Field has a value has_photo = 0x4, } } @@ -17974,7 +18145,7 @@ namespace TL public byte[] option; } - /// See + /// See Derived classes: , , public abstract partial class Channels_SponsoredMessageReportResult : IObject { } /// See [TLDef(0x846F9E42)] @@ -18007,7 +18178,7 @@ namespace TL public string url; } - /// See + /// See Derived classes: , , public abstract partial class BroadcastRevenueTransaction : IObject { } /// See [TLDef(0x557E2CC4)] @@ -18021,6 +18192,7 @@ namespace TL [TLDef(0x5A590978)] public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long amount; public DateTime date; @@ -18031,6 +18203,7 @@ namespace TL [Flags] public enum Flags : uint { pending = 0x1, + /// Fields and have a value has_transaction_date = 0x2, failed = 0x4, } @@ -18065,6 +18238,7 @@ namespace TL [TLDef(0x56E34970)] public sealed partial class ReactionsNotifySettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public ReactionNotificationsFrom messages_notify_from; [IfFlag(1)] public ReactionNotificationsFrom stories_notify_from; @@ -18073,7 +18247,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_messages_notify_from = 0x1, + /// Field has a value has_stories_notify_from = 0x2, } } @@ -18091,6 +18267,7 @@ namespace TL [TLDef(0x93C3E27E)] public sealed partial class AvailableEffect : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long id; public string emoticon; @@ -18100,7 +18277,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_static_icon_id = 0x1, + /// Field has a value has_effect_animation_id = 0x2, premium_required = 0x4, } @@ -18111,6 +18290,7 @@ namespace TL [TLDef(0xBDDB616E)] public sealed partial class Messages_AvailableEffects : IObject { + /// Hash for pagination, for more info click here public int hash; public AvailableEffect[] effects; public DocumentBase[] documents; @@ -18120,19 +18300,22 @@ namespace TL [TLDef(0xB89BFCCF)] public sealed partial class FactCheck : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public string country; [IfFlag(1)] public TextWithEntities text; + /// Hash for pagination, for more info click here public long hash; [Flags] public enum Flags : uint { need_check = 0x1, + /// Fields and have a value has_country = 0x2, } } - /// See + /// See Derived classes: , , , , , public abstract partial class StarsTransactionPeerBase : IObject { } /// See [TLDef(0x95F2BFE4)] @@ -18155,11 +18338,15 @@ namespace TL { public Peer peer; } + /// See + [TLDef(0x60682812)] + public sealed partial class StarsTransactionPeerAds : StarsTransactionPeerBase { } /// See [TLDef(0x0BD915C0)] public sealed partial class StarsTopupOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; [IfFlag(0)] public string store_product; @@ -18168,15 +18355,17 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_store_product = 0x1, extended = 0x2, } } /// See - [TLDef(0xCC7079B2)] + [TLDef(0x2DB5418F)] public sealed partial class StarsTransaction : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string id; public long stars; @@ -18185,13 +18374,31 @@ namespace TL [IfFlag(0)] public string title; [IfFlag(1)] public string description; [IfFlag(2)] public WebDocumentBase photo; + [IfFlag(5)] public DateTime transaction_date; + [IfFlag(5)] public string transaction_url; + [IfFlag(7)] public byte[] bot_payload; + [IfFlag(8)] public int msg_id; + [IfFlag(9)] public MessageMedia[] extended_media; [Flags] public enum Flags : uint { + /// Field has a value has_title = 0x1, + /// Field has a value has_description = 0x2, + /// Field has a value has_photo = 0x4, refund = 0x8, + pending = 0x10, + /// Fields and have a value + has_transaction_date = 0x20, + failed = 0x40, + /// Field has a value + has_bot_payload = 0x80, + /// Field has a value + has_msg_id = 0x100, + /// Field has a value + has_extended_media = 0x200, } } @@ -18199,6 +18406,7 @@ namespace TL [TLDef(0x8CF4EE60)] public sealed partial class Payments_StarsStatus : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long balance; public StarsTransaction[] history; @@ -18206,6 +18414,34 @@ namespace TL public Dictionary chats; public Dictionary users; + [Flags] public enum Flags : uint + { + /// Field has a value + has_next_offset = 0x1, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xE87ACBC0)] + public sealed partial class FoundStory : IObject + { + public Peer peer; + public StoryItemBase story; + } + + /// See + [TLDef(0xE2DE7737)] + public sealed partial class Stories_FoundStories : IObject, IPeerResolver + { + public Flags flags; + public int count; + public FoundStory[] stories; + [IfFlag(0)] public string next_offset; + public Dictionary chats; + public Dictionary users; + [Flags] public enum Flags : uint { has_next_offset = 0x1, @@ -18213,4 +18449,75 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + [TLDef(0xDE4C5D93)] + public sealed partial class GeoPointAddress : IObject + { + public Flags flags; + public string country_iso2; + [IfFlag(0)] public string state; + [IfFlag(1)] public string city; + [IfFlag(2)] public string street; + + [Flags] public enum Flags : uint + { + has_state = 0x1, + has_city = 0x2, + has_street = 0x4, + } + } + + /// See + [TLDef(0x79342946)] + public sealed partial class StarsRevenueStatus : IObject + { + public Flags flags; + public long current_balance; + public long available_balance; + public long overall_revenue; + [IfFlag(1)] public int next_withdrawal_at; + + [Flags] public enum Flags : uint + { + withdrawal_enabled = 0x1, + has_next_withdrawal_at = 0x2, + } + } + + /// See + [TLDef(0xC92BB73B)] + public sealed partial class Payments_StarsRevenueStats : IObject + { + public StatsGraphBase revenue_graph; + public StarsRevenueStatus status; + public double usd_rate; + } + + /// See + [TLDef(0x1DAB80B7)] + public sealed partial class Payments_StarsRevenueWithdrawalUrl : IObject + { + public string url; + } + + /// See + [TLDef(0x394E7F21)] + public sealed partial class Payments_StarsRevenueAdsAccountUrl : IObject + { + public string url; + } + + /// See + [TLDef(0x206AE6D1)] + public sealed partial class InputStarsTransaction : IObject + { + public Flags flags; + public string id; + + [Flags] public enum Flags : uint + { + refund = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 0f9c38c..cd6aa33 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -354,7 +354,7 @@ namespace TL phone_code_hash = phone_code_hash, }); - /// See + /// See Possible codes: 400 (details) public static Task Auth_ReportMissingCode(this Client client, string phone_number, string phone_code_hash, string mnc) => client.Invoke(new Auth_ReportMissingCode { @@ -439,7 +439,7 @@ namespace TL }); /// Returns a list of available wallpapers. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash = default) => client.Invoke(new Account_GetWallPapers @@ -958,7 +958,7 @@ namespace TL /// Get installed themes See /// Theme format, a string that identifies the theming engines supported by the client - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash = default) => client.Invoke(new Account_GetThemes @@ -995,7 +995,7 @@ namespace TL { }); - /// Set global privacy settings See Possible codes: 400 (details) + /// Set global privacy settings See Possible codes: 400,403 (details) /// Global privacy settings public static Task Account_SetGlobalPrivacySettings(this Client client, GlobalPrivacySettings settings) => client.Invoke(new Account_SetGlobalPrivacySettings @@ -1030,7 +1030,7 @@ namespace TL }); /// Get all available chat themes ». See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.themesNotModified public static Task Account_GetChatThemes(this Client client, long hash = default) => client.Invoke(new Account_GetChatThemes @@ -1061,7 +1061,7 @@ namespace TL }); /// Fetch saved notification sounds See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.savedRingtonesNotModified public static Task Account_GetSavedRingtones(this Client client, long hash = default) => client.Invoke(new Account_GetSavedRingtones @@ -1100,7 +1100,7 @@ namespace TL }); /// Get a list of default suggested emoji statuses See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultEmojiStatuses @@ -1109,7 +1109,7 @@ namespace TL }); /// Get recently used emoji statuses See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetRecentEmojiStatuses @@ -1142,7 +1142,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as profile picture See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1151,7 +1151,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as group picture See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1206,7 +1206,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultBackgroundEmojis @@ -1215,7 +1215,7 @@ namespace TL }); /// Get a list of default suggested channel emoji statuses. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetChannelDefaultEmojiStatuses @@ -1224,7 +1224,7 @@ namespace TL }); /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetChannelRestrictedStatusEmojis @@ -1232,7 +1232,8 @@ namespace TL hash = hash, }); - /// See + /// Specify a set of Telegram Business opening hours.
This info will be contained in .business_work_hours. See Possible codes: 400 (details)
+ /// Opening hours (optional, if not set removes all opening hours). public static Task Account_UpdateBusinessWorkHours(this Client client, BusinessWorkHours business_work_hours = null) => client.Invoke(new Account_UpdateBusinessWorkHours { @@ -1240,7 +1241,9 @@ namespace TL business_work_hours = business_work_hours, }); - /// See + /// Businesses » may advertise their location using this method, see here » for more info. See + /// Optional, contains a set of geographical coordinates. + /// Mandatory when setting/updating the location, contains a textual description of the address (max 96 UTF-8 chars). public static Task Account_UpdateBusinessLocation(this Client client, string address = null, InputGeoPoint geo_point = null) => client.Invoke(new Account_UpdateBusinessLocation { @@ -1280,7 +1283,7 @@ namespace TL { }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Account_GetBotBusinessConnection(this Client client, string connection_id) => client.Invoke(new Account_GetBotBusinessConnection { @@ -1295,7 +1298,7 @@ namespace TL intro = intro, }); - /// See + /// See Possible codes: 400 (details) public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused) => client.Invoke(new Account_ToggleConnectedBotPaused { @@ -1303,7 +1306,7 @@ namespace TL paused = paused, }); - /// See + /// See Possible codes: 400 (details) public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer) => client.Invoke(new Account_DisablePeerConnectedBot { @@ -1325,7 +1328,7 @@ namespace TL link = link, }); - /// See + /// See Possible codes: 400 (details) public static Task Account_EditBusinessChatLink(this Client client, string slug, InputBusinessChatLink link) => client.Invoke(new Account_EditBusinessChatLink { @@ -1333,7 +1336,7 @@ namespace TL link = link, }); - /// See + /// See Possible codes: 400 (details) public static Task Account_DeleteBusinessChatLink(this Client client, string slug) => client.Invoke(new Account_DeleteBusinessChatLink { @@ -1346,7 +1349,7 @@ namespace TL { }); - /// See + /// See Possible codes: 400 (details) public static Task Account_ResolveBusinessChatLink(this Client client, string slug) => client.Invoke(new Account_ResolveBusinessChatLink { @@ -1406,7 +1409,8 @@ namespace TL errors = errors, }); - /// See + /// Check whether we can write to the specified user (non-Premium users only). See + /// Users to fetch info about. public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetIsPremiumRequiredToContact { @@ -1428,7 +1432,7 @@ namespace TL }); /// Returns the current user's contact list. See - /// If there already is a full contact list on the client, a hash of a the list of contact IDs in ascending order may be passed in this parameter. If the contact set was not changed, will be returned. + /// Hash for pagination, for more info click here.
Note that the hash is computed using the usual algorithm, passing to the algorithm first the previously returned .saved_count field, then max 100000 sorted user IDs from the contact list, including the ID of the currently logged in user if it is saved as a contact.
Example: tdlib implementation. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash = default) => client.Invoke(new Contacts_GetContacts @@ -1548,7 +1552,7 @@ namespace TL { }); - /// Get all contacts, requires a takeout session, see here » for more info. See Possible codes: 403 (details) + /// Get all contacts, requires a takeout session, see here » for more info. See Possible codes: 400,403 (details) public static Task Contacts_GetSaved(this Client client) => client.Invoke(new Contacts_GetSaved { @@ -1618,7 +1622,7 @@ namespace TL phone = phone, }); - /// Generates a temporary profile link for the currently logged-in user. See [bots: ✓] + /// Generates a temporary profile link for the currently logged-in user. See public static Task Contacts_ExportContactToken(this Client client) => client.Invoke(new Contacts_ExportContactToken { @@ -1811,7 +1815,7 @@ namespace TL /// Whether to move used stickersets to top, see here for more info on this flag » /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. /// The destination where the message will be sent - /// If set, indicates that the message should be sent in reply to the specified message or story. + /// If set, indicates that the message should be sent in reply to the specified message or story.
Also used to quote other messages. /// The message /// Unique client message ID required to prevent message resending You can use /// Reply markup for sending bot buttons @@ -2130,7 +2134,7 @@ namespace TL /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_GetStickers @@ -2140,7 +2144,7 @@ namespace TL }); /// Get all installed stickers See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetAllStickers @@ -2316,8 +2320,8 @@ namespace TL mime_type = mime_type, }); - /// Get saved GIFs See - /// Hash for pagination, for more info click here + /// Get saved GIFs. See + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash = default) => client.Invoke(new Messages_GetSavedGifs @@ -2500,15 +2504,16 @@ namespace TL /// The draft /// Message entities for styled text /// Attached media - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), + flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (effect != null ? 0x80 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), reply_to = reply_to, peer = peer, message = message, entities = entities, media = media, + effect = effect.GetValueOrDefault(), }); /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
@@ -2518,7 +2523,7 @@ namespace TL }); /// Get featured stickers See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedStickers { @@ -2535,7 +2540,7 @@ namespace TL /// Get recent stickers See /// Get stickers recently attached to photo or video files - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash = default, bool attached = false) => client.Invoke(new Messages_GetRecentStickers @@ -2578,7 +2583,7 @@ namespace TL }); /// Get installed mask stickers See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetMaskStickers @@ -2751,7 +2756,7 @@ namespace TL }); /// Get faved stickers See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFavedStickers @@ -2852,7 +2857,7 @@ namespace TL /// Search for stickersets See /// Exclude featured stickersets from results /// Query string - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchStickerSets @@ -3064,7 +3069,7 @@ namespace TL id = id, }); - /// Send scheduled messages right away See Possible codes: 400 (details) + /// Send scheduled messages right away See Possible codes: 400,500 (details) /// Peer /// Scheduled message IDs public static Task Messages_SendScheduledMessages(this Client client, InputPeer peer, params int[] id) @@ -3074,7 +3079,7 @@ namespace TL id = id, }); - /// Delete scheduled messages See Possible codes: 400 (details) + /// Delete scheduled messages See Possible codes: 400,403 (details) /// Peer /// Scheduled message IDs public static Task Messages_DeleteScheduledMessages(this Client client, InputPeer peer, params int[] id) @@ -3147,7 +3152,7 @@ namespace TL /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetOldFeaturedStickers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetOldFeaturedStickers { @@ -3541,7 +3546,7 @@ namespace TL }); /// Obtain available message reactions » See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions @@ -3572,7 +3577,7 @@ namespace TL to_lang = to_lang, }); - /// Get unread reactions to messages you sent See + /// Get unread reactions to messages you sent See Possible codes: 400 (details) /// Peer /// If set, considers only reactions to messages within the specified forum topic /// Offsets for pagination, for more info click here @@ -3617,7 +3622,7 @@ namespace TL }); /// Returns installed attachment menu bot mini apps » See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means attachMenuBotsNotModified public static Task Messages_GetAttachMenuBots(this Client client, long hash = default) => client.Invoke(new Messages_GetAttachMenuBots @@ -3633,7 +3638,7 @@ namespace TL bot = bot, }); - /// Enable or disable web bot attachment menu » See + /// Enable or disable web bot attachment menu » See Possible codes: 400 (details) /// Whether the user authorizes the bot to write messages to them, if requested by .request_write_access /// Bot ID /// Toggle @@ -3645,7 +3650,7 @@ namespace TL enabled = enabled, }); - /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400 (details) + /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400,403 (details) /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). @@ -3656,10 +3661,10 @@ namespace TL /// Short name of the application; 0-64 English letters, digits, and underscores /// If set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to the specified message or story. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false, bool compact = false) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((reply_to != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0)), + flags = (Messages_RequestWebView.Flags)((reply_to != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (compact ? 0x80 : 0)), peer = peer, bot = bot, url = url, @@ -3688,7 +3693,7 @@ namespace TL send_as = send_as, }); - /// Open a bot mini app. See + /// Open a bot mini app. See Possible codes: 400 (details) /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. /// Set this flag if opening the Mini App from the installed side menu entry » or from a Mini App link ». /// Bot that owns the mini app @@ -3696,10 +3701,10 @@ namespace TL /// Start parameter, if opening from a Mini App link ». /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false, bool compact = false) => client.Invoke(new Messages_RequestSimpleWebView { - flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0)), + flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0) | (compact ? 0x80 : 0)), bot = bot, url = url, start_param = start_param, @@ -3764,7 +3769,7 @@ namespace TL }); /// Gets the list of currently installed custom emoji stickersets. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetEmojiStickers @@ -3773,7 +3778,7 @@ namespace TL }); /// Gets featured custom emoji stickersets. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedEmojiStickers { @@ -3794,7 +3799,7 @@ namespace TL /// Got popular message reactions See /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetTopReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetTopReactions @@ -3805,7 +3810,7 @@ namespace TL /// Get recently used message reactions See /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetRecentReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentReactions @@ -3859,7 +3864,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when selecting custom emojis. See [bots: ✓] - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3868,7 +3873,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See [bots: ✓] - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3877,7 +3882,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See [bots: ✓] - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3887,7 +3892,7 @@ namespace TL /// Look for custom emojis associated to a UTF8 emoji See [bots: ✓] Possible codes: 400 (details) /// The emoji - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -3923,10 +3928,10 @@ namespace TL /// If the startapp query string parameter is present in the direct Mini App deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false) + public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false, bool compact = false) => client.Invoke(new Messages_RequestAppWebView { - flags = (Messages_RequestAppWebView.Flags)((start_param != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), + flags = (Messages_RequestAppWebView.Flags)((start_param != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (compact ? 0x80 : 0)), peer = peer, app = app, start_param = start_param, @@ -3954,7 +3959,7 @@ namespace TL /// Search for custom emoji stickersets » See /// Exclude featured stickersets from results /// Query string - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchEmojiStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchEmojiStickerSets @@ -4045,7 +4050,9 @@ namespace TL order = order, }); - /// See + /// Fetch the full list of saved message tags created by the user. See + /// If set, returns tags only used in the specified saved message dialog. + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.savedReactionTagsNotModified public static Task Messages_GetSavedReactionTags(this Client client, long hash = default, InputPeer peer = null) => client.Invoke(new Messages_GetSavedReactionTags @@ -4055,7 +4062,9 @@ namespace TL hash = hash, }); - /// See + /// Update the description of a saved message tag ». See Possible codes: 400 (details) + /// Reaction associated to the tag + /// Tag description, max 12 UTF-8 characters; to remove the description call the method without setting this flag. public static Task Messages_UpdateSavedReactionTag(this Client client, Reaction reaction, string title = null) => client.Invoke(new Messages_UpdateSavedReactionTag { @@ -4064,7 +4073,8 @@ namespace TL title = title, }); - /// See + /// Fetch a default recommended list of saved message tag reactions. See + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetDefaultTagReactions(this Client client, long hash = default) => client.Invoke(new Messages_GetDefaultTagReactions @@ -4072,7 +4082,7 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400,403 (details) public static Task Messages_GetOutboxReadDate(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_GetOutboxReadDate { @@ -4080,7 +4090,8 @@ namespace TL msg_id = msg_id, }); - /// See + /// Fetch basic info about all existing quick reply shortcuts. See + /// Hash for pagination, generated as specified here » (not the usual algorithm used for hash generation.) /// a null value means messages.quickRepliesNotModified public static Task Messages_GetQuickReplies(this Client client, long hash = default) => client.Invoke(new Messages_GetQuickReplies @@ -4088,21 +4099,25 @@ namespace TL hash = hash, }); - /// See + /// Reorder quick reply shortcuts. See + /// IDs of all created quick reply shortcuts, in the desired order. public static Task Messages_ReorderQuickReplies(this Client client, params int[] order) => client.Invoke(new Messages_ReorderQuickReplies { order = order, }); - /// See + /// Before offering the user the choice to add a message to a quick reply shortcut, to make sure that none of the limits specified here » were reached. See + /// Shorcut name (not ID!). public static Task Messages_CheckQuickReplyShortcut(this Client client, string shortcut) => client.Invoke(new Messages_CheckQuickReplyShortcut { shortcut = shortcut, }); - /// See + /// Rename a quick reply shortcut.
This will emit an update to other logged-in sessions. See Possible codes: 400 (details)
+ /// Shortcut ID. + /// New shortcut name. public static Task Messages_EditQuickReplyShortcut(this Client client, int shortcut_id, string shortcut) => client.Invoke(new Messages_EditQuickReplyShortcut { @@ -4110,14 +4125,16 @@ namespace TL shortcut = shortcut, }); - /// See + /// Completely delete a quick reply shortcut.
This will also emit an update to other logged-in sessions (and no updates, even if all the messages in the shortcuts are also deleted by this method). See Possible codes: 400 (details)
+ /// Shortcut ID public static Task Messages_DeleteQuickReplyShortcut(this Client client, int shortcut_id) => client.Invoke(new Messages_DeleteQuickReplyShortcut { shortcut_id = shortcut_id, }); - /// 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
See
+ /// 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
See
Possible codes: 400 (details)
+ /// Hash for pagination, for more info click here public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) => client.Invoke(new Messages_GetQuickReplyMessages { @@ -4127,7 +4144,8 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) + /// You can use public static Task Messages_SendQuickReplyMessages(this Client client, InputPeer peer, int shortcut_id, int[] id, params long[] random_id) => client.Invoke(new Messages_SendQuickReplyMessages { @@ -4137,7 +4155,9 @@ namespace TL random_id = random_id, }); - /// 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
See
+ /// 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
Delete one or more messages from a
quick reply shortcut. This will also emit an update. See Possible codes: 400 (details)
+ /// Shortcut ID. + /// IDs of shortcut messages to delete. public static Task Messages_DeleteQuickReplyMessages(this Client client, int shortcut_id, params int[] id) => client.Invoke(new Messages_DeleteQuickReplyMessages { @@ -4153,6 +4173,8 @@ namespace TL }); /// See + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Messages_GetMyStickers(this Client client, long offset_id = default, int limit = int.MaxValue) => client.Invoke(new Messages_GetMyStickers { @@ -4161,6 +4183,7 @@ namespace TL }); /// See + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStickerGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStickerGroups @@ -4169,6 +4192,7 @@ namespace TL }); /// See + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.availableEffectsNotModified public static Task Messages_GetAvailableEffects(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableEffects @@ -4176,7 +4200,7 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_EditFactCheck(this Client client, InputPeer peer, int msg_id, TextWithEntities text) => client.Invoke(new Messages_EditFactCheck { @@ -4185,7 +4209,7 @@ namespace TL text = text, }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_DeleteFactCheck(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_DeleteFactCheck { @@ -4193,7 +4217,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_GetFactCheck(this Client client, InputPeer peer, params int[] msg_id) => client.Invoke(new Messages_GetFactCheck { @@ -4325,7 +4349,7 @@ namespace TL bytes = bytes, }); - /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,406 (details) + /// Returns content of a whole file or its part. See [bots: ✓] Possible codes: 400,406,420 (details) /// Disable some checks on limit and offset values, useful for example to stream videos by keyframes /// Whether the current client supports CDN downloads /// File location @@ -4366,7 +4390,7 @@ namespace TL limit = limit, }); - /// Download a CDN file. See + /// Download a CDN file. See Possible codes: 400 (details) /// File token /// Offset of chunk to download /// Length of chunk to download @@ -4388,7 +4412,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400,500 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) @@ -4489,7 +4513,7 @@ namespace TL }); /// Get app-specific configuration, see client configuration for more info on the result. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.appConfigNotModified public static Task Help_GetAppConfig(this Client client, int hash = default) => client.Invoke(new Help_GetAppConfig @@ -4506,7 +4530,7 @@ namespace TL }); /// Get passport configuration See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash = default) => client.Invoke(new Help_GetPassportConfig @@ -4568,7 +4592,7 @@ namespace TL /// Get name, ISO code, localized name and phone codes/patterns of all available countries See /// Language code of the current user - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash = default) => client.Invoke(new Help_GetCountriesList @@ -4584,7 +4608,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used for message accents. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerColors @@ -4593,7 +4617,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used in profile page backgrounds. See - /// Hash for pagination, for more info click here + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerProfileColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerProfileColors @@ -4602,6 +4626,7 @@ namespace TL }); /// See + /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.timezonesListNotModified public static Task Help_GetTimezonesList(this Client client, int hash = default) => client.Invoke(new Help_GetTimezonesList @@ -5049,7 +5074,7 @@ namespace TL order = order, }); - /// Activate or deactivate a purchased fragment.com username associated to a supergroup or channel we own. See [bots: ✓] Possible codes: 400 (details) + /// Activate or deactivate a purchased fragment.com username associated to a supergroup or channel we own. See Possible codes: 400 (details) /// Supergroup or channel /// Username /// Whether to activate or deactivate the username @@ -5221,7 +5246,7 @@ namespace TL }); /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) - /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. + /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed.
Channels can change both message and profile palettes; supergroups can only change the profile palette, of course after reaching the appropriate boost level. /// Channel whose accent color should be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info); if not set, the default palette is used. /// Custom emoji ID used in the accent color pattern. @@ -5253,8 +5278,8 @@ namespace TL channel = channel, }); - /// Set an emoji status for a channel. See Possible codes: 400 (details) - /// The channel, must have at least channel_emoji_status_level_min boosts. + /// Set an emoji status for a channel or supergroup. See Possible codes: 400 (details) + /// The channel/supergroup, must have at least channel_emoji_status_level_min/group_emoji_status_level_min boosts. /// Emoji status to set public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) => client.Invoke(new Channels_UpdateEmojiStatus @@ -5263,7 +5288,7 @@ namespace TL emoji_status = emoji_status, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_SetBoostsToUnblockRestrictions(this Client client, InputChannelBase channel, int boosts) => client.Invoke(new Channels_SetBoostsToUnblockRestrictions { @@ -5271,7 +5296,7 @@ namespace TL boosts = boosts, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_SetEmojiStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.Invoke(new Channels_SetEmojiStickers { @@ -5279,7 +5304,7 @@ namespace TL stickerset = stickerset, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_ReportSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, byte[] option) => client.Invoke(new Channels_ReportSponsoredMessage { @@ -5288,7 +5313,7 @@ namespace TL option = option, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_RestrictSponsoredMessages(this Client client, InputChannelBase channel, bool restricted) => client.Invoke(new Channels_RestrictSponsoredMessages { @@ -5297,6 +5322,8 @@ namespace TL }); /// See + /// Offsets for pagination, for more info click here + /// Maximum number of results to return, see pagination public static Task Channels_SearchPosts(this Client client, string hashtag, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) => client.Invoke(new Channels_SearchPosts { @@ -5432,7 +5459,7 @@ namespace TL order = order, }); - /// Activate or deactivate a purchased fragment.com username associated to a bot we own. See [bots: ✓] Possible codes: 400 (details) + /// Activate or deactivate a purchased fragment.com username associated to a bot we own. See Possible codes: 400 (details) /// The bot /// Username /// Whether to activate or deactivate it @@ -5636,23 +5663,24 @@ namespace TL { }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarsStatus(this Client client, InputPeer peer) => client.Invoke(new Payments_GetStarsStatus { peer = peer, }); - /// See - public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, bool inbound = false, bool outbound = false) + /// See [bots: ✓] Possible codes: 400 (details) + public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool inbound = false, bool outbound = false, bool ascending = false) => client.Invoke(new Payments_GetStarsTransactions { - flags = (Payments_GetStarsTransactions.Flags)((inbound ? 0x1 : 0) | (outbound ? 0x2 : 0)), + flags = (Payments_GetStarsTransactions.Flags)((inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0)), peer = peer, offset = offset, + limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) => client.Invoke(new Payments_SendStarsForm { @@ -5661,7 +5689,7 @@ namespace TL invoice = invoice, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Payments_RefundStarsCharge(this Client client, InputUserBase user_id, string charge_id) => client.Invoke(new Payments_RefundStarsCharge { @@ -5669,6 +5697,38 @@ namespace TL charge_id = charge_id, }); + /// See + public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false) + => client.Invoke(new Payments_GetStarsRevenueStats + { + flags = (Payments_GetStarsRevenueStats.Flags)(dark ? 0x1 : 0), + peer = peer, + }); + + /// See + public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, long stars, InputCheckPasswordSRP password) + => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl + { + peer = peer, + stars = stars, + password = password, + }); + + /// See + public static Task Payments_GetStarsRevenueAdsAccountUrl(this Client client, InputPeer peer) + => client.Invoke(new Payments_GetStarsRevenueAdsAccountUrl + { + peer = peer, + }); + + /// See + public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, params InputStarsTransaction[] id) + => client.Invoke(new Payments_GetStarsTransactionsByID + { + peer = peer, + id = id, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -5788,7 +5848,7 @@ namespace TL stickerset = stickerset, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) /// a null value means messages.stickerSetNotModified public static Task Stickers_ReplaceSticker(this Client client, InputDocument sticker, InputStickerSetItem new_sticker) => client.Invoke(new Stickers_ReplaceSticker @@ -6050,7 +6110,7 @@ namespace TL presentation_paused = presentation_paused.GetValueOrDefault(), }); - /// Edit the title of a group call or livestream See Possible codes: 403 (details) + /// Edit the title of a group call or livestream See Possible codes: 400,403 (details) /// Group call /// New title public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) @@ -6295,7 +6355,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stats_GetBroadcastRevenueStats(this Client client, InputChannelBase channel, bool dark = false) => client.Invoke(new Stats_GetBroadcastRevenueStats { @@ -6303,7 +6363,7 @@ namespace TL channel = channel, }); - /// See + /// See Possible codes: 400 (details) public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputChannelBase channel, InputCheckPasswordSRP password) => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl { @@ -6311,7 +6371,8 @@ namespace TL password = password, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputChannelBase channel, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stats_GetBroadcastRevenueTransactions { @@ -6365,7 +6426,7 @@ namespace TL chatlist = chatlist, }); - /// Obtain information about a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Obtain information about a chat folder deep link ». See Possible codes: 400 (details) /// slug obtained from the chat folder deep link » public static Task Chatlists_CheckChatlistInvite(this Client client, string slug) => client.Invoke(new Chatlists_CheckChatlistInvite @@ -6714,7 +6775,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_TogglePinnedToTop(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_TogglePinnedToTop { @@ -6722,9 +6783,20 @@ namespace TL id = id, }); - /// Obtains info about the boosts that were applied to a certain channel (admins only) See Possible codes: 400 (details) - /// Whether to return only info about boosts received from gift codes and giveaways created by the channel » - /// The channel + /// See + public static Task Stories_SearchPosts(this Client client, string offset, int limit = int.MaxValue, string hashtag = null, MediaArea area = null) + => client.Invoke(new Stories_SearchPosts + { + flags = (Stories_SearchPosts.Flags)((hashtag != null ? 0x1 : 0) | (area != null ? 0x2 : 0)), + hashtag = hashtag, + area = area, + offset = offset, + limit = limit, + }); + + /// Obtains info about the boosts that were applied to a certain channel or supergroup (admins only) See Possible codes: 400 (details) + /// Whether to return only info about boosts received from gift codes and giveaways created by the channel/supergroup » + /// The channel/supergroup /// Offset for pagination, obtained from .next_offset /// Maximum number of results to return, see pagination public static Task Premium_GetBoostsList(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool gifts = false) @@ -6753,7 +6825,7 @@ namespace TL peer = peer, }); - /// Gets the current number of boosts of a channel. See Possible codes: 400 (details) + /// Gets the current number of boosts of a channel/supergroup. See Possible codes: 400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus @@ -6761,8 +6833,8 @@ namespace TL peer = peer, }); - /// Returns the lists of boost that were applied to a channel by a specific user (admins only) See [bots: ✓] Possible codes: 400 (details) - /// The channel + /// Returns the lists of boost that were applied to a channel/supergroup by a specific user (admins only) See [bots: ✓] Possible codes: 400 (details) + /// The channel/supergroup /// The user public static Task Premium_GetUserBoosts(this Client client, InputPeer peer, InputUserBase user_id) => client.Invoke(new Premium_GetUserBoosts @@ -6771,45 +6843,45 @@ namespace TL user_id = user_id, }); - /// See + /// See Possible codes: 403 (details) public static Task Smsjobs_IsEligibleToJoin(this Client client) => client.Invoke(new Smsjobs_IsEligibleToJoin { }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_Join(this Client client) => client.Invoke(new Smsjobs_Join { }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_Leave(this Client client) => client.Invoke(new Smsjobs_Leave { }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_UpdateSettings(this Client client, bool allow_international = false) => client.Invoke(new Smsjobs_UpdateSettings { flags = (Smsjobs_UpdateSettings.Flags)(allow_international ? 0x1 : 0), }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_GetStatus(this Client client) => client.Invoke(new Smsjobs_GetStatus { }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_GetSmsJob(this Client client, string job_id) => client.Invoke(new Smsjobs_GetSmsJob { job_id = job_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Smsjobs_FinishJob(this Client client, string job_id, string error = null) => client.Invoke(new Smsjobs_FinishJob { @@ -6818,7 +6890,7 @@ namespace TL error = error, }); - /// See + /// See Possible codes: 400 (details) public static Task Fragment_GetCollectibleInfo(this Client client, InputCollectible collectible) => client.Invoke(new Fragment_GetCollectibleInfo { @@ -8904,7 +8976,7 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0x7FF3B806)] + [TLDef(0xD372C5CE)] public sealed partial class Messages_SaveDraft : IMethod { public Flags flags; @@ -8913,6 +8985,7 @@ namespace TL.Methods public string message; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(5)] public InputMedia media; + [IfFlag(7)] public long effect; [Flags] public enum Flags : uint { @@ -8921,6 +8994,7 @@ namespace TL.Methods has_reply_to = 0x10, has_media = 0x20, invert_media = 0x40, + has_effect = 0x80, } } @@ -9927,6 +10001,7 @@ namespace TL.Methods has_start_param = 0x8, from_bot_menu = 0x10, silent = 0x20, + compact = 0x80, has_send_as = 0x2000, } } @@ -9949,8 +10024,8 @@ namespace TL.Methods } } - [TLDef(0x1A46500A)] - public sealed partial class Messages_RequestSimpleWebView : IMethod + [TLDef(0x413A3E73)] + public sealed partial class Messages_RequestSimpleWebView : IMethod { public Flags flags; public InputUserBase bot; @@ -9966,6 +10041,7 @@ namespace TL.Methods from_side_menu = 0x4, has_url = 0x8, has_start_param = 0x10, + compact = 0x80, } } @@ -10113,8 +10189,8 @@ namespace TL.Methods public long hash; } - [TLDef(0x8C5A3B3C)] - public sealed partial class Messages_RequestAppWebView : IMethod + [TLDef(0x53618BCE)] + public sealed partial class Messages_RequestAppWebView : IMethod { public Flags flags; public InputPeer peer; @@ -10128,6 +10204,7 @@ namespace TL.Methods write_allowed = 0x1, has_start_param = 0x2, has_theme_params = 0x4, + compact = 0x80, } } @@ -11514,17 +11591,19 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x673AC2F9)] + [TLDef(0x97938D5A)] public sealed partial class Payments_GetStarsTransactions : IMethod { public Flags flags; public InputPeer peer; public string offset; + public int limit; [Flags] public enum Flags : uint { inbound = 0x1, outbound = 0x2, + ascending = 0x4, } } @@ -11547,6 +11626,39 @@ namespace TL.Methods public string charge_id; } + [TLDef(0xD91FFAD6)] + public sealed partial class Payments_GetStarsRevenueStats : IMethod + { + public Flags flags; + public InputPeer peer; + + [Flags] public enum Flags : uint + { + dark = 0x1, + } + } + + [TLDef(0x13BBE8B3)] + public sealed partial class Payments_GetStarsRevenueWithdrawalUrl : IMethod + { + public InputPeer peer; + public long stars; + public InputCheckPasswordSRP password; + } + + [TLDef(0xD1D7EFC5)] + public sealed partial class Payments_GetStarsRevenueAdsAccountUrl : IMethod + { + public InputPeer peer; + } + + [TLDef(0x27842D2E)] + public sealed partial class Payments_GetStarsTransactionsByID : IMethod + { + public InputPeer peer; + public InputStarsTransaction[] id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -12423,6 +12535,22 @@ namespace TL.Methods public int[] id; } + [TLDef(0x6CEA116A)] + public sealed partial class Stories_SearchPosts : IMethod + { + public Flags flags; + [IfFlag(0)] public string hashtag; + [IfFlag(1)] public MediaArea area; + public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + has_hashtag = 0x1, + has_area = 0x2, + } + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 7974bd5..9e04c7e 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 = 181; // fetched 28/05/2024 13:03:09 + public const int Version = 183; // fetched 01/07/2024 23:00:22 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -101,6 +101,7 @@ namespace TL [0xE66FBF7B] = typeof(InputMediaDice), [0x89FDD778] = typeof(InputMediaStory), [0xC21B8849] = typeof(InputMediaWebPage), + [0xAA661FC3] = typeof(InputMediaPaidMedia), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -164,6 +165,7 @@ namespace TL [0x68CB6283] = typeof(MessageMediaStory), [0xDAAD85B0] = typeof(MessageMediaGiveaway), [0xC6991068] = typeof(MessageMediaGiveawayResults), + [0xA8852491] = typeof(MessageMediaPaidMedia), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -377,7 +379,7 @@ namespace TL [0x30F443DB] = typeof(UpdateRecentEmojiStatuses), [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), - [0x5A73A98C] = typeof(UpdateMessageExtendedMedia), + [0xD5A41724] = typeof(UpdateMessageExtendedMedia), [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), @@ -408,6 +410,8 @@ namespace TL [0x1824E40B] = typeof(UpdateNewStoryReaction), [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), [0x0FB85198] = typeof(UpdateStarsBalance), + [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), + [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -651,7 +655,7 @@ namespace TL [0xF450F59B] = typeof(Auth_SentCodeTypeEmailCode), [0xA5491DEA] = typeof(Auth_SentCodeTypeSetUpEmailRequired), [0xD9565C39] = typeof(Auth_SentCodeTypeFragmentSms), - [0x13C90F17] = typeof(Auth_SentCodeTypeFirebaseSms), + [0x009FD736] = typeof(Auth_SentCodeTypeFirebaseSms), [0xA416AC81] = typeof(Auth_SentCodeTypeSmsWord), [0xB37794AF] = typeof(Auth_SentCodeTypeSmsPhrase), [0x36585EA4] = typeof(Messages_BotCallbackAnswer), @@ -666,7 +670,7 @@ namespace TL [0x70B772A8] = typeof(Contacts_TopPeers), [0xB52C939D] = typeof(Contacts_TopPeersDisabled), [0x1B0C841A] = typeof(DraftMessageEmpty), - [0x3FCCF7EF] = typeof(DraftMessage), + [0x2D65321F] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified @@ -1059,8 +1063,7 @@ namespace TL [0xF1D88A5C] = null,//AttachMenuBotsNotModified [0x3C4301C0] = typeof(AttachMenuBots), [0x93BF667F] = typeof(AttachMenuBotsBot), - [0x0C14557C] = typeof(WebViewResultUrl), - [0x882F76BB] = typeof(SimpleWebViewResultUrl), + [0x4D22FF98] = typeof(WebViewResultUrl), [0x0C94511C] = typeof(WebViewMessageSent), [0x7533A588] = null,//BotMenuButtonDefault [0x4258C205] = typeof(BotMenuButtonCommands), @@ -1141,7 +1144,6 @@ namespace TL [0x5DA674B7] = null,//BotAppNotModified [0x95FCD1D6] = typeof(BotApp), [0xEB50ADF5] = typeof(Messages_BotApp), - [0x3C1B4F0D] = typeof(AppWebViewResultUrl), [0xB57295D5] = typeof(InlineBotWebView), [0x4A4FF172] = typeof(ReadParticipantDate), [0xF3E0DA33] = typeof(InputChatlistDialogFilter), @@ -1171,13 +1173,14 @@ namespace TL [0x5881323A] = typeof(InputReplyToStory), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), - [0x03D1EA4E] = typeof(MediaAreaCoordinates), + [0xCFC9E002] = typeof(MediaAreaCoordinates), [0xBE82DB9C] = typeof(MediaAreaVenue), [0xB282217F] = typeof(InputMediaAreaVenue), - [0xDF8B3B22] = typeof(MediaAreaGeoPoint), + [0xCAD5452D] = typeof(MediaAreaGeoPoint), [0x14455871] = typeof(MediaAreaSuggestedReaction), [0x770416AF] = typeof(MediaAreaChannelPost), [0x2271F2BF] = typeof(InputMediaAreaChannelPost), + [0x37381085] = typeof(MediaAreaUrl), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), @@ -1285,9 +1288,18 @@ namespace TL [0x250DBAF8] = typeof(StarsTransactionPeerPremiumBot), [0xE92FD902] = typeof(StarsTransactionPeerFragment), [0xD80DA15D] = typeof(StarsTransactionPeer), + [0x60682812] = typeof(StarsTransactionPeerAds), [0x0BD915C0] = typeof(StarsTopupOption), - [0xCC7079B2] = typeof(StarsTransaction), + [0x2DB5418F] = typeof(StarsTransaction), [0x8CF4EE60] = typeof(Payments_StarsStatus), + [0xE87ACBC0] = typeof(FoundStory), + [0xE2DE7737] = typeof(Stories_FoundStories), + [0xDE4C5D93] = typeof(GeoPointAddress), + [0x79342946] = typeof(StarsRevenueStatus), + [0xC92BB73B] = typeof(Payments_StarsRevenueStats), + [0x1DAB80B7] = typeof(Payments_StarsRevenueWithdrawalUrl), + [0x394E7F21] = typeof(Payments_StarsRevenueAdsAccountUrl), + [0x206AE6D1] = typeof(InputStarsTransaction), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index cde7178..8239a31 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: 181 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 183 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 88c05287be432a74b54155f89767ebf63f6f446c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 6 Jul 2024 15:36:08 +0200 Subject: [PATCH 215/336] Fix HtmlText exception with empty texts --- .github/dev.yml | 2 +- .github/release.yml | 3 +-- src/Services.cs | 16 ++++++++-------- 3 files changed, 10 insertions(+), 11 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index a7c79d4..d3c7729 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.2-dev.$(Rev:r) +name: 4.1.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index fdc5f49..13cedb5 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -62,7 +62,6 @@ stages: { "status": "success", "complete": true, - "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\" - }" + "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\"}" } waitForCompletion: 'false' diff --git a/src/Services.cs b/src/Services.cs index e051ffe..74c5cfc 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -403,7 +403,7 @@ namespace TL prevEntity.length = offset - prevEntity.offset; } } - else if (tag.StartsWith("a href=\"") && tag.EndsWith("\"")) + else if (tag.StartsWith("a href=\"") && tag[^1] == '"') { tag = tag[8..^1]; if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && users?.GetValueOrDefault(user_id)?.access_hash is long hash) @@ -411,7 +411,7 @@ namespace TL else entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); } - else if (tag.StartsWith("code class=\"language-") && tag.EndsWith("\"")) + else if (tag.StartsWith("code class=\"language-") && tag[^1] == '"') { if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; @@ -439,13 +439,13 @@ namespace TL internal static void FixUps(StringBuilder sb, List entities) { - int truncate = 0; - while (char.IsWhiteSpace(sb[^++truncate])); - if (truncate == 1) return; - var len = sb.Length -= --truncate; + int newlen = sb.Length; + while (--newlen >= 0 && char.IsWhiteSpace(sb[newlen])); + if (++newlen == sb.Length) return; + sb.Length = newlen; foreach (var entity in entities) - if (entity.offset + entity.length > len) - entity.length = len - entity.offset; + if (entity.offset + entity.length > newlen) + entity.length = newlen - entity.offset; } /// Converts the (plain text + entities) format used by Telegram messages into an HTML-formatted text From 7643ed5ba43de5049ea72eb5bb8b8e82ad21d5d4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 7 Jul 2024 22:55:12 +0200 Subject: [PATCH 216/336] API Layer 184: MessageActionPaymentRefunded, flag can_view_stars_revenue --- .github/dev.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 202 ++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 97 ++++++++++++------ src/TL.Table.cs | 3 +- src/WTelegramClient.csproj | 2 +- 6 files changed, 236 insertions(+), 72 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index d3c7729..d13b28d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.3-dev.$(Rev:r) +name: 4.1.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 3e0b5b2..a092718 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-183-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-184-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 829557a..bb5144e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1523,6 +1523,7 @@ namespace TL /// Field has a value has_reactions_limit = 0x2000, paid_media_allowed = 0x4000, + can_view_stars_revenue = 0x8000, } /// ID of the channel @@ -1702,6 +1703,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; /// ID of the message public int id; @@ -1717,6 +1719,7 @@ namespace TL [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message [IfFlag(11)] public long via_bot_id; + /// Whether the message was sent by the business bot specified in via_bot_id on behalf of the user. [IfFlag(32)] public long via_business_bot_id; /// Reply information [IfFlag(3)] public MessageReplyHeaderBase reply_to; @@ -1748,6 +1751,7 @@ namespace TL [IfFlag(22)] public RestrictionReason[] restriction_reason; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; + /// If set, this message is a quick reply shortcut message » (note that quick reply shortcut messages sent to a private chat will not have this field set). [IfFlag(30)] public int quick_reply_shortcut_id; [IfFlag(34)] public long effect; [IfFlag(35)] public FactCheck factcheck; @@ -2648,10 +2652,11 @@ namespace TL /// Number of undistributed prizes public int unclaimed_count; } - /// See + /// Some boosts » were applied to the channel or supergroup. See [TLDef(0xCC02AA6D)] public sealed partial class MessageActionBoostApply : MessageAction { + /// Number of applied boosts. public int boosts; } /// See @@ -2661,6 +2666,22 @@ namespace TL public int button_id; public RequestedPeer[] peers; } + /// See + [TLDef(0x41B3E202)] + public sealed partial class MessageActionPaymentRefunded : MessageAction + { + public Flags flags; + public Peer peer; + public string currency; + public long total_amount; + [IfFlag(0)] public byte[] payload; + public PaymentCharge charge; + + [Flags] public enum Flags : uint + { + has_payload = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3130,7 +3151,9 @@ namespace TL [IfFlag(9)] public string request_chat_title; /// If set, this is a private chat with an administrator of a chat or channel to which the user sent a join request, and this field contains the timestamp when the join request » was sent. [IfFlag(9)] public DateTime request_chat_date; + /// Contains the ID of the business bot » managing this chat, used to display info about the bot in the action bar. [IfFlag(13)] public long business_bot_id; + /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; [Flags] public enum Flags : uint @@ -3157,7 +3180,9 @@ namespace TL has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, + /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. business_bot_paused = 0x800, + /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. business_bot_can_reply = 0x1000, /// Fields and have a value has_business_bot_id = 0x2000, @@ -3312,7 +3337,9 @@ namespace TL [IfFlag(35)] public BusinessAwayMessage business_away_message; [IfFlag(36)] public BusinessIntro business_intro; [IfFlag(37)] public Birthday birthday; + /// ID of the associated personal channel », that should be shown in the profile page. [IfFlag(38)] public long personal_channel_id; + /// ID of the latest message of the associated personal channel », that should be previewed in the profile page. [IfFlag(38)] public int personal_channel_message; [Flags] public enum Flags : uint @@ -5080,7 +5107,7 @@ namespace TL has_order = 0x1, } } - /// User information was updated, it must be refetched using Users_GetFullUser. See + /// User ( and/or ) information was updated, it must be refetched using Users_GetFullUser. See [TLDef(0x20529438)] public partial class UpdateUser : Update { @@ -5242,7 +5269,7 @@ namespace TL has_order = 0x1, } } - /// See + /// The list of reaction tag » names assigned by the user has changed and should be refetched using Messages_GetSavedReactionTags. See [TLDef(0x39C67432)] public sealed partial class UpdateSavedReactionTags : Update { } /// See @@ -5251,34 +5278,39 @@ namespace TL { public string job_id; } - /// See + /// Info about or the order of quick reply shortcuts » was changed. See [TLDef(0xF9470AB2)] public sealed partial class UpdateQuickReplies : Update { + /// New quick reply shortcut order and information. public QuickReply[] quick_replies; } - /// See + /// A new quick reply shortcut » was created. See [TLDef(0xF53DA717)] public sealed partial class UpdateNewQuickReply : Update { + /// Quick reply shortcut. public QuickReply quick_reply; } - /// See + /// A quick reply shortcut » was deleted. This will not emit updates, even if all the messages in the shortcut are also deleted by this update. See [TLDef(0x53E6F1EC)] public partial class UpdateDeleteQuickReply : Update { + /// ID of the quick reply shortcut that was deleted. public int shortcut_id; } - /// See + /// A new message was added to a quick reply shortcut ». See [TLDef(0x3E050D0F)] public sealed partial class UpdateQuickReplyMessage : Update { + /// The message that was added (the .quick_reply_shortcut_id field will contain the shortcut ID). public MessageBase message; } - /// See + /// One or more messages in a quick reply shortcut » were deleted. See [TLDef(0x566FE7CD, inheritBefore = true)] public sealed partial class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply { + /// IDs of the deleted messages. public int[] messages; } /// See @@ -6524,7 +6556,7 @@ namespace TL VoiceMessages = 0xAEE69D68, ///Whether people can see your bio About = 0x3823CC40, - ///See + ///Whether the user can see our birthday. Birthday = 0xD65A11CC, } @@ -6551,7 +6583,7 @@ namespace TL VoiceMessages = 0x0697F414, ///Whether people can see your bio About = 0xA486B761, - ///See + ///Whether the user can see our birthday. Birthday = 0x2000A518, } @@ -7366,6 +7398,7 @@ namespace TL text_color = 0x200, /// If set, this custom emoji stickerset can be used in channel/supergroup emoji statuses. channel_emoji_status = 0x400, + /// Whether we created this stickerset creator = 0x800, } } @@ -7818,6 +7851,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether the quote is collapsed by default. collapsed = 0x1, } } @@ -9064,12 +9098,13 @@ namespace TL has_play_integrity_project_id = 0x4, } } - /// See + /// The code was sent via SMS as a secret word, starting with the letter specified in beginning See [TLDef(0xA416AC81)] public sealed partial class Auth_SentCodeTypeSmsWord : Auth_SentCodeType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The secret word in the sent SMS (which may contain multiple words) starts with this letter. [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint @@ -9078,12 +9113,13 @@ namespace TL has_beginning = 0x1, } } - /// See + /// The code was sent via SMS as a secret phrase starting with the word specified in beginning, See [TLDef(0xB37794AF)] public sealed partial class Auth_SentCodeTypeSmsPhrase : Auth_SentCodeType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The secret phrase (and the SMS) starts with this word. [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint @@ -11531,7 +11567,7 @@ namespace TL /// New emoji status public EmojiStatus new_value; } - /// See + /// The supergroup's custom emoji stickerset was changed. See [TLDef(0x46D840AB)] public sealed partial class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } @@ -14104,6 +14140,7 @@ namespace TL [TLDef(0x0E5AF939)] public sealed partial class MessageReplyStoryHeader : MessageReplyHeaderBase { + /// Sender of the story. public Peer peer; /// Story ID public int story_id; @@ -14879,6 +14916,7 @@ namespace TL has_recent_reactions = 0x2, /// Whether Messages_GetMessageReactionsList can be used to see how each specific peer reacted to the message can_see_list = 0x4, + /// If set or if there are no reactions, all present and future reactions should be treated as message tags, see here » for more info. reactions_as_tags = 0x8, } } @@ -16380,6 +16418,7 @@ namespace TL public int id; /// When was the story posted. public DateTime date; + /// Sender of the story. [IfFlag(18)] public Peer from_id; /// For reposted stories », contains info about the original story. [IfFlag(17)] public StoryFwdHeader fwd_from; @@ -16497,6 +16536,7 @@ namespace TL public int count; /// Stories public StoryItemBase[] stories; + /// IDs of pinned stories. [IfFlag(0)] public int[] pinned_to_top; /// Mentioned chats public Dictionary chats; @@ -16655,6 +16695,7 @@ namespace TL [TLDef(0x5881323A)] public sealed partial class InputReplyToStory : InputReplyTo { + /// Sender of the story public InputPeer peer; /// ID of the story to reply to. public int story_id; @@ -17462,14 +17503,17 @@ namespace TL public int count; } - /// See + /// Info about a saved message reaction tag ». See [TLDef(0xCB6FF828)] public sealed partial class SavedReactionTag : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Reaction associated to the tag. public Reaction reaction; + /// Custom tag name assigned by the user (max 12 UTF-8 chars). [IfFlag(0)] public string title; + /// Number of messages tagged with this tag. public int count; [Flags] public enum Flags : uint @@ -17479,11 +17523,12 @@ namespace TL } } - /// See + /// List of reaction tag » names assigned by the user. See /// a value means messages.savedReactionTagsNotModified [TLDef(0x3259950A)] public sealed partial class Messages_SavedReactionTags : IObject { + /// Saved reaction tags. public SavedReactionTag[] tags; /// Hash for pagination, for more info click here public long hash; @@ -17498,42 +17543,55 @@ namespace TL /// See Derived classes: public abstract partial class Smsjobs_EligibilityToJoin : IObject { } - /// See + /// SMS jobs eligibility See [TLDef(0xDC8B44CF)] public sealed partial class Smsjobs_EligibleToJoin : Smsjobs_EligibilityToJoin { + /// Terms of service URL public string terms_url; + /// Monthly sent SMSes public int monthly_sent_sms; } - /// See + /// Status See [TLDef(0x2AEE9191)] public sealed partial class Smsjobs_Status : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Recently sent public int recent_sent; + /// Since public int recent_since; + /// Remaining public int recent_remains; + /// Total sent public int total_sent; + /// Total since public int total_since; + /// Last gift deep link [IfFlag(1)] public string last_gift_slug; + /// Terms of service URL public string terms_url; [Flags] public enum Flags : uint { + /// Allow international numbers allow_international = 0x1, /// Field has a value has_last_gift_slug = 0x2, } } - /// See + /// Info about an SMS job. See [TLDef(0xE6A1EEB8)] public sealed partial class SmsJob : IObject { + /// Job ID public string job_id; + /// Destination phone number public string phone_number; + /// Text public string text; } @@ -17565,13 +17623,15 @@ namespace TL } } - /// See + /// Represents the location of a Telegram Business ». See [TLDef(0xAC5C1AF7)] public sealed partial class BusinessLocation : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Geographical coordinates (optional). [IfFlag(0)] public GeoPoint geo_point; + /// Textual description of the address (mandatory). public string address; [Flags] public enum Flags : uint @@ -17715,83 +17775,102 @@ namespace TL } } - /// See + /// Timezone information. See [TLDef(0xFF9289F5)] public sealed partial class Timezone : IObject { + /// Unique timezone ID. public string id; + /// Human-readable and localized timezone name. public string name; + /// UTC offset in seconds, which may be displayed in hh:mm format by the client together with the human-readable name (i.e. $name UTC -01:00). public int utc_offset; } - /// See + /// Timezone information that may be used elsewhere in the API, such as to set Telegram Business opening hours ». See /// a value means help.timezonesListNotModified [TLDef(0x7B74ED71)] public sealed partial class Help_TimezonesList : IObject { + /// Timezones public Timezone[] timezones; /// Hash for pagination, for more info click here public int hash; } - /// See + /// A quick reply shortcut. See [TLDef(0x0697102B)] public sealed partial class QuickReply : IObject { + /// Unique shortcut ID. public int shortcut_id; + /// Shortcut name. public string shortcut; + /// ID of the last message in the shortcut. public int top_message; + /// Total number of messages in the shortcut. public int count; } /// See Derived classes: , public abstract partial class InputQuickReplyShortcutBase : IObject { } - /// See + /// Selects a quick reply shortcut by name. See [TLDef(0x24596D41)] public sealed partial class InputQuickReplyShortcut : InputQuickReplyShortcutBase { + /// Shortcut name. public string shortcut; } - /// See + /// Selects a quick reply shortcut by its numeric ID. See [TLDef(0x01190CF1)] public sealed partial class InputQuickReplyShortcutId : InputQuickReplyShortcutBase { + /// Shortcut ID. public int shortcut_id; } - /// See + /// Info about quick reply shortcuts ». See /// a value means messages.quickRepliesNotModified [TLDef(0xC68D6695)] public sealed partial class Messages_QuickReplies : IObject, IPeerResolver { + /// Quick reply shortcuts. public QuickReply[] quick_replies; + /// Messages mentioned in quick_replies. public MessageBase[] messages; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains info about a connected business bot ». See [TLDef(0xBD068601)] public sealed partial class ConnectedBot : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the connected bot public long bot_id; + /// Specifies the private chats that a connected business bot » may receive messages and interact with.
public BusinessBotRecipients recipients; [Flags] public enum Flags : uint { + /// Whether the the bot can reply to messages it receives through the connection can_reply = 0x1, } } - /// See + /// Info about currently connected business bots. See [TLDef(0x17D7F87B)] public sealed partial class Account_ConnectedBots : IObject { + /// Info about the connected bots public ConnectedBot[] connected_bots; + /// Bot information public Dictionary users; } @@ -17809,14 +17888,17 @@ namespace TL } } - /// See + /// Birthday information for a user. See [TLDef(0x6C8E1E06)] public sealed partial class Birthday : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Birth day public int day; + /// Birth month public int month; + /// (Optional) birth year. [IfFlag(0)] public int year; [Flags] public enum Flags : uint @@ -17826,20 +17908,26 @@ namespace TL } } - /// See + /// Contains info about a bot business connection. See [TLDef(0x896433B4)] public sealed partial class BotBusinessConnection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Business connection ID, used to identify messages coming from the connection and to reply to them as specified here ». public string connection_id; + /// ID of the user that the bot is connected to via this connection. public long user_id; + /// ID of the datacenter where to send queries wrapped in a InvokeWithBusinessConnection as specified here ». public int dc_id; + /// When was the connection created. public DateTime date; [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, } } @@ -17913,100 +18001,125 @@ namespace TL public string url; } - /// See + /// Specifies the private chats that a connected business bot » may interact with. See [TLDef(0xC4E5921E)] public sealed partial class InputBusinessBotRecipients : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Explicitly selected private chats. [IfFlag(4)] public InputUserBase[] users; + /// Identifiers of private chats that are always excluded. [IfFlag(6)] public InputUserBase[] exclude_users; [Flags] public enum Flags : uint { + /// Selects all existing private chats. existing_chats = 0x1, + /// Selects all new private chats. new_chats = 0x2, + /// Selects all private chats with contacts. contacts = 0x4, + /// Selects all private chats with non-contacts. non_contacts = 0x8, /// Field has a value has_users = 0x10, + /// If set, then all private chats except the ones selected by existing_chats, new_chats, contacts, non_contacts and users are chosen.
Note that if this flag is set, any values passed in exclude_users will be merged and moved into users by the server.
exclude_selected = 0x20, /// Field has a value has_exclude_users = 0x40, } } - ///
See + /// Specifies the private chats that a connected business bot » may receive messages and interact with. See [TLDef(0xB88CF373)] public sealed partial class BusinessBotRecipients : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Explicitly selected private chats. [IfFlag(4)] public long[] users; + /// Identifiers of private chats that are always excluded. [IfFlag(6)] public long[] exclude_users; [Flags] public enum Flags : uint { + /// Selects all existing private chats. existing_chats = 0x1, + /// Selects all new private chats. new_chats = 0x2, + /// Selects all private chats with contacts. contacts = 0x4, + /// Selects all private chats with non-contacts. non_contacts = 0x8, /// Field has a value has_users = 0x10, + /// If set, then all private chats except the ones selected by existing_chats, new_chats, contacts, non_contacts and users are chosen.
Note that if this flag is set, any values passed in exclude_users will be merged and moved into users by the server, thus exclude_users will always be empty.
exclude_selected = 0x20, /// Field has a value has_exclude_users = 0x40, } } - ///
See + /// Birthday information of a contact. See [TLDef(0x1D998733)] public sealed partial class ContactBirthday : IObject { + /// User ID. public long contact_id; + /// Birthday information. public Birthday birthday; } - /// See + /// Birthday information of our contacts. See [TLDef(0x114FF30D)] public sealed partial class Contacts_ContactBirthdays : IObject { + /// Birthday info public ContactBirthday[] contacts; + /// User information public Dictionary users; } - /// See + /// Info about why a specific user could not be invited ». See [TLDef(0x628C9224)] public sealed partial class MissingInvitee : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the user. If neither of the flags below are set, we could not add the user because of their privacy settings, and we can create and directly share an invite link with them using a normal message, instead. public long user_id; [Flags] public enum Flags : uint { + /// If set, we could not add the user only because the current account needs to purchase a Telegram Premium subscription to complete the operation. premium_would_allow_invite = 0x1, + /// If set, we could not add the user because of their privacy settings, and additionally, the current account needs to purchase a Telegram Premium subscription to directly share an invite link with the user via a private message. premium_required_for_pm = 0x2, } } - /// See + /// Contains info about successfully or unsuccessfully invited » users. See [TLDef(0x7F5DEFA6)] public sealed partial class Messages_InvitedUsers : IObject { + /// List of updates about successfully invited users (and eventually info about the created group) public UpdatesBase updates; + /// A list of users that could not be invited, along with the reason why they couldn't be invited. public MissingInvitee[] missing_invitees; } - /// See + /// Contains info about a business chat deep link » to be created by the current account. See [TLDef(0x11679FA7)] public sealed partial class InputBusinessChatLink : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Message to pre-fill in the message input field. public string message; /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; + /// Human-readable name of the link, to simplify management in the UI (only visible to the creator of the link). [IfFlag(1)] public string title; [Flags] public enum Flags : uint @@ -18018,17 +18131,21 @@ namespace TL } } - /// See + /// Contains info about a business chat deep link » created by the current account. See [TLDef(0xB4AE666F)] public sealed partial class BusinessChatLink : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Business chat deep link. public string link; + /// Message to pre-fill in the message input field. public string message; /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; + /// Human-readable name of the link, to simplify management in the UI (only visible to the creator of the link). [IfFlag(1)] public string title; + /// Number of times the link was resolved (clicked/scanned/etc...). public int views; [Flags] public enum Flags : uint @@ -18040,28 +18157,35 @@ namespace TL } } - /// See + /// Contains info about business chat deep links » created by the current account. See [TLDef(0xEC43A2D1)] public sealed partial class Account_BusinessChatLinks : IObject, IPeerResolver { + /// Links public BusinessChatLink[] links; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains info about a single resolved business chat deep link ». See [TLDef(0x9A23AF21)] public sealed partial class Account_ResolvedBusinessChatLinks : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Destination peer public Peer peer; + /// Message to pre-fill in the message input field. public string message; /// Message entities for styled text [IfFlag(0)] public MessageEntity[] entities; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index cd6aa33..7c2f62d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -92,7 +92,9 @@ namespace TL query = query, }); - /// See + /// Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor. See + /// Business connection ID. + /// The actual query. public static Task InvokeWithBusinessConnection(this Client client, string connection_id, IMethod query) => client.Invoke(new InvokeWithBusinessConnection { @@ -332,6 +334,7 @@ namespace TL /// Phone number /// Phone code hash returned by Auth_SendCode /// On Android, a JWS object obtained as described in the auth documentation » + /// On Android, an object obtained as described in the auth documentation » /// Secret token received via an apple push notification public static Task Auth_RequestFirebaseSms(this Client client, string phone_number, string phone_code_hash, string safety_net_token = null, string ios_push_secret = null, string play_integrity_token = null) => client.Invoke(new Auth_RequestFirebaseSms @@ -1252,7 +1255,8 @@ namespace TL address = address, }); - /// See + /// Set a list of Telegram Business greeting messages. See + /// Greeting message configuration and contents. public static Task Account_UpdateBusinessGreetingMessage(this Client client, InputBusinessGreetingMessage message = null) => client.Invoke(new Account_UpdateBusinessGreetingMessage { @@ -1260,7 +1264,8 @@ namespace TL message = message, }); - /// See + /// Set a list of Telegram Business away messages. See + /// Away message configuration and contents. public static Task Account_UpdateBusinessAwayMessage(this Client client, InputBusinessAwayMessage message = null) => client.Invoke(new Account_UpdateBusinessAwayMessage { @@ -1268,7 +1273,11 @@ namespace TL message = message, }); - /// See + /// Connect a business bot » to the current account, or to change the current connection settings. See + /// 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) => client.Invoke(new Account_UpdateConnectedBot { @@ -1277,13 +1286,14 @@ namespace TL recipients = recipients, }); - /// See + /// List all currently connected business bots » See public static Task Account_GetConnectedBots(this Client client) => client.Invoke(new Account_GetConnectedBots { }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Bots may invoke this method to re-fetch the associated with a specific business connection_id, see here » for more info on connected business bots.
This is needed for example for freshly logged in bots that are receiving some , etc. updates because some users have already connected to the bot before it could login.
In this case, the bot is receiving messages from the business connection, but it hasn't cached the associated with info about the connection (can it reply to messages? etc.) yet, and cannot receive the old ones because they were sent when the bot wasn't logged into the session yet.
This method can be used to fetch info about a not-yet-cached business connection, and should not be invoked if the info is already cached or to fetch changes, as eventual changes will automatically be sent as new updates to the bot using the usual update delivery methods ». See [bots: ✓] Possible codes: 400 (details)
+ /// Business connection ID ». public static Task Account_GetBotBusinessConnection(this Client client, string connection_id) => client.Invoke(new Account_GetBotBusinessConnection { @@ -1298,7 +1308,9 @@ namespace TL intro = intro, }); - /// See Possible codes: 400 (details) + /// Pause or unpause a specific chat, temporarily disconnecting it from all business bots ». See Possible codes: 400 (details) + /// The chat to pause + /// Whether to pause or unpause the chat public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused) => client.Invoke(new Account_ToggleConnectedBotPaused { @@ -1306,14 +1318,16 @@ namespace TL paused = paused, }); - /// See Possible codes: 400 (details) + /// Permanently disconnect a specific chat from all business bots » (equivalent to specifying it in recipients.exclude_users during initial configuration with Account_UpdateConnectedBot); to reconnect of a chat disconnected using this method the user must reconnect the entire bot by invoking Account_UpdateConnectedBot. See Possible codes: 400 (details) + /// The chat to disconnect public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer) => client.Invoke(new Account_DisablePeerConnectedBot { peer = peer, }); - /// See + /// Update our birthday, see here » for more info. See + /// Birthday. public static Task Account_UpdateBirthday(this Client client, Birthday birthday = null) => client.Invoke(new Account_UpdateBirthday { @@ -1321,14 +1335,17 @@ namespace TL birthday = birthday, }); - /// See + /// Create a business chat deep link ». See + /// Info about the link to create. public static Task Account_CreateBusinessChatLink(this Client client, InputBusinessChatLink link) => client.Invoke(new Account_CreateBusinessChatLink { link = link, }); - /// See Possible codes: 400 (details) + /// Edit a created business chat deep link ». See Possible codes: 400 (details) + /// Slug of the link, obtained as specified here ». + /// New link information. public static Task Account_EditBusinessChatLink(this Client client, string slug, InputBusinessChatLink link) => client.Invoke(new Account_EditBusinessChatLink { @@ -1336,27 +1353,30 @@ namespace TL link = link, }); - /// See Possible codes: 400 (details) + /// Delete a business chat deep link ». See Possible codes: 400 (details) + /// Slug of the link, obtained as specified here ». public static Task Account_DeleteBusinessChatLink(this Client client, string slug) => client.Invoke(new Account_DeleteBusinessChatLink { slug = slug, }); - /// See + /// List all created business chat deep links ». See public static Task Account_GetBusinessChatLinks(this Client client) => client.Invoke(new Account_GetBusinessChatLinks { }); - /// See Possible codes: 400 (details) + /// Resolve a business chat deep link ». See Possible codes: 400 (details) + /// Slug of the link, obtained as specified here ». public static Task Account_ResolveBusinessChatLink(this Client client, string slug) => client.Invoke(new Account_ResolveBusinessChatLink { slug = slug, }); - /// See + /// Associate (or remove) a personal channel », that will be listed on our personal profile page ». See + /// The channel, pass to remove it. public static Task Account_UpdatePersonalChannel(this Client client, InputChannelBase channel) => client.Invoke(new Account_UpdatePersonalChannel { @@ -1656,7 +1676,7 @@ namespace TL limit = limit, }); - /// See + /// Fetch all users with birthdays that fall within +1/-1 days, relative to the current day: this method should be invoked by clients every 6-8 hours, and if the result is non-empty, it should be used to appropriately update locally cached birthday information in .birthday. See public static Task Contacts_GetBirthdays(this Client client) => client.Invoke(new Contacts_GetBirthdays { @@ -1822,6 +1842,7 @@ namespace TL /// Message entities for sending styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer + /// Add the message to the specified quick reply shortcut », instead. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMessage { @@ -1854,6 +1875,7 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// Send this message as the specified peer + /// Add the message to the specified quick reply shortcut », instead. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMedia { @@ -1885,6 +1907,7 @@ namespace TL /// Destination forum topic /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer + /// Add the messages to the specified quick reply shortcut », instead. public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) => client.Invoke(new Messages_ForwardMessages { @@ -2389,6 +2412,7 @@ namespace TL /// Result ID from Messages_GetInlineBotResults /// Scheduled message date for scheduled messages /// Send this message as the specified peer + /// Add the message to the specified quick reply shortcut », instead. public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { @@ -2423,6 +2447,7 @@ namespace TL /// Reply markup for inline keyboards /// Message entities for styled text /// Scheduled message date for scheduled messages + /// If specified, edits a quick reply shortcut message, instead ». public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditMessage { @@ -2731,6 +2756,7 @@ namespace TL }); /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Whether the media will be used only in the specified business connection », and not directly by the bot. /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -2830,6 +2856,7 @@ namespace TL /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. /// Scheduled message date for scheduled messages /// Send this message as the specified peer + /// Add the message to the specified quick reply shortcut », instead. public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMultiMedia { @@ -4133,7 +4160,9 @@ namespace TL shortcut_id = shortcut_id, }); - /// 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
See Possible codes: 400 (details)
+ /// 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
Fetch (a subset or all) messages in a quick reply shortcut ». See Possible codes: 400 (details)
+ /// Quick reply shortcut ID. + /// IDs of the messages to fetch, if empty fetches all of them. /// Hash for pagination, for more info click here public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) => client.Invoke(new Messages_GetQuickReplyMessages @@ -4144,8 +4173,11 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) - /// You can use + /// Send a quick reply shortcut ». See Possible codes: 400 (details) + /// The peer where to send the shortcut (users only, for now). + /// The ID of the quick reply shortcut to send. + /// Specify a subset of messages from the shortcut to send; if empty, defaults to all of them. + /// Unique client IDs required to prevent message resending, one for each message we're sending, may be empty (but not recommended). You can use public static Task Messages_SendQuickReplyMessages(this Client client, InputPeer peer, int shortcut_id, int[] id, params long[] random_id) => client.Invoke(new Messages_SendQuickReplyMessages { @@ -4625,7 +4657,7 @@ namespace TL hash = hash, }); - /// See + /// Returns timezone information that may be used elsewhere in the API, such as to set Telegram Business opening hours ». See /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.timezonesListNotModified public static Task Help_GetTimezonesList(this Client client, int hash = default) @@ -5296,7 +5328,9 @@ namespace TL boosts = boosts, }); - /// See Possible codes: 400 (details) + /// Set a custom emoji stickerset for supergroups. Only usable after reaching at least the boost level » specified in the group_emoji_stickers_level_min » config parameter. See Possible codes: 400 (details) + /// The supergroup + /// The custom emoji stickerset to associate to the supergroup public static Task Channels_SetEmojiStickers(this Client client, InputChannelBase channel, InputStickerSet stickerset) => client.Invoke(new Channels_SetEmojiStickers { @@ -5848,7 +5882,9 @@ namespace TL stickerset = stickerset, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Replace a sticker in a stickerset ». See [bots: ✓] Possible codes: 400 (details) + /// Old sticker document. + /// New sticker. /// a null value means messages.stickerSetNotModified public static Task Stickers_ReplaceSticker(this Client client, InputDocument sticker, InputStickerSetItem new_sticker) => client.Invoke(new Stickers_ReplaceSticker @@ -6843,45 +6879,48 @@ namespace TL user_id = user_id, }); - /// See Possible codes: 403 (details) + /// Check if we can process SMS jobs (official clients only). See Possible codes: 403 (details) public static Task Smsjobs_IsEligibleToJoin(this Client client) => client.Invoke(new Smsjobs_IsEligibleToJoin { }); - /// See Possible codes: 400 (details) + /// Enable SMS jobs (official clients only). See Possible codes: 400 (details) public static Task Smsjobs_Join(this Client client) => client.Invoke(new Smsjobs_Join { }); - /// See Possible codes: 400 (details) + /// Disable SMS jobs (official clients only). See Possible codes: 400 (details) public static Task Smsjobs_Leave(this Client client) => client.Invoke(new Smsjobs_Leave { }); - /// See Possible codes: 400 (details) + /// Update SMS job settings (official clients only). See Possible codes: 400 (details) + /// Allow international numbers? public static Task Smsjobs_UpdateSettings(this Client client, bool allow_international = false) => client.Invoke(new Smsjobs_UpdateSettings { flags = (Smsjobs_UpdateSettings.Flags)(allow_international ? 0x1 : 0), }); - /// See Possible codes: 400 (details) + /// Get SMS jobs status (official clients only). See Possible codes: 400 (details) public static Task Smsjobs_GetStatus(this Client client) => client.Invoke(new Smsjobs_GetStatus { }); - /// See Possible codes: 400 (details) + /// Get info about an SMS job (official clients only). See Possible codes: 400 (details) public static Task Smsjobs_GetSmsJob(this Client client, string job_id) => client.Invoke(new Smsjobs_GetSmsJob { job_id = job_id, }); - /// See Possible codes: 400 (details) + /// Finish an SMS job (official clients only). See Possible codes: 400 (details) + /// Job ID. + /// If failed, the error. public static Task Smsjobs_FinishJob(this Client client, string job_id, string error = null) => client.Invoke(new Smsjobs_FinishJob { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9e04c7e..af84daf 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 = 183; // fetched 01/07/2024 23:00:22 + public const int Version = 184; // fetched 07/07/2024 20:50:35 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -209,6 +209,7 @@ namespace TL [0x2A9FADC5] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), [0x93B31848] = typeof(MessageActionRequestedPeerSentMe), + [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8239a31..c8d1dcc 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: 183 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 184 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 4946322045610722aa8acc0c1f166e2a2cc3dca5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 12 Jul 2024 14:34:30 +0200 Subject: [PATCH 217/336] No need to escape MarkdownV2 chars in code sections --- .github/dev.yml | 2 +- FAQ.md | 6 ++++-- README.md | 8 +++++--- src/Services.cs | 3 ++- src/UpdateManager.cs | 2 +- 5 files changed, 13 insertions(+), 8 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index d13b28d..542e9d0 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.4-dev.$(Rev:r) +name: 4.1.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index c6d398d..8a5a040 100644 --- a/FAQ.md +++ b/FAQ.md @@ -59,8 +59,9 @@ You also need to obtain their `access_hash` which is specific to the resource yo This serves as a proof that the logged-in user is entitled to access that channel/user/photo/document/... (otherwise, anybody with the ID could access it) +> [!IMPORTANT] > A small private group `Chat` don't need an access_hash and can be queried using their `chat_id` only. -However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). +However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. The `access_hash` must usually be provided within the `Input...` structure you pass in argument to an API method (`InputPeer`, `InputChannel`, `InputUser`, etc...). @@ -108,7 +109,8 @@ To fix this, you should also switch to using the [WTelegramClient Nuget package] You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos), or the [API Terms of Service](https://core.telegram.org/api/terms), or make excessive requests. You can try to wait more between the requests, wait for a day or two to see if the requests become possible again. ->ℹ️ For FLOOD_WAIT_X with X < 60 seconds (see `client.FloodRetryThreshold`), WTelegramClient will automatically wait the specified delay and retry the request for you. +> [!NOTE] +> For FLOOD_WAIT_X with X < 60 seconds (see `client.FloodRetryThreshold`), WTelegramClient will automatically wait the specified delay and retry the request for you. For longer delays, you can catch the thrown `RpcException` and check the value of property X. An account that was restricted due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. diff --git a/README.md b/README.md index a092718..dba86c5 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,9 @@ All the Telegram Client APIs (MTProto) are supported so you can do everything th This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. ->⚠️ This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... ->If you are a beginner in C#, starting a project based on this library might not be a great idea. +> [!IMPORTANT] +> This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... +> If you are a beginner in C#, starting a project based on this library might not be a great idea. # How to use @@ -114,7 +115,8 @@ See [WinForms example](https://wiz0u.github.io/WTelegramClient/Examples/WinForms # Example of API call ->ℹ️ The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes +> [!NOTE] +> The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) All the Telegram API classes/methods are fully documented through Intellisense: Place your mouse over a class/method name, diff --git a/src/Services.cs b/src/Services.cs index 74c5cfc..16be5c9 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -297,7 +297,8 @@ namespace TL { case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': - sb.Insert(i++, '\\'); + if (closings.Count == 0 || closings[0].md[0] != '`') + sb.Insert(i++, '\\'); break; } } diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 5bf0b0e..b9ee9db 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -9,7 +9,7 @@ using TL; namespace WTelegram { - public class UpdateManager : IPeerResolver + public class UpdateManager { /// Collected info about Users (only if using the default collector) public readonly Dictionary Users; From d5101b4f3b9a380a3ca43ebf1fac39163a9a05ba Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 20 Jul 2024 02:06:40 +0200 Subject: [PATCH 218/336] No need to escape MarkdownV2 chars in code sections --- README.md | 4 +--- src/Services.cs | 8 +++++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index dba86c5..a3e0daf 100644 --- a/README.md +++ b/README.md @@ -10,8 +10,7 @@ All the Telegram Client APIs (MTProto) are supported so you can do everything th This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. -> [!IMPORTANT] -> This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... +> ⚠️ This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... > If you are a beginner in C#, starting a project based on this library might not be a great idea. # How to use @@ -115,7 +114,6 @@ See [WinForms example](https://wiz0u.github.io/WTelegramClient/Examples/WinForms # Example of API call -> [!NOTE] > The Telegram API makes extensive usage of base and derived classes, so be ready to use the various C# syntaxes to check/cast base classes into the more useful derived classes (`is`, `as`, `case DerivedType` ) diff --git a/src/Services.cs b/src/Services.cs index 16be5c9..9c9730b 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -295,10 +295,12 @@ namespace TL } switch (lastCh = sb[i]) { - case '_': case '*': case '~': case '`': case '#': case '+': case '-': case '=': case '.': case '!': + case '_': case '*': case '~': case '#': case '+': case '-': case '=': case '.': case '!': case '[': case ']': case '(': case ')': case '{': case '}': case '>': case '|': case '\\': - if (closings.Count == 0 || closings[0].md[0] != '`') - sb.Insert(i++, '\\'); + if (closings.Count != 0 && closings[0].md[0] == '`') break; + goto case '`'; + case '`': + sb.Insert(i++, '\\'); break; } } From f7b3a56ce3d028a5d2e7dfeb04c1105b4ec4e9d4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 20 Jul 2024 02:10:39 +0200 Subject: [PATCH 219/336] api doc --- src/TL.Schema.cs | 422 ++++++++++++++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 221 +++++++++++++--------- src/TL.Table.cs | 2 +- 3 files changed, 445 insertions(+), 200 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index bb5144e..9eb400e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -694,7 +694,7 @@ namespace TL } } - /// Chat partner or group. See Derived classes: , , + /// Identifier of a private chat, basic group, group or channel (see here » for more info). See Derived classes: , , public abstract partial class Peer : IObject { } /// Chat partner See [TLDef(0x59511722)] @@ -873,7 +873,9 @@ namespace TL has_color = 0x100, /// Field has a value has_profile_color = 0x200, + /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
contact_require_premium = 0x400, + /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, } } @@ -1231,6 +1233,7 @@ namespace TL public virtual long[] RecentRequesters => default; /// Allowed message reactions » public virtual ChatReactions AvailableReactions => default; + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max). public virtual int ReactionsLimit => default; } /// Full info about a basic group. See @@ -1271,6 +1274,7 @@ namespace TL [IfFlag(17)] public long[] recent_requesters; /// Allowed message reactions » [IfFlag(18)] public ChatReactions available_reactions; + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max). [IfFlag(20)] public int reactions_limit; [Flags] public enum Flags : uint @@ -1337,6 +1341,7 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max). public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See @@ -1417,6 +1422,7 @@ namespace TL [IfFlag(29)] public Peer default_send_as; /// Allowed message reactions » [IfFlag(30)] public ChatReactions available_reactions; + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max). [IfFlag(45)] public int reactions_limit; /// Channel stories [IfFlag(36)] public PeerStories stories; @@ -1424,6 +1430,7 @@ namespace TL [IfFlag(39)] public WallPaperBase wallpaper; /// The number of boosts the current user has applied to the current supergroup. [IfFlag(40)] public int boosts_applied; + /// The number of boosts this supergroup requires to bypass slowmode and other restrictions, see here » for more info. [IfFlag(41)] public int boosts_unrestrict; /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; @@ -1518,7 +1525,9 @@ namespace TL has_boosts_unrestrict = 0x200, /// Field has a value has_emojiset = 0x400, + /// Whether ads on this channel were disabled as specified here » (this flag is only visible to the owner of the channel). restricted_sponsored = 0x800, + /// If set, this user can view ad revenue statistics » for this channel. can_view_revenue = 0x1000, /// Field has a value has_reactions_limit = 0x2000, @@ -1556,6 +1565,7 @@ namespace TL public override long[] RecentRequesters => recent_requesters; /// Allowed message reactions » public override ChatReactions AvailableReactions => available_reactions; + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max). public override int ReactionsLimit => reactions_limit; } @@ -1751,9 +1761,11 @@ namespace TL [IfFlag(22)] public RestrictionReason[] restriction_reason; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; - /// If set, this message is a quick reply shortcut message » (note that quick reply shortcut messages sent to a private chat will not have this field set). + /// If set, this message is a quick reply shortcut message » (note that quick reply shortcut messages sent to a private chat will not have this field set). [IfFlag(30)] public int quick_reply_shortcut_id; + /// A message effect that should be played as specified here ». [IfFlag(34)] public long effect; + /// Represents a fact-check ». [IfFlag(35)] public FactCheck factcheck; [Flags] public enum Flags : uint @@ -1822,6 +1834,7 @@ namespace TL { /// Field has a value has_via_business_bot_id = 0x1, + /// If set, the message was sent because of a scheduled action by the message sender, for example, as away, or a greeting service message. offline = 0x2, /// Field has a value has_effect = 0x4, @@ -2581,7 +2594,7 @@ namespace TL /// The photo that the user suggested we set as profile picture. public PhotoBase photo; } - /// Contains info about one or more peers that the user shared with the bot after clicking on a button. See + /// Contains info about one or more peers that the we (the user) shared with the bot after clicking on a button (service message sent by the user). See [TLDef(0x31518E9B)] public sealed partial class MessageActionRequestedPeer : MessageAction { @@ -2659,11 +2672,13 @@ namespace TL /// Number of applied boosts. public int boosts; } - /// See + /// Contains info about one or more peers that the a user shared with the me (the bot) after clicking on a button (service message received by the bot). See [TLDef(0x93B31848)] public sealed partial class MessageActionRequestedPeerSentMe : MessageAction { + /// button_id contained in the public int button_id; + /// Info about the shared peers. public RequestedPeer[] peers; } /// See @@ -3180,9 +3195,9 @@ namespace TL has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. business_bot_paused = 0x800, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. business_bot_can_reply = 0x1000, /// Fields and have a value has_business_bot_id = 0x2000, @@ -3331,11 +3346,17 @@ namespace TL [IfFlag(24)] public WallPaperBase wallpaper; /// Active stories » [IfFlag(25)] public PeerStories stories; + /// Telegram Business working hours ». [IfFlag(32)] public BusinessWorkHours business_work_hours; + /// Telegram Business location ». [IfFlag(33)] public BusinessLocation business_location; + /// Telegram Business greeting message ». [IfFlag(34)] public BusinessGreetingMessage business_greeting_message; + /// Telegram Business away message ». [IfFlag(35)] public BusinessAwayMessage business_away_message; + /// Specifies a custom Telegram Business profile introduction ». [IfFlag(36)] public BusinessIntro business_intro; + /// Contains info about the user's birthday ». [IfFlag(37)] public Birthday birthday; /// ID of the associated personal channel », that should be shown in the profile page. [IfFlag(38)] public long personal_channel_id; @@ -3398,7 +3419,7 @@ namespace TL wallpaper_overridden = 0x10000000, /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
contact_require_premium = 0x20000000, - /// If set, we cannot fetch the exact read date of messages we send to this user using Messages_GetOutboxReadDate.
The exact read date of messages might still be unavailable for other reasons, see here » for more info.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.hide_read_marks flag.
+ /// If set, we cannot fetch the exact read date of messages we send to this user using Messages_GetOutboxReadDate.
The exact read date of messages might still be unavailable for other reasons, see Messages_GetOutboxReadDate for more info.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.hide_read_marks flag.
read_dates_private = 0x40000000, } @@ -3418,6 +3439,7 @@ namespace TL has_birthday = 0x20, /// Fields and have a value has_personal_channel_id = 0x40, + /// Whether ads were re-enabled for the current account (only accessible to the currently logged-in user), see here » for more info. sponsored_enabled = 0x80, } } @@ -3824,7 +3846,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Authorization date [IfFlag(0)] public DateTime date; @@ -4325,7 +4347,7 @@ namespace TL /// The recent sticker list was updated See [TLDef(0x9A422C20)] public sealed partial class UpdateRecentStickers : Update { } - /// The server-side configuration has changed; the client should re-fetch the config using Help_GetConfig See + /// The server-side configuration has changed; the client should re-fetch the config using Help_GetConfig and Help_GetAppConfig. See [TLDef(0xA229DD06)] public sealed partial class UpdateConfig : Update { } /// Common message box sequence PTS has changed, state has to be refetched using updates.getState See @@ -5272,10 +5294,11 @@ namespace TL /// The list of reaction tag » names assigned by the user has changed and should be refetched using Messages_GetSavedReactionTags. See [TLDef(0x39C67432)] public sealed partial class UpdateSavedReactionTags : Update { } - /// See + /// A new SMS job was received See [TLDef(0xF16269D4)] public sealed partial class UpdateSmsJob : Update { + /// SMS job ID public string job_id; } /// Info about or the order of quick reply shortcuts » was changed. See @@ -5313,24 +5336,30 @@ namespace TL /// IDs of the deleted messages. public int[] messages; } - /// See + /// Connecting or disconnecting a business bot or changing the connection settings will emit an update to the bot, with the new settings and a connection_id that will be used by the bot to handle updates from and send messages as the user. See [TLDef(0x8AE5C97A)] public sealed partial class UpdateBotBusinessConnect : Update { + /// Business connection settings public BotBusinessConnection connection; + /// New qts value, see updates » for more info. public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] public sealed partial class UpdateBotNewBusinessMessage : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Connection ID. public string connection_id; + /// New message. public MessageBase message; + /// The message that message is replying to. [IfFlag(0)] public MessageBase reply_to_message; + /// New qts value, see updates » for more info. public int qts; [Flags] public enum Flags : uint @@ -5341,15 +5370,19 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] public sealed partial class UpdateBotEditBusinessMessage : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Business connection ID public string connection_id; + /// New message. public MessageBase message; + /// The message that message is replying to. [IfFlag(0)] public MessageBase reply_to_message; + /// New qts value, see updates » for more info. public int qts; [Flags] public enum Flags : uint @@ -5360,36 +5393,45 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] public sealed partial class UpdateBotDeleteBusinessMessage : Update { + /// Business connection ID. public string connection_id; + /// Peer where the messages were deleted. public Peer peer; + /// IDs of the messages that were deleted. public int[] messages; + /// New qts value, see updates » for more info. public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// Represents a new reaction to a story. See [TLDef(0x1824E40B)] public sealed partial class UpdateNewStoryReaction : Update { + /// Story ID. public int story_id; public Peer peer; + /// The reaction. public Reaction reaction; } - /// See + /// A new channel ad revenue transaction was made, see here » for more info. See [TLDef(0xDFD961F5)] public sealed partial class UpdateBroadcastRevenueTransactions : Update { + /// Channel public Peer peer; + /// New ad revenue balance. public BroadcastRevenueBalances balances; } - /// See + /// The current account's Telegram Stars balance » has changed. See [TLDef(0x0FB85198)] public sealed partial class UpdateStarsBalance : Update { + /// New balance. public long balance; } /// See @@ -6632,7 +6674,7 @@ namespace TL /// Allow only close friends » See [TLDef(0x2F453E49)] public sealed partial class InputPrivacyValueAllowCloseFriends : InputPrivacyRule { } - /// See + /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0x77CDC9F1)] public sealed partial class InputPrivacyValueAllowPremium : InputPrivacyRule { } @@ -6681,7 +6723,7 @@ namespace TL /// Allow only close friends » See [TLDef(0xF7E8D89B)] public sealed partial class PrivacyValueAllowCloseFriends : PrivacyRule { } - /// See + /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0xECE9814B)] public sealed partial class PrivacyValueAllowPremium : PrivacyRule { } @@ -6831,7 +6873,7 @@ namespace TL [TLDef(0x30A6EC7E)] public sealed partial class Messages_Stickers : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Stickers public DocumentBase[] stickers; @@ -6852,7 +6894,7 @@ namespace TL [TLDef(0xCDBBCEBB)] public sealed partial class Messages_AllStickers : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// All stickersets public StickerSet[] sets; @@ -6934,9 +6976,9 @@ namespace TL public string url; /// Webpage URL to be displayed to the user public string display_url; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else + /// Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else, see here » for a full list. [IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7655,27 +7697,35 @@ namespace TL public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; - /// Maximum number of peers that can be chosne. + /// Maximum number of peers that can be chosen. public int max_quantity; } - /// See + /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer. See [TLDef(0xC9662D05)] public sealed partial class InputKeyboardButtonRequestPeer : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Button text public string text; + /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; + /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; + /// Maximum number of peers that can be chosen. public int max_quantity; [Flags] public enum Flags : uint { + /// Set this flag to request the peer's name. name_requested = 0x1, + /// Set this flag to request the peer's @username (if any). username_requested = 0x2, + /// Set this flag to request the peer's photo (if any). photo_requested = 0x4, } + /// Button text public override string Text => text; } @@ -8241,7 +8291,7 @@ namespace TL [TLDef(0x84A02A0D)] public sealed partial class Messages_SavedGifs : IObject { - ///
Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// List of saved gifs public DocumentBase[] gifs; @@ -9082,6 +9132,7 @@ namespace TL /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; [IfFlag(2)] public long play_integrity_project_id; + /// Play Integrity API nonce [IfFlag(2)] public byte[] play_integrity_nonce; /// On iOS, must be compared with the receipt extracted from the received push notification. [IfFlag(1)] public string receipt; @@ -9104,7 +9155,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The secret word in the sent SMS (which may contain multiple words) starts with this letter. + /// If set, the secret word in the sent SMS (which may contain multiple words) starts with this letter. [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint @@ -9113,13 +9164,13 @@ namespace TL has_beginning = 0x1, } } - /// The code was sent via SMS as a secret phrase starting with the word specified in beginning, See + /// The code was sent via SMS as a secret phrase starting with the word specified in beginning See [TLDef(0xB37794AF)] public sealed partial class Auth_SentCodeTypeSmsPhrase : Auth_SentCodeType { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The secret phrase (and the SMS) starts with this word. + /// If set, the secret phrase (and the SMS) starts with this word. [IfFlag(0)] public string beginning; [Flags] public enum Flags : uint @@ -9372,7 +9423,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Total number of featured stickers public int count; @@ -9393,7 +9444,7 @@ namespace TL [TLDef(0x88D37C56)] public sealed partial class Messages_RecentStickers : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Emojis associated to stickers public StickerPack[] packs; @@ -10388,18 +10439,25 @@ namespace TL /// Users public override Dictionary Users => users; } - /// See + /// Represents a payment form, for payments to be using Telegram Stars, see here » for more info. See [TLDef(0x7BF6B15C)] public sealed partial class Payments_PaymentFormStars : Payments_PaymentFormBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Form ID. public long form_id; + /// Bot ID. public long bot_id; + /// Form title public string title; + /// Description public string description; + /// Product photo [IfFlag(5)] public WebDocumentBase photo; + /// Invoice public Invoice invoice; + /// Info about users mentioned in the other fields. public Dictionary users; [Flags] public enum Flags : uint @@ -10408,12 +10466,19 @@ namespace TL has_photo = 0x20, } + /// Form ID. public override long FormId => form_id; + /// Bot ID. public override long BotId => bot_id; + /// Form title public override string Title => title; + /// Description public override string Description => description; + /// Product photo public override WebDocumentBase Photo => photo; + /// Invoice public override Invoice Invoice => invoice; + /// Info about users mentioned in the other fields. public override Dictionary Users => users; } @@ -10542,21 +10607,29 @@ namespace TL /// Users public override Dictionary Users => users; } - /// See + /// Receipt for payment made using Telegram Stars. See [TLDef(0xDABBF83A)] public sealed partial class Payments_PaymentReceiptStars : Payments_PaymentReceiptBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Date of generation public DateTime date; + /// Bot ID public long bot_id; + /// Title public string title; + /// Description public string description; + /// Product photo [IfFlag(2)] public WebDocumentBase photo; + /// Invoice public Invoice invoice; public string currency; public long total_amount; + /// Transaction ID public string transaction_id; + /// Info about users mentioned in the other fields. public Dictionary users; [Flags] public enum Flags : uint @@ -10565,14 +10638,21 @@ namespace TL has_photo = 0x4, } + /// Date of generation public override DateTime Date => date; + /// Bot ID public override long BotId => bot_id; + /// Title public override string Title => title; + /// Description public override string Description => description; + /// Product photo public override WebDocumentBase Photo => photo; + /// Invoice public override Invoice Invoice => invoice; public override string Currency => currency; public override long TotalAmount => total_amount; + /// Info about users mentioned in the other fields. public override Dictionary Users => users; } @@ -10865,6 +10945,7 @@ namespace TL public PhoneConnectionBase[] connections; /// When was the call actually started public DateTime start_date; + /// Custom JSON-encoded call parameters to be passed to tgcalls. [IfFlag(7)] public DataJSON custom_parameters; [Flags] public enum Flags : uint @@ -11662,7 +11743,7 @@ namespace TL [TLDef(0x2CB51097)] public sealed partial class Messages_FavedStickers : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Emojis associated to stickers public StickerPack[] packs; @@ -11846,7 +11927,7 @@ namespace TL [TLDef(0x8AF09DD2)] public sealed partial class Messages_FoundStickerSets : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Found stickersets public StickerSetCoveredBase[] sets; @@ -12421,7 +12502,7 @@ namespace TL [TLDef(0xA098D6AF)] public sealed partial class Help_PassportConfig : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; /// Localization public DataJSON countries_langs; @@ -12675,7 +12756,7 @@ namespace TL [TLDef(0xFF16E2CA)] public sealed partial class PollAnswer : IObject { - /// Textual representation of the answer + /// Textual representation of the answer (Premium users only, only custom emoji entities are supported). public TextWithEntities text; /// The param that has to be passed to Messages_SendVote. public byte[] option; @@ -12689,7 +12770,7 @@ namespace TL public long id; /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The question of the poll + /// The question of the poll (Premium users only, only custom emoji entities are supported). public TextWithEntities question; /// The possible answers, vote using Messages_SendVote. public PollAnswer[] answers; @@ -12910,7 +12991,7 @@ namespace TL [TLDef(0xCDC3858C)] public sealed partial class Account_WallPapers : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Wallpapers public WallPaperBase[] wallpapers; @@ -12945,6 +13026,7 @@ namespace TL allow_firebase = 0x80, /// Fields and have a value has_token = 0x100, + /// Set this flag if there is a SIM card in the current device, but it is not possible to check whether the specified phone number matches the SIM's phone number. unknown_number = 0x200, } } @@ -13292,7 +13374,7 @@ namespace TL [TLDef(0x9A3D8C6D)] public sealed partial class Account_Themes : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Themes public Theme[] themes; @@ -13473,17 +13555,20 @@ namespace TL has_story = 0x1, } } - /// See + /// Contains info about a stickerset », for a preview of a stickerset deep link » (the will have a type of telegram_stickerset). See [TLDef(0x50CC03D3)] public sealed partial class WebPageAttributeStickerSet : WebPageAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// A subset of the stickerset in the stickerset. public DocumentBase[] stickers; [Flags] public enum Flags : uint { + /// Whether this i s a custom emoji stickerset. emojis = 0x1, + /// Whether the color of this TGS custom emoji stickerset should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. text_color = 0x2, } } @@ -13544,6 +13629,7 @@ namespace TL public virtual string Title => default; /// Emoji to use as icon for the folder. public virtual string Emoticon => default; + /// A color ID for the folder tag associated to this folder, see here » for more info. public virtual int Color => default; /// Pinned chats, folders can have unlimited pinned chats public virtual InputPeer[] PinnedPeers => default; @@ -13562,6 +13648,7 @@ namespace TL public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; + /// A color ID for the folder tag associated to this folder, see here » for more info. [IfFlag(27)] public int color; /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; @@ -13600,6 +13687,7 @@ namespace TL public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; + /// A color ID for the folder tag associated to this folder, see here » for more info. public override int Color => color; /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; @@ -13618,6 +13706,7 @@ namespace TL public string title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; + /// A color ID for the folder tag associated to this folder, see here » for more info. [IfFlag(27)] public int color; /// Pinned chats, folders can have unlimited pinned chats public InputPeer[] pinned_peers; @@ -13640,6 +13729,7 @@ namespace TL public override string Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; + /// A color ID for the folder tag associated to this folder, see here » for more info. public override int Color => color; /// Pinned chats, folders can have unlimited pinned chats public override InputPeer[] PinnedPeers => pinned_peers; @@ -13949,7 +14039,7 @@ namespace TL keep_archived_unmuted = 0x2, /// Whether unmuted chats that are always included or pinned in a folder, will be kept in the Archive chat list when they get a new message. Ignored if keep_archived_unmuted is set. keep_archived_folders = 0x4, - /// If set, (only) users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of one of their messages.
The .read_dates_private flag will be set for users that have this flag enabled.
+ /// If this flag is set, the key will also apply to the ability to use Messages_GetOutboxReadDate on messages sent to us.
Meaning, users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of a message they sent to us.
The .read_dates_private flag will be set for users that have this flag enabled.
hide_read_marks = 0x8, /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
Premium users only, non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
new_noncontact_peers_require_premium = 0x10, @@ -14009,7 +14099,7 @@ namespace TL { /// Name, ISO code, localized name and phone codes/patterns of all available countries public Help_Country[] countries; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; } @@ -14689,13 +14779,17 @@ namespace TL public Flags flags; /// Message ID public byte[] random_id; + /// If set, contains a URL to open when the user clicks on the sponsored message. public string url; + /// If set, contains a custom sender name should be displayed for the sponsored message, like for messages sent in groups. public string title; /// Sponsored message public string message; /// Message entities for styled text [IfFlag(1)] public MessageEntity[] entities; + /// If set, contains a custom profile photo bubble that should be displayed for the sponsored message, like for messages sent in groups. [IfFlag(6)] public PhotoBase photo; + /// If set, the sponsored message should use the message accent color » specified in color. [IfFlag(13)] public PeerColor color; /// Text of the sponsored message button. public string button_text; @@ -14716,6 +14810,7 @@ namespace TL has_sponsor_info = 0x80, /// Field has a value has_additional_info = 0x100, + /// Whether this message can be reported as specified here ». can_report = 0x1000, /// Field has a value has_color = 0x2000, @@ -14988,7 +15083,7 @@ namespace TL [TLDef(0x768E3AAD)] public sealed partial class Messages_AvailableReactions : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; /// Animations and metadata associated with message reactions » public AvailableReaction[] reactions; @@ -15115,7 +15210,7 @@ namespace TL [TLDef(0x3C4301C0)] public sealed partial class AttachMenuBots : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// List of bot mini apps that can be launched from the attachment menu » public AttachMenuBot[] bots; @@ -15190,7 +15285,7 @@ namespace TL [TLDef(0xC1E92CC5)] public sealed partial class Account_SavedRingtones : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Saved notification sounds public DocumentBase[] ringtones; @@ -15272,10 +15367,11 @@ namespace TL /// Should be populated with one of the giveaway options returned by Payments_GetPremiumGiftCodeOptions, see the giveaways » documentation for more info. public PremiumGiftCodeOption option; } - /// See + /// Used to top up the current account's Telegram Stars balance. See [TLDef(0x1DA33AD8)] public sealed partial class InputInvoiceStars : InputInvoice { + /// Top up option, obtained as described here ». public StarsTopupOption option; } @@ -15415,14 +15511,17 @@ namespace TL has_prize_description = 0x10, } } - /// See + /// Used to top up the Telegram Stars balance using the Play Store/App Store flow (official apps only). See [TLDef(0x4F0EE8DF)] public sealed partial class InputStorePaymentStars : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Amount of stars to topup public long stars; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; [Flags] public enum Flags : uint @@ -15485,7 +15584,7 @@ namespace TL [TLDef(0x90C467D1)] public sealed partial class Account_EmojiStatuses : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Emoji statuses public EmojiStatus[] statuses; @@ -15538,7 +15637,7 @@ namespace TL [TLDef(0xEAFDF716)] public sealed partial class Messages_Reactions : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Reactions public Reaction[] reactions; @@ -15914,13 +16013,13 @@ namespace TL [TLDef(0x7A1E11D1)] public sealed partial class EmojiList : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; /// Custom emoji IDs public long[] document_id; } - /// Represents an emoji category. See Derived classes: , , + /// Represents an emoji category. See Derived classes: , , public abstract partial class EmojiGroupBase : IObject { /// Category name, i.e. "Animals", "Flags", "Faces" and so on... @@ -15928,7 +16027,7 @@ namespace TL /// A single custom emoji used as preview for the category. public virtual long IconEmojiId => default; } - /// Represents an emoji category. See + /// Represents an emoji category. See [TLDef(0x7A9ABDA9)] public partial class EmojiGroup : EmojiGroupBase { @@ -15944,30 +16043,34 @@ namespace TL /// A single custom emoji used as preview for the category. public override long IconEmojiId => icon_emoji_id; } - /// See + /// Represents an emoji category, that should be moved to the top of the list when choosing a sticker for a business introduction See [TLDef(0x80D26CC7)] public sealed partial class EmojiGroupGreeting : EmojiGroup { } - /// See + /// An emoji category, used to select all Premium-only stickers (i.e. those with a Premium effect »)/Premium-only custom emojis (i.e. those where the .free flag is not set) See [TLDef(0x093BCF34)] public sealed partial class EmojiGroupPremium : EmojiGroupBase { + /// Category name, i.e. "Animals", "Flags", "Faces" and so on... public string title; + /// A single custom emoji used as preview for the category. public long icon_emoji_id; + /// Category name, i.e. "Animals", "Flags", "Faces" and so on... public override string Title => title; + /// A single custom emoji used as preview for the category. public override long IconEmojiId => icon_emoji_id; } - /// Represents a list of emoji categories. See + /// Represents a list of emoji categories. See /// a value means messages.emojiGroupsNotModified [TLDef(0x881FB94B)] public sealed partial class Messages_EmojiGroups : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; - /// A list of emoji categories. + /// A list of emoji categories. public EmojiGroupBase[] groups; } @@ -16046,7 +16149,7 @@ namespace TL [TLDef(0xDD18782E)] public sealed partial class Help_AppConfig : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; /// Client configuration parameters public JsonObject config; @@ -17343,7 +17446,7 @@ namespace TL public Flags flags; /// Palette ID. public int color_id; - /// Light mode palette.
Will be empty for IDs 0 to 6 inclusive, in which case a palette containing a single color from the following colors should be used: red, orange, violet, green, cyan, blue, pink for indexes 0 to 6.
+ /// Light mode palette.
Will be empty for IDs 0 to 6 inclusive, in which case a palette containing a single color from the following colors should be used: red, orange, violet, green, cyan, blue, pink for indexes 0 to 6 (i.e. the same colors used for randomized fallback message accent colors).
[IfFlag(1)] public Help_PeerColorSetBase colors; /// Dark mode palette. Optional, defaults to the palette in colors (or the autogenerated palette for IDs 0 to 6) if absent. [IfFlag(2)] public Help_PeerColorSetBase dark_colors; @@ -17372,7 +17475,7 @@ namespace TL [TLDef(0x00F8ED08)] public sealed partial class Help_PeerColors : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; /// Usable color palettes. public Help_PeerColorOption[] colors; @@ -17530,18 +17633,19 @@ namespace TL { /// Saved reaction tags. public SavedReactionTag[] tags; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; } - /// See + /// Exact read date of a private message we sent to another user. See [TLDef(0x3BB842AC)] public sealed partial class OutboxReadDate : IObject { + /// UNIX timestamp with the read date. public DateTime date; } - /// See Derived classes: + /// SMS jobs eligibility See Derived classes: public abstract partial class Smsjobs_EligibilityToJoin : IObject { } /// SMS jobs eligibility See [TLDef(0xDC8B44CF)] @@ -17641,7 +17745,7 @@ namespace TL } } - /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See + /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See [TLDef(0x6F8B32AA)] public sealed partial class InputBusinessRecipients : IObject { @@ -17667,7 +17771,7 @@ namespace TL } } - /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See + /// Specifies the chats that can receive Telegram Business away » and greeting » messages. See [TLDef(0x21108FF7)] public sealed partial class BusinessRecipients : IObject { @@ -17693,7 +17797,7 @@ namespace TL } } - /// See Derived classes: , , + /// Specifies when should the Telegram Business away messages be sent. See Derived classes: , , public abstract partial class BusinessAwayMessageSchedule : IObject { } /// Always send Telegram Business away messages to users writing to us in private. See [TLDef(0xC9B9E2B9)] @@ -17794,7 +17898,7 @@ namespace TL { /// Timezones public Timezone[] timezones; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; } @@ -17812,16 +17916,16 @@ namespace TL public int count; } - /// See Derived classes: , + /// Represents a quick reply shortcut ». See Derived classes: , public abstract partial class InputQuickReplyShortcutBase : IObject { } - /// Selects a quick reply shortcut by name. See + /// Selects a quick reply shortcut by name. See [TLDef(0x24596D41)] public sealed partial class InputQuickReplyShortcut : InputQuickReplyShortcutBase { /// Shortcut name. public string shortcut; } - /// Selects a quick reply shortcut by its numeric ID. See + /// Selects a quick reply shortcut by its numeric ID. See [TLDef(0x01190CF1)] public sealed partial class InputQuickReplyShortcutId : InputQuickReplyShortcutBase { @@ -17874,16 +17978,18 @@ namespace TL public Dictionary users; } - /// See + /// Folder and folder tags information See [TLDef(0x2AD93719)] public sealed partial class Messages_DialogFilters : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Folders. public DialogFilterBase[] filters; [Flags] public enum Flags : uint { + /// Whether folder tags are enabled. tags_enabled = 0x1, } } @@ -17932,14 +18038,17 @@ namespace TL } } - /// See + /// Telegram Business introduction ». See [TLDef(0x09C469CD)] public sealed partial class InputBusinessIntro : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Title of the introduction message public string title; + /// Profile introduction public string description; + /// Optional introduction sticker. [IfFlag(0)] public InputDocument sticker; [Flags] public enum Flags : uint @@ -17949,14 +18058,17 @@ namespace TL } } - /// See + /// Telegram Business introduction ». See [TLDef(0x5A0A066D)] public sealed partial class BusinessIntro : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Title of the introduction message public string title; + /// Profile introduction public string description; + /// Optional introduction sticker. [IfFlag(0)] public DocumentBase sticker; [Flags] public enum Flags : uint @@ -17966,38 +18078,48 @@ namespace TL } } - /// See + /// The list of stickersets owned by the current account ». See [TLDef(0xFAFF629D)] public sealed partial class Messages_MyStickers : IObject { + /// Total number of owned stickersets. public int count; + /// Stickersets public StickerSetCoveredBase[] sets; } - /// See Derived classes: , + /// Represents a Fragment collectible ». See Derived classes: , public abstract partial class InputCollectible : IObject { } - /// See + /// Represents a username fragment collectible See [TLDef(0xE39460A9)] public sealed partial class InputCollectibleUsername : InputCollectible { + /// Username public string username; } - /// See + /// Represents a phone number fragment collectible See [TLDef(0xA2E214A4)] public sealed partial class InputCollectiblePhone : InputCollectible { + /// Phone number public string phone; } - /// See + /// Info about a fragment collectible. See [TLDef(0x6EBDFF91)] public sealed partial class Fragment_CollectibleInfo : IObject { + /// Purchase date (unixtime) public DateTime purchase_date; + /// Three-letter ISO 4217 currency code for amount public string currency; + /// Total price 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 amount; + /// Cryptocurrency name. public string crypto_currency; + /// Price, in the smallest units of the cryptocurrency. public long crypto_amount; + /// Fragment URL with more info about the collectible public string url; } @@ -18197,18 +18319,23 @@ namespace TL public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); } - /// See Derived classes: , , + /// Info about a peer, shared by a user with the currently logged in bot using Messages_SendBotRequestedPeer. See Derived classes: , , public abstract partial class RequestedPeer : IObject { } - /// See + /// Info about a user, shared by a user with the currently logged in bot using Messages_SendBotRequestedPeer. See [TLDef(0xD62FF46A)] public sealed partial class RequestedPeerUser : RequestedPeer { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// User ID. public long user_id; + /// First name. [IfFlag(0)] public string first_name; + /// Last name. [IfFlag(0)] public string last_name; + /// Username. [IfFlag(1)] public string username; + /// Profile photo. [IfFlag(2)] public PhotoBase photo; [Flags] public enum Flags : uint @@ -18221,14 +18348,17 @@ namespace TL has_photo = 0x4, } } - /// See + /// Info about a chat, shared by a user with the currently logged in bot using Messages_SendBotRequestedPeer. See [TLDef(0x7307544F)] public sealed partial class RequestedPeerChat : RequestedPeer { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Chat ID. public long chat_id; + /// Chat title. [IfFlag(0)] public string title; + /// Chat photo. [IfFlag(2)] public PhotoBase photo; [Flags] public enum Flags : uint @@ -18239,15 +18369,19 @@ namespace TL has_photo = 0x4, } } - /// See + /// Info about a channel/supergroup, shared by a user with the currently logged in bot using Messages_SendBotRequestedPeer. See [TLDef(0x8BA403E4)] public sealed partial class RequestedPeerChannel : RequestedPeer { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Channel/supergroup ID. public long channel_id; + /// Channel/supergroup title. [IfFlag(0)] public string title; + /// Channel/supergroup username. [IfFlag(1)] public string username; + /// Channel/supergroup photo. [IfFlag(2)] public PhotoBase photo; [Flags] public enum Flags : uint @@ -18261,112 +18395,140 @@ namespace TL } } - /// See + /// A report option for a sponsored message ». See [TLDef(0x430D3150)] public sealed partial class SponsoredMessageReportOption : IObject { + /// Localized description of the option. public string text; + /// Option identifier to pass to Channels_ReportSponsoredMessage. public byte[] option; } - /// See Derived classes: , , + /// Status of the method call used to report a sponsored message ». See Derived classes: , , public abstract partial class Channels_SponsoredMessageReportResult : IObject { } - /// See + /// The user must choose a report option from the localized options available in options, and after selection, Channels_ReportSponsoredMessage must be invoked again, passing the option's option field to the option param of the method. See [TLDef(0x846F9E42)] public sealed partial class Channels_SponsoredMessageReportResultChooseOption : Channels_SponsoredMessageReportResult { + /// Title of the option selection popup. public string title; + /// Localized list of options. public SponsoredMessageReportOption[] options; } - /// See + /// Sponsored messages were hidden for the user in all chats. See [TLDef(0x3E3BCF2F)] public sealed partial class Channels_SponsoredMessageReportResultAdsHidden : Channels_SponsoredMessageReportResult { } - /// See + /// The sponsored message was reported successfully. See [TLDef(0xAD798849)] public sealed partial class Channels_SponsoredMessageReportResultReported : Channels_SponsoredMessageReportResult { } - /// See + /// Channel revenue ad statistics, see here » for more info. See [TLDef(0x5407E297)] public sealed partial class Stats_BroadcastRevenueStats : IObject { + /// Ad impressions graph public StatsGraphBase top_hours_graph; + /// Ad revenue graph (in the smallest unit of the cryptocurrency in which revenue is calculated) public StatsGraphBase revenue_graph; + /// Current balance, current withdrawable balance and overall revenue public BroadcastRevenueBalances balances; + /// Current conversion rate of the cryptocurrency (not in the smallest unit) in which revenue is calculated to USD public double usd_rate; } - /// See + /// Contains the URL to use to withdraw channel ad revenue. See [TLDef(0xEC659737)] public sealed partial class Stats_BroadcastRevenueWithdrawalUrl : IObject { + /// A unique URL to a Fragment page where the user will be able to specify and submit the address of the TON wallet where the funds will be sent. public string url; } - /// See Derived classes: , , + /// A channel ad revenue » transaction. See Derived classes: , , public abstract partial class BroadcastRevenueTransaction : IObject { } - /// See + /// Describes earnings from sponsored messages in a channel in some time frame, see here » for more info. See [TLDef(0x557E2CC4)] public sealed partial class BroadcastRevenueTransactionProceeds : BroadcastRevenueTransaction { + /// Amount in the smallest unit of the cryptocurrency. public long amount; + /// Start unixtime for the timeframe. public DateTime from_date; + /// End unixtime for the timeframe. public DateTime to_date; } - /// See + /// Describes a withdrawal of ad earnings » See [TLDef(0x5A590978)] public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Amount withdrawn public long amount; + /// Withdrawal date public DateTime date; + /// Payment provider name public string provider; + /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain the point in time (Unix timestamp) when the withdrawal was completed successfully. [IfFlag(1)] public DateTime transaction_date; + /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain a URL where the withdrawal transaction can be viewed. [IfFlag(1)] public string transaction_url; [Flags] public enum Flags : uint { + /// Whether the withdrawal is currently pending pending = 0x1, /// Fields and have a value has_transaction_date = 0x2, + /// Whether the withdrawal has failed failed = 0x4, } } - /// See + /// Describes a refund for failed withdrawal of ad earnings » See [TLDef(0x42D30D2E)] public sealed partial class BroadcastRevenueTransactionRefund : BroadcastRevenueTransaction { + /// Amount refunded. public long amount; + /// Date of refund. public DateTime date; + /// Payment provider name. public string provider; } - /// See + /// Channel ad revenue transactions ». See [TLDef(0x87158466)] public sealed partial class Stats_BroadcastRevenueTransactions : IObject { + /// Total number of transactions. public int count; + /// Transactions public BroadcastRevenueTransaction[] transactions; } - /// See + /// Reaction notification settings See public enum ReactionNotificationsFrom : uint { - ///See + ///Receive notifications about reactions made only by our contacts. Contacts = 0xBAC3A61A, - ///See + ///Receive notifications about reactions made by any user. All = 0x4B9E22A0, } - /// See + /// Reaction notification settings, see here » for more info. See [TLDef(0x56E34970)] public sealed partial class ReactionsNotifySettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Message reaction notification settings, if not set completely disables notifications/updates about message reactions. [IfFlag(0)] public ReactionNotificationsFrom messages_notify_from; + /// Story reaction notification settings, if not set completely disables notifications/updates about reactions to stories. [IfFlag(1)] public ReactionNotificationsFrom stories_notify_from; + /// Notification sound for reactions » public NotificationSound sound; + /// If false, push notifications » about message/story reactions will only be of type REACT_HIDDEN/REACT_STORY_HIDDEN, without any information about the reacted-to story or the reaction itself. public bool show_previews; [Flags] public enum Flags : uint @@ -18378,25 +18540,33 @@ namespace TL } } - /// See + /// Describes channel ad revenue balances ». See [TLDef(0x8438F1C6)] public sealed partial class BroadcastRevenueBalances : IObject { + /// Amount of not-yet-withdrawn cryptocurrency. public long current_balance; + /// Amount of withdrawable cryptocurrency, out of the currently available balance (available_balance <= current_balance). public long available_balance; + /// Total amount of earned cryptocurrency. public long overall_revenue; } - /// See + /// Represents a message effect ». See [TLDef(0x93C3E27E)] public sealed partial class AvailableEffect : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Unique effect ID. public long id; + /// Emoji corresponding to the effect, to be used as icon for the effect if static_icon_id is not set. public string emoticon; + /// ID of the document containing the static icon (WEBP) of the effect. [IfFlag(0)] public long static_icon_id; + /// Contains the preview animation (TGS format »), used for the effect selection menu. public long effect_sticker_id; + /// If set, contains the actual animated effect (TGS format »). If not set, the animated effect must be set equal to the premium animated sticker effect associated to the animated sticker specified in effect_sticker_id (always different from the preview animation, fetched thanks to the of type f as specified here »). [IfFlag(1)] public long effect_animation_id; [Flags] public enum Flags : uint @@ -18405,30 +18575,35 @@ namespace TL has_static_icon_id = 0x1, /// Field has a value has_effect_animation_id = 0x2, + /// Whether a Premium subscription is required to use this effect. premium_required = 0x4, } } - /// See + /// The full list of usable animated message effects ». See /// a value means messages.availableEffectsNotModified [TLDef(0xBDDB616E)] public sealed partial class Messages_AvailableEffects : IObject { - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public int hash; + /// Message effects public AvailableEffect[] effects; + /// Documents specified in the effects constructors. public DocumentBase[] documents; } - /// See + /// Represents a fact-check » created by an independent fact-checker. See [TLDef(0xB89BFCCF)] public sealed partial class FactCheck : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// A two-letter ISO 3166-1 alpha-2 country code of the country for which the fact-check should be shown. [IfFlag(1)] public string country; + /// The fact-check. [IfFlag(1)] public TextWithEntities text; - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public long hash; [Flags] public enum Flags : uint @@ -18439,64 +18614,77 @@ namespace TL } } - /// See Derived classes: , , , , , + /// Source of an incoming Telegram Star transaction, or its recipient for outgoing Telegram Star transactions. See Derived classes: , , , , , public abstract partial class StarsTransactionPeerBase : IObject { } - /// See + /// Describes a Telegram Star transaction that cannot be described using the current layer. See [TLDef(0x95F2BFE4)] public sealed partial class StarsTransactionPeerUnsupported : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction with the App Store, used when purchasing Telegram Stars through the App Store. See [TLDef(0xB457B375)] public sealed partial class StarsTransactionPeerAppStore : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction with the Play Store, used when purchasing Telegram Stars through the Play Store. See [TLDef(0x7B560A0B)] public sealed partial class StarsTransactionPeerPlayMarket : StarsTransactionPeerBase { } /// See [TLDef(0x250DBAF8)] public sealed partial class StarsTransactionPeerPremiumBot : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction with Fragment, used when purchasing Telegram Stars through Fragment. See [TLDef(0xE92FD902)] public sealed partial class StarsTransactionPeerFragment : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction with another peer (usually a bot or a channel). See [TLDef(0xD80DA15D)] public sealed partial class StarsTransactionPeer : StarsTransactionPeerBase { + /// The peer. public Peer peer; } /// See [TLDef(0x60682812)] public sealed partial class StarsTransactionPeerAds : StarsTransactionPeerBase { } - /// See + /// Telegram Stars topup option. See [TLDef(0x0BD915C0)] public sealed partial class StarsTopupOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Amount of Telegram stars. public long stars; + /// Identifier of the store product associated with the option, official apps only. [IfFlag(0)] public string store_product; + /// 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 amount; [Flags] public enum Flags : uint { /// Field has a value has_store_product = 0x1, + /// If set, the option must only be shown in the full list of topup options. extended = 0x2, } } - /// See + /// Represents a Telegram Stars transaction ». See [TLDef(0x2DB5418F)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Transaction ID. public string id; + /// Amount of Stars (negative for outgoing transactions). public long stars; + /// Date of the transaction (unixtime). public DateTime date; + /// Source of the incoming transaction, or its recipient for outgoing transactions. public StarsTransactionPeerBase peer; + /// For transactions with bots, title of the bought product. [IfFlag(0)] public string title; + /// For transactions with bots, description of the bought product. [IfFlag(1)] public string description; + /// For transactions with bots, photo of the bought product. [IfFlag(2)] public WebDocumentBase photo; [IfFlag(5)] public DateTime transaction_date; [IfFlag(5)] public string transaction_url; @@ -18512,6 +18700,7 @@ namespace TL has_description = 0x2, /// Field has a value has_photo = 0x4, + /// Whether this transaction is a refund. refund = 0x8, pending = 0x10, /// Fields and have a value @@ -18526,16 +18715,21 @@ namespace TL } } - /// See + /// Info about the current Telegram Star balance and transaction history ». See [TLDef(0x8CF4EE60)] public sealed partial class Payments_StarsStatus : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Current Telegram Star balance. public long balance; + /// List of Telegram Star transactions (partial if next_offset is set). public StarsTransaction[] history; + /// Offset to use to fetch more transactions from the transaction history using Payments_GetStarsTransactions. [IfFlag(0)] public string next_offset; + /// Chats mentioned in history. public Dictionary chats; + /// Users mentioned in history. public Dictionary users; [Flags] public enum Flags : uint diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 7c2f62d..65c2ffa 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -102,7 +102,10 @@ namespace TL query = query, }); - /// See + /// Official clients only, invoke with Google Play Integrity token. See + /// Nonce. + /// Token. + /// Query. public static Task InvokeWithGooglePlayIntegrity(this Client client, string nonce, string token, IMethod query) => client.Invoke(new InvokeWithGooglePlayIntegrity { @@ -111,7 +114,10 @@ namespace TL query = query, }); - /// See + /// Official clients only, invoke with Apple push verification. See + /// Nonce. + /// Secret. + /// Query. public static Task InvokeWithApnsSecret(this Client client, string nonce, string secret, IMethod query) => client.Invoke(new InvokeWithApnsSecret { @@ -442,7 +448,7 @@ namespace TL }); /// Returns a list of available wallpapers. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash = default) => client.Invoke(new Account_GetWallPapers @@ -961,7 +967,7 @@ namespace TL /// Get installed themes See /// Theme format, a string that identifies the theming engines supported by the client - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash = default) => client.Invoke(new Account_GetThemes @@ -1033,7 +1039,7 @@ namespace TL }); /// Get all available chat themes ». See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.themesNotModified public static Task Account_GetChatThemes(this Client client, long hash = default) => client.Invoke(new Account_GetChatThemes @@ -1064,7 +1070,7 @@ namespace TL }); /// Fetch saved notification sounds See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.savedRingtonesNotModified public static Task Account_GetSavedRingtones(this Client client, long hash = default) => client.Invoke(new Account_GetSavedRingtones @@ -1103,7 +1109,7 @@ namespace TL }); /// Get a list of default suggested emoji statuses See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultEmojiStatuses @@ -1112,7 +1118,7 @@ namespace TL }); /// Get recently used emoji statuses See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetRecentEmojiStatuses @@ -1145,7 +1151,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as profile picture See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1154,7 +1160,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as group picture See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1209,7 +1215,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultBackgroundEmojis @@ -1218,7 +1224,7 @@ namespace TL }); /// Get a list of default suggested channel emoji statuses. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetChannelDefaultEmojiStatuses @@ -1227,7 +1233,7 @@ namespace TL }); /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetChannelRestrictedStatusEmojis @@ -1300,7 +1306,8 @@ namespace TL connection_id = connection_id, }); - /// See + /// Set or remove the Telegram Business introduction ». See + /// Telegram Business introduction, to remove it call the method without setting this flag. public static Task Account_UpdateBusinessIntro(this Client client, InputBusinessIntro intro = null) => client.Invoke(new Account_UpdateBusinessIntro { @@ -1383,20 +1390,22 @@ namespace TL channel = channel, }); - /// See + /// Disable or re-enable Telegram ads for the current Premium account. See + /// Enable or disable ads. public static Task Account_ToggleSponsoredMessages(this Client client, bool enabled) => client.Invoke(new Account_ToggleSponsoredMessages { enabled = enabled, }); - /// See + /// Get the current reaction notification settings ». See public static Task Account_GetReactionsNotifySettings(this Client client) => client.Invoke(new Account_GetReactionsNotifySettings { }); - /// See + /// Change the reaction notification settings ». See + /// New reaction notification settings. public static Task Account_SetReactionsNotifySettings(this Client client, ReactionsNotifySettings settings) => client.Invoke(new Account_SetReactionsNotifySettings { @@ -1429,7 +1438,7 @@ namespace TL errors = errors, }); - /// Check whether we can write to the specified user (non-Premium users only). See + /// Check whether we can write to the specified user (non-Premium users only), see here » for more info on the full flow. See /// Users to fetch info about. public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetIsPremiumRequiredToContact @@ -1438,7 +1447,7 @@ namespace TL }); /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
- /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) => client.Invoke(new Contacts_GetContactIDs { @@ -1452,7 +1461,7 @@ namespace TL }); /// Returns the current user's contact list. See - /// Hash for pagination, for more info click here.
Note that the hash is computed using the usual algorithm, passing to the algorithm first the previously returned .saved_count field, then max 100000 sorted user IDs from the contact list, including the ID of the currently logged in user if it is saved as a contact.
Example: tdlib implementation. + /// Hash used for caching, for more info click here.
Note that the hash is computed using the usual algorithm, passing to the algorithm first the previously returned .saved_count field, then max 100000 sorted user IDs from the contact list, including the ID of the currently logged in user if it is saved as a contact.
Example: tdlib implementation. /// a null value means contacts.contactsNotModified public static Task Contacts_GetContacts(this Client client, long hash = default) => client.Invoke(new Contacts_GetContacts @@ -1545,7 +1554,7 @@ namespace TL /// Most frequently visited channels /// Offset for pagination /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here /// a null value means contacts.topPeersNotModified public static Task Contacts_GetTopPeers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false) => client.Invoke(new Contacts_GetTopPeers @@ -1697,7 +1706,7 @@ namespace TL /// Offsets for pagination, for more info click here (top_message ID used for pagination) /// Offset peer for pagination /// Number of list elements to be returned - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, int? folder_id = null, bool exclude_pinned = false) => client.Invoke(new Messages_GetDialogs { @@ -1737,6 +1746,7 @@ namespace TL /// Text search request /// Only return messages sent by the specified user ID /// Search within the saved message dialog » with this ID. + /// You may search for saved messages tagged » with one or more reactions using this flag. /// Thread ID /// Filter to return only specified message types /// If a positive value was transferred, only messages with a sending date bigger than the transferred one will be returned @@ -1843,6 +1853,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. + /// Specifies a message effect » to use for the message. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMessage { @@ -1876,6 +1887,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. + /// Specifies a message effect » to use for the message. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMedia { @@ -2157,7 +2169,7 @@ namespace TL /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_GetStickers @@ -2167,7 +2179,7 @@ namespace TL }); /// Get all installed stickers See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetAllStickers @@ -2222,7 +2234,7 @@ namespace TL /// Get info about a stickerset See [bots: ✓] Possible codes: 400,406 (details) /// Stickerset - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here /// a null value means messages.stickerSetNotModified public static Task Messages_GetStickerSet(this Client client, InputStickerSet stickerset, int hash = default) => client.Invoke(new Messages_GetStickerSet @@ -2296,6 +2308,7 @@ namespace TL }); /// Search for messages and peers globally See Possible codes: 400 (details) + /// If set, only returns results from channels (used in the global channel search tab »). /// Peer folder ID, for more info click here /// Query /// Global search filter @@ -2344,7 +2357,7 @@ namespace TL }); /// Get saved GIFs. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash = default) => client.Invoke(new Messages_GetSavedGifs @@ -2548,7 +2561,7 @@ namespace TL }); /// Get featured stickers See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedStickers { @@ -2565,7 +2578,7 @@ namespace TL /// Get recent stickers See /// Get stickers recently attached to photo or video files - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash = default, bool attached = false) => client.Invoke(new Messages_GetRecentStickers @@ -2608,7 +2621,7 @@ namespace TL }); /// Get installed mask stickers See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetMaskStickers @@ -2692,7 +2705,7 @@ namespace TL /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetWebPage(this Client client, string url, int hash = default) => client.Invoke(new Messages_GetWebPage { @@ -2782,7 +2795,7 @@ namespace TL }); /// Get faved stickers See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFavedStickers @@ -2835,7 +2848,7 @@ namespace TL /// Get live location history of a certain user See /// User /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetRecentLocations(this Client client, InputPeer peer, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentLocations { @@ -2857,6 +2870,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. + /// Specifies a message effect » to use for the message. public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) => client.Invoke(new Messages_SendMultiMedia { @@ -2884,7 +2898,7 @@ namespace TL /// Search for stickersets See /// Exclude featured stickersets from results /// Query string - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchStickerSets @@ -3078,7 +3092,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { @@ -3179,7 +3193,7 @@ namespace TL /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetOldFeaturedStickers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetOldFeaturedStickers { @@ -3197,7 +3211,7 @@ namespace TL /// Maximum number of results to return, see pagination /// If a positive value was transferred, the method will return only messages with ID smaller than max_id /// If a positive value was transferred, the method will return only messages with ID bigger than min_id - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetReplies(this Client client, InputPeer peer, int msg_id, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) => client.Invoke(new Messages_GetReplies { @@ -3563,6 +3577,7 @@ namespace TL /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details) /// Group where to apply changes /// Allowed reaction emojis + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max); this field and the other info set by the method will then be available to users in and . public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null) => client.Invoke(new Messages_SetChatAvailableReactions { @@ -3573,7 +3588,7 @@ namespace TL }); /// Obtain available message reactions » See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions @@ -3649,7 +3664,7 @@ namespace TL }); /// Returns installed attachment menu bot mini apps » See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means attachMenuBotsNotModified public static Task Messages_GetAttachMenuBots(this Client client, long hash = default) => client.Invoke(new Messages_GetAttachMenuBots @@ -3796,7 +3811,7 @@ namespace TL }); /// Gets the list of currently installed custom emoji stickersets. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.allStickersNotModified public static Task Messages_GetEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetEmojiStickers @@ -3805,7 +3820,7 @@ namespace TL }); /// Gets featured custom emoji stickersets. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedEmojiStickers { @@ -3826,7 +3841,7 @@ namespace TL /// Got popular message reactions See /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetTopReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetTopReactions @@ -3837,7 +3852,7 @@ namespace TL /// Get recently used message reactions See /// Maximum number of results to return, see pagination - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetRecentReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentReactions @@ -3890,8 +3905,8 @@ namespace TL requested_peers = requested_peers, }); - /// Represents a list of emoji categories, to be used when selecting custom emojis. See [bots: ✓] - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Represents a list of emoji categories. See [bots: ✓] + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3899,8 +3914,8 @@ namespace TL hash = hash, }); - /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See [bots: ✓] - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See [bots: ✓] + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3908,8 +3923,8 @@ namespace TL hash = hash, }); - /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See [bots: ✓] - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See [bots: ✓] + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3919,7 +3934,7 @@ namespace TL /// Look for custom emojis associated to a UTF8 emoji See [bots: ✓] Possible codes: 400 (details) /// The emoji - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -3940,7 +3955,7 @@ namespace TL /// Obtain information about a direct link Mini App See Possible codes: 400 (details) /// Bot app information obtained from a Direct Mini App deep link ». - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetBotApp(this Client client, InputBotApp app, long hash = default) => client.Invoke(new Messages_GetBotApp { @@ -3986,7 +4001,7 @@ namespace TL /// Search for custom emoji stickersets » See /// Exclude featured stickersets from results /// Query string - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchEmojiStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchEmojiStickerSets @@ -4002,7 +4017,7 @@ namespace TL /// Offsets for pagination, for more info click here (top_message ID used for pagination) /// Offset peer for pagination /// Number of list elements to be returned - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs { @@ -4079,7 +4094,7 @@ namespace TL /// Fetch the full list of saved message tags created by the user. See /// If set, returns tags only used in the specified saved message dialog. - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.savedReactionTagsNotModified public static Task Messages_GetSavedReactionTags(this Client client, long hash = default, InputPeer peer = null) => client.Invoke(new Messages_GetSavedReactionTags @@ -4101,7 +4116,7 @@ namespace TL }); /// Fetch a default recommended list of saved message tag reactions. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.reactionsNotModified public static Task Messages_GetDefaultTagReactions(this Client client, long hash = default) => client.Invoke(new Messages_GetDefaultTagReactions @@ -4109,7 +4124,9 @@ namespace TL hash = hash, }); - /// See Possible codes: 400,403 (details) + /// Get the exact read date of one of our messages, sent to a private chat with another user. See Possible codes: 400,403 (details) + /// The user to whom we sent the message. + /// The message ID. public static Task Messages_GetOutboxReadDate(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_GetOutboxReadDate { @@ -4163,7 +4180,7 @@ namespace TL /// 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
Fetch (a subset or all) messages in a quick reply shortcut ». See Possible codes: 400 (details)
/// Quick reply shortcut ID. /// IDs of the messages to fetch, if empty fetches all of them. - /// Hash for pagination, for more info click here + /// Hash used for caching, for more info click here public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) => client.Invoke(new Messages_GetQuickReplyMessages { @@ -4197,14 +4214,15 @@ namespace TL id = id, }); - /// See + /// Enable or disable folder tags ». See + /// Enable or disable folder tags. public static Task Messages_ToggleDialogFilterTags(this Client client, bool enabled) => client.Invoke(new Messages_ToggleDialogFilterTags { enabled = enabled, }); - /// See + /// Fetch stickerset owned by the current user. See /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetMyStickers(this Client client, long offset_id = default, int limit = int.MaxValue) @@ -4214,8 +4232,8 @@ namespace TL limit = limit, }); - /// See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Represents a list of emoji categories, to be used when choosing a sticker. See + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStickerGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStickerGroups @@ -4223,8 +4241,8 @@ namespace TL hash = hash, }); - /// See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Fetch the full list of usable animated message effects ». See + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.availableEffectsNotModified public static Task Messages_GetAvailableEffects(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableEffects @@ -4232,7 +4250,10 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) + /// Edit/create a fact-check on a message. See Possible codes: 400 (details) + /// Peer where the message was sent + /// Message ID + /// Fact-check (maximum UTF-8 length specified in appConfig.factcheck_length_limit). public static Task Messages_EditFactCheck(this Client client, InputPeer peer, int msg_id, TextWithEntities text) => client.Invoke(new Messages_EditFactCheck { @@ -4241,7 +4262,9 @@ namespace TL text = text, }); - /// See Possible codes: 400 (details) + /// Delete a fact-check from a message. See Possible codes: 400 (details) + /// Peer where the message was sent. + /// Message ID public static Task Messages_DeleteFactCheck(this Client client, InputPeer peer, int msg_id) => client.Invoke(new Messages_DeleteFactCheck { @@ -4545,7 +4568,7 @@ namespace TL }); /// Get app-specific configuration, see client configuration for more info on the result. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.appConfigNotModified public static Task Help_GetAppConfig(this Client client, int hash = default) => client.Invoke(new Help_GetAppConfig @@ -4562,7 +4585,7 @@ namespace TL }); /// Get passport configuration See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash = default) => client.Invoke(new Help_GetPassportConfig @@ -4624,7 +4647,7 @@ namespace TL /// Get name, ISO code, localized name and phone codes/patterns of all available countries See /// Language code of the current user - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash = default) => client.Invoke(new Help_GetCountriesList @@ -4640,7 +4663,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used for message accents. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerColors @@ -4649,7 +4672,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used in profile page backgrounds. See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerProfileColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerProfileColors @@ -4658,7 +4681,7 @@ namespace TL }); /// Returns timezone information that may be used elsewhere in the API, such as to set Telegram Business opening hours ». See - /// Hash for pagination, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means help.timezonesListNotModified public static Task Help_GetTimezonesList(this Client client, int hash = default) => client.Invoke(new Help_GetTimezonesList @@ -4886,6 +4909,7 @@ namespace TL /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) /// Get geogroups /// If set and the user has reached the limit of owned public channels/supergroups/geogroups, instead of returning the channel list one of the specified errors will be returned.
Useful to check if a new public channel can indeed be created, even before asking the user to enter a channel username to use in Channels_CheckUsername/Channels_UpdateUsername. + /// Set this flag to only fetch the full list of channels that may be passed to Account_UpdatePersonalChannel to display them on our profile page. public static Task Channels_GetAdminedPublicChannels(this Client client, bool by_location = false, bool check_limit = false, bool for_personal = false) => client.Invoke(new Channels_GetAdminedPublicChannels { @@ -5302,7 +5326,7 @@ namespace TL }); /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) - /// The method will return channels related to the passed channel. + /// The method will return channels related to the passed channel. If not set, the method will returns channels related to channels the user has joined. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations { @@ -5320,7 +5344,9 @@ namespace TL emoji_status = emoji_status, }); - /// See Possible codes: 400 (details) + /// Admins with ban_users admin rights » may allow users that apply a certain number of booosts » to the group to bypass Channels_ToggleSlowMode and other » supergroup restrictions, see here » for more info. See Possible codes: 400 (details) + /// The supergroup. + /// The number of required boosts (1-8, 0 to disable). public static Task Channels_SetBoostsToUnblockRestrictions(this Client client, InputChannelBase channel, int boosts) => client.Invoke(new Channels_SetBoostsToUnblockRestrictions { @@ -5338,7 +5364,10 @@ namespace TL stickerset = stickerset, }); - /// See Possible codes: 400 (details) + /// Report a sponsored message », see here » for more info on the full flow. See Possible codes: 400 (details) + /// The channel where the sponsored message can be seen. + /// ID of the sponsored message. + /// Chosen report option, initially an empty string, see here » for more info on the full flow. public static Task Channels_ReportSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, byte[] option) => client.Invoke(new Channels_ReportSponsoredMessage { @@ -5347,7 +5376,9 @@ namespace TL option = option, }); - /// See Possible codes: 400 (details) + /// Disable ads on the specified channel, for all users. See Possible codes: 400 (details) + /// The channel. + /// Whether to disable or re-enable ads. public static Task Channels_RestrictSponsoredMessages(this Client client, InputChannelBase channel, bool restricted) => client.Invoke(new Channels_RestrictSponsoredMessages { @@ -5355,7 +5386,10 @@ namespace TL restricted = restricted, }); - /// See + /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See + /// The hashtag to search, without the # character. + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice + /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Channels_SearchPosts(this Client client, string hashtag, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) @@ -5691,20 +5725,23 @@ namespace TL purpose = purpose, }); - /// See + /// Obtain a list of Telegram Stars topup options » as s. See public static Task Payments_GetStarsTopupOptions(this Client client) => client.Invoke(new Payments_GetStarsTopupOptions { }); - /// See Possible codes: 400 (details) + /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400 (details) + /// Peer of which to get the balance. public static Task Payments_GetStarsStatus(this Client client, InputPeer peer) => client.Invoke(new Payments_GetStarsStatus { peer = peer, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Fetch Telegram Stars transactions. See [bots: ✓] Possible codes: 400 (details) + /// Fetch the transaction history of the peer ( or a bot we own). + /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool inbound = false, bool outbound = false, bool ascending = false) => client.Invoke(new Payments_GetStarsTransactions { @@ -5714,7 +5751,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400 (details) + /// Payment form ID + /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) => client.Invoke(new Payments_SendStarsForm { @@ -5723,7 +5762,9 @@ namespace TL invoice = invoice, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Refund a Telegram Stars transaction, see here » for more info. See [bots: ✓] Possible codes: 400 (details) + /// User to refund. + /// Transaction ID. public static Task Payments_RefundStarsCharge(this Client client, InputUserBase user_id, string charge_id) => client.Invoke(new Payments_RefundStarsCharge { @@ -6391,7 +6432,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Get channel ad revenue statistics ». See Possible codes: 400 (details) + /// Whether to enable dark theme for graph colors + /// The channel public static Task Stats_GetBroadcastRevenueStats(this Client client, InputChannelBase channel, bool dark = false) => client.Invoke(new Stats_GetBroadcastRevenueStats { @@ -6399,7 +6442,9 @@ namespace TL channel = channel, }); - /// See Possible codes: 400 (details) + /// Withdraw funds from a channel's ad revenue balance ». See Possible codes: 400 (details) + /// The channel + /// 2FA password, see here » for more info. public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputChannelBase channel, InputCheckPasswordSRP password) => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl { @@ -6407,7 +6452,9 @@ namespace TL password = password, }); - /// See Possible codes: 400 (details) + /// Fetch channel ad revenue transaction history ». See Possible codes: 400 (details) + /// The channel + /// Offset for pagination /// Maximum number of results to return, see pagination public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputChannelBase channel, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stats_GetBroadcastRevenueTransactions @@ -6811,7 +6858,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Pin some stories to the top of the profile, see here » for more info. See Possible codes: 400 (details) + /// Peer where to pin stories. + /// IDs of the stories to pin (max stories_pinned_to_top_count_max). public static Task Stories_TogglePinnedToTop(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Stories_TogglePinnedToTop { @@ -6912,6 +6961,7 @@ namespace TL }); /// Get info about an SMS job (official clients only). See Possible codes: 400 (details) + /// Job ID public static Task Smsjobs_GetSmsJob(this Client client, string job_id) => client.Invoke(new Smsjobs_GetSmsJob { @@ -6929,7 +6979,8 @@ namespace TL error = error, }); - /// See Possible codes: 400 (details) + /// Fetch information about a fragment collectible, see here » for more info on the full flow. See Possible codes: 400 (details) + /// Collectible to fetch info about. public static Task Fragment_GetCollectibleInfo(this Client client, InputCollectible collectible) => client.Invoke(new Fragment_GetCollectibleInfo { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index af84daf..f1ec34a 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 = 184; // fetched 07/07/2024 20:50:35 + public const int Version = 184; // fetched 17/07/2024 09:17:31 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; From 9712233c00f9a378643e3d54238a07f6a86b678f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 20 Jul 2024 02:13:56 +0200 Subject: [PATCH 220/336] Process Downloads really on media DCs, including for the main dc_id (fix #261) --- src/Client.Helpers.cs | 4 ++-- src/Client.cs | 28 ++++++++++++++++++++-------- 2 files changed, 22 insertions(+), 10 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 0303d72..c0c13ab 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -314,7 +314,7 @@ namespace WTelegram 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); + var client = dc_id == 0 ? this : await GetClientForDC(-dc_id, true); using var writeSem = new SemaphoreSlim(1); bool canSeek = outputStream.CanSeek; long streamStartPos = canSeek ? outputStream.Position : 0; @@ -347,7 +347,7 @@ namespace WTelegram } catch (RpcException ex) when (ex.Code == 303 && ex.Message == "FILE_MIGRATE_X") { - client = await GetClientForDC(ex.X, true); + client = await GetClientForDC(-ex.X, true); fileBase = await client.Upload_GetFile(fileLocation, offset, FilePartSize); } catch (RpcException ex) when (ex.Code == 400 && ex.Message == "OFFSET_INVALID") diff --git a/src/Client.cs b/src/Client.cs index bf4ee87..5efd138 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -240,13 +240,24 @@ namespace WTelegram private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) { - if (_session.DCSessions.TryGetValue(dcId, out var dcSession)) + if (_session.DCSessions.TryGetValue(dcId, out var dcSession) && dcSession.AuthKey != null) if (dcSession.Client != null || dcSession.DataCenter.flags == flags) return dcSession; // if we have already a session with this DC and we are connected or it is a perfect match, use it + if (dcSession == null && _session.DCSessions.TryGetValue(-dcId, out dcSession) && dcSession.AuthKey != null) + { + if (dcSession.DataCenter.flags == flags && _session.DCSessions.Remove(-dcId)) + return _session.DCSessions[dcId] = dcSession; // we found a misclassed DC, change its sign + dcSession = new Session.DCSession { Id = Helpers.RandomLong(), // clone AuthKey for a session on the matching media_only DC + AuthKeyID = dcSession.AuthKeyID, AuthKey = dcSession.AuthKey, UserId = dcSession.UserId }; + } // try to find the most appropriate DcOption for this DC - if ((dcSession?.AuthKeyID ?? 0) == 0) // we will need to negociate an AuthKey => can't use media_only DC + if (dcSession?.AuthKey == null) // we'll need to negociate an AuthKey => can't use media_only DC + { flags &= ~DcOption.Flags.media_only; - var dcOptions = _session.DcOptions.Where(dc => dc.id == dcId).OrderBy(dc => dc.flags ^ flags); + dcId = Math.Abs(dcId); + } + var dcOptions = _session.DcOptions.Where(dc => dc.id == Math.Abs(dcId)) + .OrderBy(dc => dc.flags.HasFlag(DcOption.Flags.media_only) ^ (dcId < 0)).ThenBy(dc => dc.flags ^ flags); var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing dcSession.DataCenter = dcOption; @@ -254,17 +265,18 @@ namespace WTelegram } /// Obtain/create a Client for a secondary session on a specific Data Center - /// ID of the Data Center - /// Session will be used only for transferring media + /// ID of the Data Center (use negative values for media_only) /// Connect immediately /// Client connected to the selected DC - public async Task GetClientForDC(int dcId, bool media_only = true, bool connect = true) + public async Task GetClientForDC(int dcId, bool connect = true) { if (_dcSession.DataCenter?.id == dcId) return this; Session.DCSession altSession; lock (_session) { - altSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags | (media_only ? DcOption.Flags.media_only : 0)); + var flags = _dcSession.DataCenter.flags; + if (dcId < 0) flags = (flags & DcOption.Flags.ipv6) | DcOption.Flags.media_only; + altSession = GetOrCreateDCSession(dcId, flags); if (altSession.Client?.Disconnected ?? false) { altSession.Client.Dispose(); altSession.Client = null; } altSession.Client ??= new Client(this, altSession); } @@ -276,7 +288,7 @@ namespace WTelegram { Auth_ExportedAuthorization exported = null; if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId) - exported = await this.Auth_ExportAuthorization(dcId); + exported = await this.Auth_ExportAuthorization(Math.Abs(dcId)); await altSession.Client.ConnectAsync(); if (exported != null) { From 8654f99d2ba982c54f95812d361175a29f04af1e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 30 Jul 2024 01:50:26 +0200 Subject: [PATCH 221/336] Manager: added opportunity to call DropPendingUpdates/StopResync before a resync --- .github/dev.yml | 2 +- EXAMPLES.md | 2 ++ src/UpdateManager.cs | 13 +++++++++++++ 3 files changed, 16 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 542e9d0..7893558 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.5-dev.$(Rev:r) +name: 4.1.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index 290879e..ff86a4d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -210,6 +210,8 @@ that simplifies the download of a photo/document/file once you get a reference t See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages) +_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument._ + ## Upload a media file and post it with caption to a chat ```csharp diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index b9ee9db..cfd8053 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -80,6 +80,7 @@ namespace WTelegram goto newSession; case NewSessionCreated when _client.User != null: newSession: + await Task.Delay(HalfSec); // let the opportunity to call DropPendingUpdates/StopResync before a big resync if (_local[L_PTS].pts != 0) await ResyncState(); else await ResyncState(await _client.Updates_GetState()); break; @@ -282,6 +283,18 @@ namespace WTelegram finally { _sem.Release(); } } + public async Task StopResync() + { + await _sem.WaitAsync(); + try + { + foreach (var local in _local.Values) + local.pts = 0; + _pending.Clear(); + } + finally { _sem.Release(); } + } + private async Task GetInputChannel(long channel_id, MBoxState local) { if (channel_id <= 0) return null; From 6afb0803bbd3b61acb569c6cafcb2ee6b8e2f0e2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 30 Jul 2024 01:54:00 +0200 Subject: [PATCH 222/336] api doc --- src/TL.Schema.cs | 101 +++++++++++++++------------- src/TL.SchemaFuncs.cs | 153 ++++++++++++++++++++++-------------------- 2 files changed, 136 insertions(+), 118 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9eb400e..171d176 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -752,7 +752,7 @@ namespace TL /// User identifier or 0 public long id; } - /// Indicates info about a certain user See + /// Indicates info about a certain user. See [TLDef(0x215C4438)] public sealed partial class User : UserBase { @@ -760,23 +760,23 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the user + /// ID of the user, see here » for more info. public long id; - /// Access hash of the user + /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
- The phone flag is not set OR
- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
- There is no locally cached object for this user OR
- There is no access_hash in the local cache OR
- The cached object's min_access_hash is also true
If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
[IfFlag(0)] public long access_hash; - /// First name + /// First name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(1)] public string first_name; - /// Last name + /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(2)] public string last_name; - /// Username + /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(3)] public string username; - /// Phone number + /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(4)] public string phone; - /// Profile picture of user + /// Profile picture of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The apply_min_photo flag is set OR
- The min flag of the locally cached user entry is set.
[IfFlag(5)] public UserProfilePhoto photo; - /// Online status of user + /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set OR
- The locally cached user entry is equal to .
[IfFlag(6)] public UserStatus status; - /// Version of the bot_info field in userFull, incremented every time it changes + /// Version of the bot_info field in userFull, incremented every time it changes.
Changes to this flag should invalidate the local cache for this user ID.
[IfFlag(14)] public int bot_info_version; /// Contains the reason why access to this user must be restricted. [IfFlag(18)] public RestrictionReason[] restriction_reason; @@ -786,7 +786,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; - /// Additional usernames + /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; /// ID of the maximum read story. [IfFlag(37)] public int stories_max_id; @@ -813,13 +813,13 @@ namespace TL has_status = 0x40, /// Whether this user indicates the currently logged in user self = 0x400, - /// Whether this user is a contact + /// Whether this user is a contact
When updating the local peer database, do not apply changes to this field if the min flag is set.
contact = 0x800, - /// Whether this user is a mutual contact + /// Whether this user is a mutual contact.
When updating the local peer database, do not apply changes to this field if the min flag is set.
mutual_contact = 0x1000, /// Whether the account of this user was deleted deleted = 0x2000, - /// Is this user a bot? + /// Is this user a bot?
Changes to this flag should invalidate the local cache for this user ID.
bot = 0x4000, /// Can the bot see all messages in groups? bot_chat_history = 0x8000, @@ -841,15 +841,15 @@ namespace TL support = 0x800000, /// This may be a scam user scam = 0x1000000, - /// If set, the profile picture for this user should be refetched + /// If set and min is set, the value of photo can be used to update the local database, see the documentation of that flag for more info. apply_min_photo = 0x2000000, /// If set, this user was reported by many users as a fake or scam user: be careful when interacting with them. fake = 0x4000000, /// Whether this bot offers an attachment menu web app bot_attach_menu = 0x8000000, - /// Whether this user is a Telegram Premium user + /// Whether this user is a Telegram Premium user
Changes to this flag should invalidate the local cache for this user ID.
Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches:
- The Help_GetConfig cache
- The Messages_GetTopReactions cache if the bot flag is not set
premium = 0x10000000, - /// Whether we installed the attachment menu web app offered by this bot + /// Whether we installed the attachment menu web app offered by this bot.
When updating the local peer database, do not apply changes to this field if the min flag is set.
attach_menu_enabled = 0x20000000, /// Field has a value has_emoji_status = 0x40000000, @@ -859,11 +859,11 @@ namespace TL { /// Field has a value has_usernames = 0x1, - /// Whether we can edit the profile picture, name, about text and description of this bot because we own it. + /// Whether we can edit the profile picture, name, about text and description of this bot because we own it.
When updating the local peer database, do not apply changes to this field if the min flag is set.
Changes to this flag (if min is not set) should invalidate the local cache for this user ID.
bot_can_edit = 0x2, - /// Whether we marked this user as a close friend, see here » for more info + /// Whether we marked this user as a close friend, see here » for more info.
When updating the local peer database, do not apply changes to this field if the min flag is set.
close_friend = 0x4, - /// Whether we have hidden » all active stories of this user. + /// Whether we have hidden » all active stories of this user.
When updating the local peer database, do not apply changes to this field if the min flag is set.
stories_hidden = 0x8, /// No stories from this user are visible. stories_unavailable = 0x10, @@ -931,6 +931,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the exact user status of this user is actually available to us, but to view it we must first purchase a Premium subscription, or allow this user to see our exact last online status. See here » for more info. by_me = 0x1, } } @@ -943,6 +944,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the exact user status of this user is actually available to us, but to view it we must first purchase a Premium subscription, or allow this user to see our exact last online status. See here » for more info. by_me = 0x1, } } @@ -955,6 +957,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the exact user status of this user is actually available to us, but to view it we must first purchase a Premium subscription, or allow this user to see our exact last online status. See here » for more info. by_me = 0x1, } } @@ -962,7 +965,7 @@ namespace TL /// Object defines a group. See Derived classes: , , , , public abstract partial class ChatBase : IObject { - /// ID of the group + /// ID of the group, see here » for more info public virtual long ID => default; /// Title public virtual string Title => default; @@ -983,7 +986,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// ID of the group + /// ID of the group, see here » for more info public long id; /// Title public string title; @@ -1024,7 +1027,7 @@ namespace TL noforwards = 0x2000000, } - /// ID of the group + /// ID of the group, see here » for more info public override long ID => id; /// Title public override string Title => title; @@ -1051,13 +1054,13 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the channel + /// ID of the channel, see here » for more info public long id; - /// Access hash + /// Access hash, see here » for more info [IfFlag(13)] public long access_hash; /// Title public string title; - /// Username + /// Main active username. [IfFlag(6)] public string username; /// Profile photo public ChatPhoto photo; @@ -1164,7 +1167,7 @@ namespace TL has_level = 0x400, } - /// ID of the channel + /// ID of the channel, see here » for more info public override long ID => id; /// Title public override string Title => title; @@ -2053,7 +2056,7 @@ namespace TL [IfFlag(0)] public WebDocumentBase photo; /// Message ID of receipt: if set, clients should change the text of the first button always attached to the to a localized version of the word Receipt [IfFlag(2)] public int receipt_msg_id; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. public string currency; /// Total price 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; @@ -2308,7 +2311,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. 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; @@ -2339,7 +2342,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. 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; @@ -4447,7 +4450,7 @@ namespace TL [IfFlag(0)] public PaymentRequestedInfo info; /// Identifier of the shipping option chosen by the user [IfFlag(1)] public string shipping_option_id; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. public string currency; /// Total amount 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; @@ -5414,6 +5417,7 @@ namespace TL { /// Story ID. public int story_id; + /// The peer where the story was posted. public Peer peer; /// The reaction. public Reaction reaction; @@ -6578,7 +6582,7 @@ namespace TL /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum InputPrivacyKey : uint { - ///Whether people will be able to see our exact last online timestamp.

Note that if we decide to hide our exact last online timestamp to someone and we do not have a
Premium subscription, we won't be able to see the exact last online timestamp of any user, including those that do share it with us.
+ ///Whether people will be able to see our exact last online timestamp.

Note that if we decide to hide our exact last online timestamp to someone (i.e., users A, B, C, or all users) and we do not have a Premium subscription, we won't be able to see the exact last online timestamp of those users (A, B, C, or all users), even if those users do share it with us.

If those users do share their exact online status with us, but we can't see it due to the reason mentioned above, the by_me flag of , , will be set.
StatusTimestamp = 0x4F96CB18, ///Whether people will be able to invite you to chats ChatInvite = 0xBDFB0426, @@ -6594,7 +6598,7 @@ namespace TL PhoneNumber = 0x0352DAFA, ///Whether people can add you to their contact list by your phone number AddedByPhone = 0xD1219BDD, - ///Whether people can send you voice messages + ///Whether people can send you voice messages or round videos (Premium users only). VoiceMessages = 0xAEE69D68, ///Whether people can see your bio About = 0x3823CC40, @@ -6605,7 +6609,7 @@ namespace TL /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See public enum PrivacyKey : uint { - ///Whether we can see the last online timestamp of this user.

Note that if we decide to hide our exact last online timestamp to someone and we do not have a
Premium subscription, we won't be able to see the exact last online timestamp of any user, including those that do share it with us.
+ ///Whether we can see the last online timestamp of this user.

Note that if we decide to hide our exact last online timestamp to someone (i.e., users A, B, C, or all users) and we do not have a Premium subscription, we won't be able to see the exact last online timestamp of those users (A, B, C, or all users), even if those users do share it with us.

If those users do share their exact online status with us, but we can't see it due to the reason mentioned above, the by_me flag of , , will be set.
StatusTimestamp = 0xBC2EAB30, ///Whether the user can be invited to chats ChatInvite = 0x500E6DFA, @@ -8762,7 +8766,7 @@ namespace TL public string description; /// Product photo [IfFlag(0)] public WebDocumentBase photo; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. public string currency; /// Total price 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; @@ -10106,7 +10110,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Three-letter ISO 4217 currency code + /// Three-letter ISO 4217 currency code, or XTR for Telegram Stars. public string currency; /// Price breakdown, a list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.) public LabeledPrice[] prices; @@ -10625,7 +10629,9 @@ namespace TL [IfFlag(2)] public WebDocumentBase photo; /// Invoice public Invoice invoice; + /// Currency, always XTR. public string currency; + /// Amount of Telegram Stars. public long total_amount; /// Transaction ID public string transaction_id; @@ -10650,7 +10656,9 @@ namespace TL public override WebDocumentBase Photo => photo; /// Invoice public override Invoice Invoice => invoice; + /// Currency, always XTR. public override string Currency => currency; + /// Amount of Telegram Stars. public override long TotalAmount => total_amount; /// Info about users mentioned in the other fields. public override Dictionary Users => users; @@ -10941,7 +10949,7 @@ namespace TL public long key_fingerprint; /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; - /// List of endpoints the user can connect to to exchange call data + /// List of endpoints the user can connect to exchange call data public PhoneConnectionBase[] connections; /// When was the call actually started public DateTime start_date; @@ -14779,19 +14787,19 @@ namespace TL public Flags flags; /// Message ID public byte[] random_id; - /// If set, contains a URL to open when the user clicks on the sponsored message. + /// Contains the URL to open when the user clicks on the sponsored message. public string url; - /// If set, contains a custom sender name should be displayed for the sponsored message, like for messages sent in groups. + /// Contains the title of the sponsored message. public string title; /// Sponsored message public string message; - /// Message entities for styled text + /// Message entities for styled text in message. [IfFlag(1)] public MessageEntity[] entities; /// If set, contains a custom profile photo bubble that should be displayed for the sponsored message, like for messages sent in groups. [IfFlag(6)] public PhotoBase photo; /// If set, the sponsored message should use the message accent color » specified in color. [IfFlag(13)] public PeerColor color; - /// Text of the sponsored message button. + /// Label of the sponsored message button. public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. [IfFlag(7)] public string sponsor_info; @@ -14810,7 +14818,7 @@ namespace TL has_sponsor_info = 0x80, /// Field has a value has_additional_info = 0x100, - /// Whether this message can be reported as specified here ». + /// Whether this message can be reported as specified here ». can_report = 0x1000, /// Field has a value has_color = 0x2000, @@ -18064,9 +18072,9 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Title of the introduction message + /// Title of the introduction message (max intro_title_length_limit » UTF-8 characters). public string title; - /// Profile introduction + /// Profile introduction (max intro_description_length_limit » UTF-8 characters). public string description; /// Optional introduction sticker. [IfFlag(0)] public DocumentBase sticker; @@ -18209,7 +18217,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// ID of the user. If neither of the flags below are set, we could not add the user because of their privacy settings, and we can create and directly share an invite link with them using a normal message, instead. + /// ID of the user. If neither of the flags below are set, we could not add the user because of their privacy settings, and we can create and directly share an invite link with them using a normal message, instead. public long user_id; [Flags] public enum Flags : uint @@ -18608,6 +18616,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the country/text fields will not be set, and the fact check must be fetched manually by the client (if it isn't already cached with the key specified in hash) using bundled Messages_GetFactCheck requests, when the message with the factcheck scrolls into view. need_check = 0x1, /// Fields and have a value has_country = 0x2, @@ -18625,7 +18634,7 @@ namespace TL /// Describes a Telegram Star transaction with the Play Store, used when purchasing Telegram Stars through the Play Store. See [TLDef(0x7B560A0B)] public sealed partial class StarsTransactionPeerPlayMarket : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction made using @PremiumBot (i.e. using the flow described here »). See [TLDef(0x250DBAF8)] public sealed partial class StarsTransactionPeerPremiumBot : StarsTransactionPeerBase { } /// Describes a Telegram Star transaction with Fragment, used when purchasing Telegram Stars through Fragment. See diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 65c2ffa..6ed2e97 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -142,6 +142,7 @@ namespace TL }); /// Registers a validated phone number in the system. See Possible codes: 400,406 (details) + /// If set, users on Telegram that have already added phone_number to their contacts will not receive signup notifications about this user. /// Phone number in the international format /// SMS-message ID /// New user first name @@ -259,6 +260,7 @@ namespace TL /// Resend the login code via another medium, the phone code type is determined by the return value of the previous auth.sendCode/auth.resendCode: see login for more info. See Possible codes: 400,406 (details) /// The phone number /// The phone code hash obtained from Auth_SendCode + /// Official clients only, used if the device integrity verification failed, and no secret could be obtained to invoke Auth_RequestFirebaseSms: in this case, the device integrity verification failure reason must be passed here. [Obsolete("Use LoginUserIfNeeded instead of this method. See https://wiz0u.github.io/WTelegramClient/FAQ#tlsharp")] public static Task Auth_ResendCode(this Client client, string phone_number, string phone_code_hash, string reason = null) => client.Invoke(new Auth_ResendCode @@ -363,7 +365,10 @@ namespace TL phone_code_hash = phone_code_hash, }); - /// See Possible codes: 400 (details) + /// Official apps only, reports that the SMS authentication code wasn't delivered. See Possible codes: 400 (details) + /// Phone number where we were supposed to receive the code + /// The phone code hash obtained from Auth_SendCode + /// MNC of the current network operator. public static Task Auth_ReportMissingCode(this Client client, string phone_number, string phone_code_hash, string mnc) => client.Invoke(new Auth_ReportMissingCode { @@ -931,7 +936,7 @@ namespace TL settings = settings, }); - /// Save a theme See + /// Save a theme See Possible codes: 400 (details) /// Theme to save /// Unsave public static Task Account_SaveTheme(this Client client, InputThemeBase theme, bool unsave) @@ -1078,7 +1083,7 @@ namespace TL hash = hash, }); - /// Save or remove saved notification sound. See + /// Save or remove saved notification sound. See Possible codes: 400 (details) /// Notification sound uploaded using Account_UploadRingtone /// Whether to add or delete the notification sound public static Task Account_SaveRingtone(this Client client, InputDocument id, bool unsave) @@ -1088,7 +1093,7 @@ namespace TL unsave = unsave, }); - /// Upload notification sound, use Account_SaveRingtone to convert it and add it to the list of saved notification sounds. See + /// Upload notification sound, use Account_SaveRingtone to convert it and add it to the list of saved notification sounds. See Possible codes: 400 (details) /// Notification sound /// File name /// MIME type of file @@ -1174,7 +1179,7 @@ namespace TL { }); - /// Modify autosave settings See [bots: ✓] Possible codes: 400 (details) + /// Modify autosave settings See Possible codes: 400 (details) /// Whether the new settings should affect all private chats /// Whether the new settings should affect all groups /// Whether the new settings should affect all channels @@ -1202,7 +1207,7 @@ namespace TL codes = codes, }); - /// Update the accent color and background custom emoji » of the current account. See Possible codes: 400 (details) + /// Update the accent color and background custom emoji » of the current account. See Possible codes: 400,403 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info). /// Custom emoji ID used in the accent color pattern. @@ -1279,7 +1284,7 @@ namespace TL message = message, }); - /// Connect a business bot » to the current account, or to change the current connection settings. See + /// 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 @@ -1333,7 +1338,7 @@ namespace TL peer = peer, }); - /// Update our birthday, see here » for more info. See + /// Update our birthday, see here » for more info. See Possible codes: 400 (details) /// Birthday. public static Task Account_UpdateBirthday(this Client client, Birthday birthday = null) => client.Invoke(new Account_UpdateBirthday @@ -1342,7 +1347,7 @@ namespace TL birthday = birthday, }); - /// Create a business chat deep link ». See + /// Create a business chat deep link ». See Possible codes: 400,403 (details) /// Info about the link to create. public static Task Account_CreateBusinessChatLink(this Client client, InputBusinessChatLink link) => client.Invoke(new Account_CreateBusinessChatLink @@ -1350,7 +1355,7 @@ namespace TL link = link, }); - /// Edit a created business chat deep link ». See Possible codes: 400 (details) + /// Edit a created business chat deep link ». See Possible codes: 400,403 (details) /// Slug of the link, obtained as specified here ». /// New link information. public static Task Account_EditBusinessChatLink(this Client client, string slug, InputBusinessChatLink link) @@ -1438,7 +1443,7 @@ namespace TL errors = errors, }); - /// Check whether we can write to the specified user (non-Premium users only), see here » for more info on the full flow. See + /// Check whether we can write to the specified user (this method can only be called by non-Premium users), see here » for more info on the full flow. See /// Users to fetch info about. public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetIsPremiumRequiredToContact @@ -1657,7 +1662,7 @@ namespace TL { }); - /// Obtain user info from a temporary profile link. See [bots: ✓] Possible codes: 400 (details) + /// Obtain user info from a temporary profile link. See Possible codes: 400 (details) /// The token extracted from the temporary profile link. public static Task Contacts_ImportContactToken(this Client client, string token) => client.Invoke(new Contacts_ImportContactToken @@ -2629,7 +2634,7 @@ namespace TL hash = hash, }); - /// Get stickers attached to a photo or video See + /// Get stickers attached to a photo or video See Possible codes: 400 (details) /// Stickered media public static Task Messages_GetAttachedStickers(this Client client, InputStickeredMedia media) => client.Invoke(new Messages_GetAttachedStickers @@ -2705,7 +2710,7 @@ namespace TL /// Get instant view page See Possible codes: 400 (details) /// URL of IV page to fetch - /// Hash used for caching, for more info click here + /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call or if the previous call did not return a . public static Task Messages_GetWebPage(this Client client, string url, int hash = default) => client.Invoke(new Messages_GetWebPage { @@ -2884,7 +2889,7 @@ namespace TL effect = effect.GetValueOrDefault(), }); - /// Upload encrypted file and associate it to a secret chat See + /// Upload encrypted file and associate it to a secret chat See Possible codes: 400 (details) /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty @@ -3082,7 +3087,7 @@ namespace TL url = url, }); - /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ». See + /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ». See Possible codes: 400 (details) /// Peer public static Task Messages_HidePeerSettingsBar(this Client client, InputPeer peer) => client.Invoke(new Messages_HidePeerSettingsBar @@ -3092,7 +3097,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer - /// Hash used for caching, for more info click here + /// Hash used for caching, for more info click here.
To generate the hash, populate the ids array with the id, date and edit_date (in this order) of the previously returned messages (in order, i.e. ids = [id1, date1, edit_date1, id2, date2, edit_date2, ...]). public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { @@ -3471,7 +3476,7 @@ namespace TL offset_date = offset_date, }); - /// Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. See + /// Returns sparse positions of messages of the specified type in the chat to be used for shared media scroll implementation. See Possible codes: 400 (details) /// Peer where to search /// Search within the saved message dialog » with this ID. /// Message filter, , filters are not supported by this method. @@ -3717,7 +3722,7 @@ namespace TL send_as = send_as, }); - /// Indicate to the server (from the user side) that the user is still using a web app. See + /// Indicate to the server (from the user side) that the user is still using a web app. See Possible codes: 400 (details) /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). /// Dialog where the web app was opened. /// Bot that owns the web app @@ -3764,7 +3769,7 @@ namespace TL result = result, }); - /// Used by the user to relay data from an opened reply keyboard bot mini app to the bot that owns it. See + /// Used by the user to relay data from an opened reply keyboard bot mini app to the bot that owns it. See Possible codes: 400 (details) /// Bot that owns the web app /// Unique client message ID to prevent duplicate sending of the same event You can use /// Text of the that was pressed to open the web app. @@ -3877,7 +3882,7 @@ namespace TL id = id, }); - /// Changes the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] Possible codes: 400 (details) + /// Changes the default value of the Time-To-Live setting, applied to all new chats. See Possible codes: 400 (details) /// The new default Time-To-Live of all messages sent in new chats. public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL @@ -3885,13 +3890,13 @@ namespace TL period = period, }); - /// Gets the default value of the Time-To-Live setting, applied to all new chats. See [bots: ✓] + /// Gets the default value of the Time-To-Live setting, applied to all new chats. See public static Task Messages_GetDefaultHistoryTTL(this Client client) => client.Invoke(new Messages_GetDefaultHistoryTTL { }); - /// Send one or more chosen peers, as requested by a button. See + /// Send one or more chosen peers, as requested by a button. See Possible codes: 400 (details) /// The bot that sent the button. /// ID of the message that contained the reply keyboard with the button. /// The button_id field from the . @@ -3905,7 +3910,7 @@ namespace TL requested_peers = requested_peers, }); - /// Represents a list of emoji categories. See [bots: ✓] + /// Represents a list of emoji categories. See /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) @@ -3914,7 +3919,7 @@ namespace TL hash = hash, }); - /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See [bots: ✓] + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) @@ -3923,7 +3928,7 @@ namespace TL hash = hash, }); - /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See [bots: ✓] + /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) @@ -3932,7 +3937,7 @@ namespace TL hash = hash, }); - /// Look for custom emojis associated to a UTF8 emoji See [bots: ✓] Possible codes: 400 (details) + /// Look for custom emojis associated to a UTF8 emoji See Possible codes: 400 (details) /// The emoji /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. /// a null value means emojiListNotModified @@ -3943,7 +3948,7 @@ namespace TL hash = hash, }); - /// Show or hide the real-time chat translation popup for a certain chat See [bots: ✓] + /// Show or hide the real-time chat translation popup for a certain chat See Possible codes: 400 (details) /// Whether to disable or enable the real-time chat translation popup /// The peer public static Task Messages_TogglePeerTranslations(this Client client, InputPeer peer, bool disabled = false) @@ -3981,7 +3986,7 @@ namespace TL platform = platform, }); - /// Set a custom wallpaper » in a specific private chat with another user. See [bots: ✓] Possible codes: 400 (details) + /// Set a custom wallpaper » in a specific private chat with another user. See Possible codes: 400 (details) /// Only for Premium users, sets the specified wallpaper for both users of the chat, without requiring confirmation from the other user. /// If we don't like the new wallpaper the other user of the chat has chosen for us using the for_both flag, we can re-set our previous wallpaper just on our side using this flag. /// The private chat where the wallpaper will be set @@ -4104,7 +4109,7 @@ namespace TL hash = hash, }); - /// Update the description of a saved message tag ». See Possible codes: 400 (details) + /// Update the description of a saved message tag ». See Possible codes: 400,403 (details) /// Reaction associated to the tag /// Tag description, max 12 UTF-8 characters; to remove the description call the method without setting this flag. public static Task Messages_UpdateSavedReactionTag(this Client client, Reaction reaction, string title = null) @@ -4143,7 +4148,7 @@ namespace TL hash = hash, }); - /// Reorder quick reply shortcuts. See + /// Reorder quick reply shortcuts. See Possible codes: 403 (details) /// IDs of all created quick reply shortcuts, in the desired order. public static Task Messages_ReorderQuickReplies(this Client client, params int[] order) => client.Invoke(new Messages_ReorderQuickReplies @@ -4151,7 +4156,7 @@ namespace TL order = order, }); - /// Before offering the user the choice to add a message to a quick reply shortcut, to make sure that none of the limits specified here » were reached. See + /// Before offering the user the choice to add a message to a quick reply shortcut, to make sure that none of the limits specified here » were reached. See Possible codes: 403 (details) /// Shorcut name (not ID!). public static Task Messages_CheckQuickReplyShortcut(this Client client, string shortcut) => client.Invoke(new Messages_CheckQuickReplyShortcut @@ -4159,7 +4164,7 @@ namespace TL shortcut = shortcut, }); - /// Rename a quick reply shortcut.
This will emit an update to other logged-in sessions. See Possible codes: 400 (details)
+ /// Rename a quick reply shortcut.
This will emit an update to other logged-in sessions. See Possible codes: 400,403 (details)
/// Shortcut ID. /// New shortcut name. public static Task Messages_EditQuickReplyShortcut(this Client client, int shortcut_id, string shortcut) @@ -4190,7 +4195,7 @@ namespace TL hash = hash, }); - /// Send a quick reply shortcut ». See Possible codes: 400 (details) + /// Send a quick reply shortcut ». See Possible codes: 400,403 (details) /// The peer where to send the shortcut (users only, for now). /// The ID of the quick reply shortcut to send. /// Specify a subset of messages from the shortcut to send; if empty, defaults to all of them. @@ -4214,7 +4219,7 @@ namespace TL id = id, }); - /// Enable or disable folder tags ». See + /// Enable or disable folder tags ». See Possible codes: 403 (details) /// Enable or disable folder tags. public static Task Messages_ToggleDialogFilterTags(this Client client, bool enabled) => client.Invoke(new Messages_ToggleDialogFilterTags @@ -4222,7 +4227,7 @@ namespace TL enabled = enabled, }); - /// Fetch stickerset owned by the current user. See + /// Fetch all stickersets » owned by the current user. See /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination public static Task Messages_GetMyStickers(this Client client, long offset_id = default, int limit = int.MaxValue) @@ -4250,7 +4255,7 @@ namespace TL hash = hash, }); - /// Edit/create a fact-check on a message. See Possible codes: 400 (details) + /// Edit/create a fact-check on a message. See Possible codes: 400,403 (details) /// Peer where the message was sent /// Message ID /// Fact-check (maximum UTF-8 length specified in appConfig.factcheck_length_limit). @@ -4262,7 +4267,7 @@ namespace TL text = text, }); - /// Delete a fact-check from a message. See Possible codes: 400 (details) + /// Delete a fact-check from a message. See Possible codes: 400,403 (details) /// Peer where the message was sent. /// Message ID public static Task Messages_DeleteFactCheck(this Client client, InputPeer peer, int msg_id) @@ -4272,7 +4277,9 @@ namespace TL msg_id = msg_id, }); - /// See Possible codes: 400 (details) + /// Fetch one or more factchecks, see here » for the full flow. See Possible codes: 400 (details) + /// Peer where the messages were sent. + /// Messages that have associated s with the need_check flag set. public static Task Messages_GetFactCheck(this Client client, InputPeer peer, params int[] msg_id) => client.Invoke(new Messages_GetFactCheck { @@ -4373,7 +4380,7 @@ namespace TL limit = limit, }); - /// Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. See [bots: ✓] Possible codes: 400 (details) + /// Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. See Possible codes: 400 (details) /// If set, will send a service message to user_id, suggesting them to use the specified profile picture; otherwise, will set a personal profile picture for the user (only visible to the current user). /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply deleted the service message with Messages_DeleteMessages). /// The contact @@ -4520,7 +4527,7 @@ namespace TL { }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] Possible codes: 400 (details) /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -5120,7 +5127,7 @@ namespace TL enabled = enabled, }); - /// Reorder active usernames See [bots: ✓] Possible codes: 400 (details) + /// Reorder active usernames See Possible codes: 400 (details) /// The supergroup or channel /// The new order for active usernames. All active usernames must be specified. public static Task Channels_ReorderUsernames(this Client client, InputChannelBase channel, params string[] order) @@ -5142,7 +5149,7 @@ namespace TL active = active, }); - /// Disable all purchased usernames of a supergroup or channel See [bots: ✓] + /// Disable all purchased usernames of a supergroup or channel See Possible codes: 400 (details) /// Supergroup or channel public static Task Channels_DeactivateAllUsernames(this Client client, InputChannelBase channel) => client.Invoke(new Channels_DeactivateAllUsernames @@ -5150,7 +5157,7 @@ namespace TL channel = channel, }); - /// Enable or disable forum functionality in a supergroup. See [bots: ✓] Possible codes: 400 (details) + /// Enable or disable forum functionality in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// Enable or disable forum functionality public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) @@ -5198,7 +5205,7 @@ namespace TL limit = limit, }); - /// Get forum topics by their ID See [bots: ✓] Possible codes: 400 (details) + /// Get forum topics by their ID See Possible codes: 400 (details) /// Forum /// Topic IDs public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) @@ -5227,7 +5234,7 @@ namespace TL hidden = hidden.GetValueOrDefault(), }); - /// Pin or unpin forum topics See [bots: ✓] Possible codes: 400 (details) + /// Pin or unpin forum topics See Possible codes: 400 (details) /// Supergroup ID /// Forum topic ID /// Whether to pin or unpin the topic @@ -5249,7 +5256,7 @@ namespace TL top_msg_id = top_msg_id, }, channel.ChannelId); - /// Reorder pinned forum topics See [bots: ✓] + /// Reorder pinned forum topics See Possible codes: 400 (details) /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) /// Supergroup ID /// Topic IDs » @@ -5261,7 +5268,7 @@ namespace TL order = order, }); - /// Enable or disable the native antispam system. See [bots: ✓] Possible codes: 400 (details) + /// Enable or disable the native antispam system. See Possible codes: 400 (details) /// Supergroup ID. The specified supergroup must have at least telegram_antispam_group_size_min members to enable antispam functionality, as specified by the client configuration parameters. /// Enable or disable the native antispam system. public static Task Channels_ToggleAntiSpam(this Client client, InputChannelBase channel, bool enabled) @@ -5271,7 +5278,7 @@ namespace TL enabled = enabled, }); - /// Report a native antispam false positive See [bots: ✓] + /// Report a native antispam false positive See Possible codes: 400 (details) /// Supergroup ID /// Message ID that was mistakenly deleted by the native antispam system, taken from the admin log public static Task Channels_ReportAntiSpamFalsePositive(this Client client, InputChannelBase channel, int msg_id) @@ -5281,7 +5288,7 @@ namespace TL msg_id = msg_id, }); - /// Hide or display the participants list in a supergroup. See [bots: ✓] Possible codes: 400 (details) + /// Hide or display the participants list in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// If true, will hide the participants list; otherwise will unhide it. public static Task Channels_ToggleParticipantsHidden(this Client client, InputChannelBase channel, bool enabled) @@ -5517,7 +5524,7 @@ namespace TL lang_code = lang_code, }); - /// Reorder usernames associated to a bot we own. See [bots: ✓] Possible codes: 400 (details) + /// Reorder usernames associated to a bot we own. See Possible codes: 400 (details) /// The bot /// The new order for active usernames. All active usernames must be specified. public static Task Bots_ReorderUsernames(this Client client, InputUserBase bot, params string[] order) @@ -5650,7 +5657,7 @@ namespace TL invoice_media = invoice_media, }); - /// Informs server about a purchase made through the App Store: for official applications only. See + /// Informs server about a purchase made through the App Store: for official applications only. See Possible codes: 400 (details) /// Receipt /// Payment purpose public static Task Payments_AssignAppStoreTransaction(this Client client, byte[] receipt, InputStorePaymentPurpose purpose) @@ -5660,7 +5667,7 @@ namespace TL purpose = purpose, }); - /// Informs server about a purchase made through the Play Store: for official applications only. See + /// Informs server about a purchase made through the Play Store: for official applications only. See Possible codes: 400 (details) /// Receipt /// Payment purpose public static Task Payments_AssignPlayMarketTransaction(this Client client, DataJSON receipt, InputStorePaymentPurpose purpose) @@ -5740,6 +5747,8 @@ namespace TL }); /// Fetch Telegram Stars transactions. See [bots: ✓] Possible codes: 400 (details) + /// If set, fetches only incoming transactions. + /// If set, fetches only outgoing transactions. /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool inbound = false, bool outbound = false, bool ascending = false) @@ -6030,7 +6039,7 @@ namespace TL debug = debug, }); - /// Send VoIP signaling data See + /// Send VoIP signaling data See Possible codes: 400 (details) /// Phone call /// Signaling payload public static Task Phone_SendSignalingData(this Client client, InputPhoneCall peer, byte[] data) @@ -6073,7 +6082,7 @@ namespace TL params_ = params_, }); - /// Leave a group call See + /// Leave a group call See Possible codes: 400 (details) /// The group call /// Your source ID public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) @@ -6123,7 +6132,7 @@ namespace TL limit = limit, }); - /// Get group call participants See + /// Get group call participants See Possible codes: 400 (details) /// Group call /// If specified, will fetch group participant info about the specified peers /// If specified, will fetch group participant info about the specified WebRTC source IDs @@ -6205,7 +6214,7 @@ namespace TL peer = peer, }); - /// Get an invite link for a group call or livestream See Possible codes: 403 (details) + /// Get an invite link for a group call or livestream See Possible codes: 400,403 (details) /// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). /// The group call public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false) @@ -6215,7 +6224,7 @@ namespace TL call = call, }); - /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 403 (details) + /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 400,403 (details) /// Scheduled group call /// Enable or disable subscription public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) @@ -6225,7 +6234,7 @@ namespace TL subscribed = subscribed, }); - /// Start a scheduled group call. See + /// Start a scheduled group call. See Possible codes: 400 (details) /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) => client.Invoke(new Phone_StartScheduledGroupCall @@ -6243,7 +6252,7 @@ namespace TL join_as = join_as, }); - /// Start screen sharing in a call See Possible codes: 403 (details) + /// Start screen sharing in a call See Possible codes: 400,403 (details) /// The group call /// WebRTC parameters public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) @@ -6253,7 +6262,7 @@ namespace TL params_ = params_, }); - /// Stop screen sharing in a group call See + /// Stop screen sharing in a group call See Possible codes: 400 (details) /// The group call public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) => client.Invoke(new Phone_LeaveGroupCallPresentation @@ -6279,7 +6288,7 @@ namespace TL revoke = revoke, }); - /// Save phone call debug information See + /// Save phone call debug information See Possible codes: 400 (details) /// Phone call /// Logs public static Task Phone_SaveCallLog(this Client client, InputPhoneCall peer, InputFileBase file) @@ -6476,7 +6485,7 @@ namespace TL peers = peers, }); - /// Delete a previously created chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Delete a previously created chat folder deep link ». See Possible codes: 400 (details) /// The related folder /// slug obtained from the chat folder deep link ». public static Task Chatlists_DeleteExportedInvite(this Client client, InputChatlist chatlist, string slug) @@ -6486,7 +6495,7 @@ namespace TL slug = slug, }); - /// Edit a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Edit a chat folder deep link ». See Possible codes: 400 (details) /// Folder ID /// slug obtained from the chat folder deep link ». /// If set, sets a new name for the link @@ -6501,7 +6510,7 @@ namespace TL peers = peers, }); - /// List all chat folder deep links » associated to a folder See [bots: ✓] + /// List all chat folder deep links » associated to a folder See Possible codes: 400 (details) /// The folder public static Task Chatlists_GetExportedInvites(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetExportedInvites @@ -6517,7 +6526,7 @@ namespace TL slug = slug, }); - /// Import a chat folder deep link », joining some or all the chats in the folder. See [bots: ✓] Possible codes: 400 (details) + /// Import a chat folder deep link », joining some or all the chats in the folder. See Possible codes: 400 (details) /// slug obtained from a chat folder deep link ». /// List of new chats to join, fetched using Chatlists_CheckChatlistInvite and filtered as specified in the documentation ». public static Task Chatlists_JoinChatlistInvite(this Client client, string slug, params InputPeer[] peers) @@ -6527,7 +6536,7 @@ namespace TL peers = peers, }); - /// Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »). See [bots: ✓] Possible codes: 400 (details) + /// Fetch new chats associated with an imported chat folder deep link ». Must be invoked at most every chatlist_update_period seconds (as per the related client configuration parameter »). See Possible codes: 400 (details) /// The folder public static Task Chatlists_GetChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetChatlistUpdates @@ -6535,7 +6544,7 @@ namespace TL chatlist = chatlist, }); - /// Join channels and supergroups recently added to a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Join channels and supergroups recently added to a chat folder deep link ». See Possible codes: 400 (details) /// The folder /// List of new chats to join, fetched using Chatlists_GetChatlistUpdates and filtered as specified in the documentation ». public static Task Chatlists_JoinChatlistUpdates(this Client client, InputChatlist chatlist, params InputPeer[] peers) @@ -6545,7 +6554,7 @@ namespace TL peers = peers, }); - /// Dismiss new pending peers recently added to a chat folder deep link ». See [bots: ✓] Possible codes: 400 (details) + /// Dismiss new pending peers recently added to a chat folder deep link ». See Possible codes: 400 (details) /// The folder public static Task Chatlists_HideChatlistUpdates(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_HideChatlistUpdates @@ -6553,7 +6562,7 @@ namespace TL chatlist = chatlist, }); - /// Returns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted. See [bots: ✓] Possible codes: 400 (details) + /// Returns identifiers of pinned or always included chats from a chat folder imported using a chat folder deep link », which are suggested to be left when the chat folder is deleted. See Possible codes: 400 (details) /// Folder ID public static Task Chatlists_GetLeaveChatlistSuggestions(this Client client, InputChatlist chatlist) => client.Invoke(new Chatlists_GetLeaveChatlistSuggestions @@ -6561,7 +6570,7 @@ namespace TL chatlist = chatlist, }); - /// Delete a folder imported using a chat folder deep link » See [bots: ✓] + /// Delete a folder imported using a chat folder deep link » See Possible codes: 400 (details) /// Folder ID /// Also leave the specified channels and groups public static Task Chatlists_LeaveChatlist(this Client client, InputChatlist chatlist, params InputPeer[] peers) @@ -6779,7 +6788,7 @@ namespace TL message = message, }); - /// Activates stories stealth mode, see here » for more info. See + /// Activates stories stealth mode, see here » for more info. See Possible codes: 400 (details) /// Whether to erase views from any stories opened in the past stories_stealth_past_period seconds », as specified by the client configuration. /// Whether to hide future story views for the next stories_stealth_future_period seconds », as specified by the client configuration. public static Task Stories_ActivateStealthMode(this Client client, bool past = false, bool future = false) From e5c6086e1199c947131c2ef44b526ef51501cd67 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 31 Jul 2024 19:35:34 +0200 Subject: [PATCH 223/336] API Layer 185: Bot stuff, Main Mini App, Stars payment stuff & more... --- README.md | 2 +- src/TL.Schema.cs | 118 ++++++++++++++--- src/TL.SchemaFuncs.cs | 252 ++++++++++++++++++++++++++++++------- src/TL.Table.cs | 17 ++- src/WTelegramClient.csproj | 2 +- 5 files changed, 323 insertions(+), 68 deletions(-) diff --git a/README.md b/README.md index a3e0daf..ffeec94 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-184-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-185-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 171d176..53e163c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -753,7 +753,7 @@ namespace TL public long id; } /// Indicates info about a certain user. See - [TLDef(0x215C4438)] + [TLDef(0x83314FCA)] public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -794,6 +794,7 @@ namespace TL [IfFlag(40)] public PeerColor color; /// The user's profile color. [IfFlag(41)] public PeerColor profile_color; + [IfFlag(44)] public int bot_active_users; [Flags] public enum Flags : uint { @@ -877,6 +878,9 @@ namespace TL contact_require_premium = 0x400, /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, + /// Field has a value + has_bot_active_users = 0x1000, + bot_has_main_app = 0x2000, } } @@ -2700,6 +2704,24 @@ namespace TL has_payload = 0x1, } } + /// See + [TLDef(0x45D5B021)] + public sealed partial class MessageActionGiftStars : MessageAction + { + public Flags flags; + public string currency; + public long amount; + public long stars; + [IfFlag(0)] public string crypto_currency; + [IfFlag(0)] public long crypto_amount; + [IfFlag(1)] public string transaction_id; + + [Flags] public enum Flags : uint + { + has_crypto_currency = 0x1, + has_transaction_id = 0x2, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -6789,7 +6811,7 @@ namespace TL } } /// Defines a video See - [TLDef(0xD38FF1C2)] + [TLDef(0x17399FAD)] public sealed partial class DocumentAttributeVideo : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -6802,6 +6824,7 @@ namespace TL public int h; /// Number of bytes to preload when preloading videos (particularly video stories). [IfFlag(2)] public int preload_prefix_size; + [IfFlag(4)] public double video_start_ts; [Flags] public enum Flags : uint { @@ -6813,6 +6836,8 @@ namespace TL has_preload_prefix_size = 0x4, /// Whether the specified document is a video file with no audio tracks (a GIF animation (even as MPEG4), for example) nosound = 0x8, + /// Field has a value + has_video_start_ts = 0x10, } } /// Represents an audio file See @@ -7507,6 +7532,7 @@ namespace TL has_description_photo = 0x10, /// Field has a value has_description_document = 0x20, + has_preview_medias = 0x40, } } @@ -9326,6 +9352,8 @@ namespace TL ForwardUsers = 0xA8406CA9, ///Chats to which the users often forwards messages to ForwardChats = 0xFBEEC0F0, + ///See + BotsApp = 0xFD9E7BEC, } /// Top peer category See @@ -15376,11 +15404,10 @@ namespace TL public PremiumGiftCodeOption option; } /// Used to top up the current account's Telegram Stars balance. See - [TLDef(0x1DA33AD8)] + [TLDef(0x65F00CE3)] public sealed partial class InputInvoiceStars : InputInvoice { - /// Top up option, obtained as described here ». - public StarsTopupOption option; + public InputStorePaymentPurpose purpose; } /// Exported invoice deep link See @@ -15519,22 +15546,22 @@ namespace TL has_prize_description = 0x10, } } - /// Used to top up the Telegram Stars balance using the Play Store/App Store flow (official apps only). See - [TLDef(0x4F0EE8DF)] - public sealed partial class InputStorePaymentStars : InputStorePaymentPurpose + /// See + [TLDef(0xDDDD0F56)] + public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Amount of stars to topup public long stars; - /// Three-letter ISO 4217 currency code public string currency; - /// Total price 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 amount; - - [Flags] public enum Flags : uint - { - } + } + /// See + [TLDef(0x1D741EF7)] + public sealed partial class InputStorePaymentStarsGift : InputStorePaymentPurpose + { + public InputUserBase user_id; + public long stars; + public string currency; + public long amount; } /// Telegram Premium gift option See @@ -16961,6 +16988,15 @@ namespace TL public MediaAreaCoordinates coordinates; public string url; } + /// See + [TLDef(0x49A6549C)] + public sealed partial class MediaAreaWeather : MediaArea + { + public MediaAreaCoordinates coordinates; + public string emoji; + public double temperature_c; + public int color; + } /// Stories associated to a peer See [TLDef(0x9A35E999)] @@ -18721,6 +18757,7 @@ namespace TL has_msg_id = 0x100, /// Field has a value has_extended_media = 0x200, + gift = 0x400, } } @@ -18847,4 +18884,51 @@ namespace TL refund = 0x1, } } + + /// See + [TLDef(0x5E0589F1)] + public sealed partial class StarsGiftOption : IObject + { + public Flags flags; + public long stars; + [IfFlag(0)] public string store_product; + public string currency; + public long amount; + + [Flags] public enum Flags : uint + { + has_store_product = 0x1, + extended = 0x2, + } + } + + /// See + [TLDef(0x1991B13B)] + public sealed partial class Bots_PopularAppBots : IObject + { + public Flags flags; + [IfFlag(0)] public string next_offset; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0x23E91BA3)] + public sealed partial class BotPreviewMedia : IObject + { + public DateTime date; + public MessageMedia media; + } + + /// See + [TLDef(0x0CA71D64)] + public sealed partial class Bots_PreviewInfo : IObject + { + public BotPreviewMedia[] media; + public string[] lang_codes; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 6ed2e97..1c5ddc9 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -453,7 +453,7 @@ namespace TL }); /// Returns a list of available wallpapers. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.wallPapersNotModified public static Task Account_GetWallPapers(this Client client, long hash = default) => client.Invoke(new Account_GetWallPapers @@ -972,7 +972,7 @@ namespace TL /// Get installed themes See /// Theme format, a string that identifies the theming engines supported by the client - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.themesNotModified public static Task Account_GetThemes(this Client client, string format, long hash = default) => client.Invoke(new Account_GetThemes @@ -1044,7 +1044,7 @@ namespace TL }); /// Get all available chat themes ». See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.themesNotModified public static Task Account_GetChatThemes(this Client client, long hash = default) => client.Invoke(new Account_GetChatThemes @@ -1075,7 +1075,7 @@ namespace TL }); /// Fetch saved notification sounds See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.savedRingtonesNotModified public static Task Account_GetSavedRingtones(this Client client, long hash = default) => client.Invoke(new Account_GetSavedRingtones @@ -1114,7 +1114,7 @@ namespace TL }); /// Get a list of default suggested emoji statuses See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.emojiStatusesNotModified public static Task Account_GetDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultEmojiStatuses @@ -1123,7 +1123,7 @@ namespace TL }); /// Get recently used emoji statuses See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.emojiStatusesNotModified public static Task Account_GetRecentEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetRecentEmojiStatuses @@ -1156,7 +1156,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as profile picture See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means emojiListNotModified public static Task Account_GetDefaultProfilePhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultProfilePhotoEmojis @@ -1165,7 +1165,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used as group picture See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means emojiListNotModified public static Task Account_GetDefaultGroupPhotoEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultGroupPhotoEmojis @@ -1220,7 +1220,7 @@ namespace TL }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means emojiListNotModified public static Task Account_GetDefaultBackgroundEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetDefaultBackgroundEmojis @@ -1229,7 +1229,7 @@ namespace TL }); /// Get a list of default suggested channel emoji statuses. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means account.emojiStatusesNotModified public static Task Account_GetChannelDefaultEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetChannelDefaultEmojiStatuses @@ -1238,7 +1238,7 @@ namespace TL }); /// Returns fetch the full list of custom emoji IDs » that cannot be used in channel emoji statuses ». See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means emojiListNotModified public static Task Account_GetChannelRestrictedStatusEmojis(this Client client, long hash = default) => client.Invoke(new Account_GetChannelRestrictedStatusEmojis @@ -1561,10 +1561,10 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash used for caching, for more info click here /// a null value means contacts.topPeersNotModified - public static Task Contacts_GetTopPeers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false) + public static Task Contacts_GetTopPeers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default, bool correspondents = false, bool bots_pm = false, bool bots_inline = false, bool phone_calls = false, bool forward_users = false, bool forward_chats = false, bool groups = false, bool channels = false, bool bots_app = false) => client.Invoke(new Contacts_GetTopPeers { - flags = (Contacts_GetTopPeers.Flags)((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0)), + flags = (Contacts_GetTopPeers.Flags)((correspondents ? 0x1 : 0) | (bots_pm ? 0x2 : 0) | (bots_inline ? 0x4 : 0) | (phone_calls ? 0x8 : 0) | (forward_users ? 0x10 : 0) | (forward_chats ? 0x20 : 0) | (groups ? 0x400 : 0) | (channels ? 0x8000 : 0) | (bots_app ? 0x10000 : 0)), offset = offset, limit = limit, hash = hash, @@ -2174,7 +2174,7 @@ namespace TL /// Get stickers by emoji See Possible codes: 400 (details) /// The emoji - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.stickersNotModified public static Task Messages_GetStickers(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_GetStickers @@ -2184,7 +2184,7 @@ namespace TL }); /// Get all installed stickers See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.allStickersNotModified public static Task Messages_GetAllStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetAllStickers @@ -2362,7 +2362,7 @@ namespace TL }); /// Get saved GIFs. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.savedGifsNotModified public static Task Messages_GetSavedGifs(this Client client, long hash = default) => client.Invoke(new Messages_GetSavedGifs @@ -2566,7 +2566,7 @@ namespace TL }); /// Get featured stickers See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. public static Task Messages_GetFeaturedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedStickers { @@ -2583,7 +2583,7 @@ namespace TL /// Get recent stickers See /// Get stickers recently attached to photo or video files - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.recentStickersNotModified public static Task Messages_GetRecentStickers(this Client client, long hash = default, bool attached = false) => client.Invoke(new Messages_GetRecentStickers @@ -2626,7 +2626,7 @@ namespace TL }); /// Get installed mask stickers See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.allStickersNotModified public static Task Messages_GetMaskStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetMaskStickers @@ -2800,7 +2800,7 @@ namespace TL }); /// Get faved stickers See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.favedStickersNotModified public static Task Messages_GetFavedStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFavedStickers @@ -2903,7 +2903,7 @@ namespace TL /// Search for stickersets See /// Exclude featured stickersets from results /// Query string - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchStickerSets @@ -3198,7 +3198,7 @@ namespace TL /// Method for fetching previously featured stickers See /// Offset /// Maximum number of results to return, see pagination - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. public static Task Messages_GetOldFeaturedStickers(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetOldFeaturedStickers { @@ -3593,7 +3593,7 @@ namespace TL }); /// Obtain available message reactions » See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.availableReactionsNotModified public static Task Messages_GetAvailableReactions(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableReactions @@ -3669,7 +3669,7 @@ namespace TL }); /// Returns installed attachment menu bot mini apps » See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means attachMenuBotsNotModified public static Task Messages_GetAttachMenuBots(this Client client, long hash = default) => client.Invoke(new Messages_GetAttachMenuBots @@ -3816,7 +3816,7 @@ namespace TL }); /// Gets the list of currently installed custom emoji stickersets. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.allStickersNotModified public static Task Messages_GetEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetEmojiStickers @@ -3825,7 +3825,7 @@ namespace TL }); /// Gets featured custom emoji stickersets. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. public static Task Messages_GetFeaturedEmojiStickers(this Client client, long hash = default) => client.Invoke(new Messages_GetFeaturedEmojiStickers { @@ -3846,7 +3846,7 @@ namespace TL /// Got popular message reactions See /// Maximum number of results to return, see pagination - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.reactionsNotModified public static Task Messages_GetTopReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetTopReactions @@ -3857,7 +3857,7 @@ namespace TL /// Get recently used message reactions See /// Maximum number of results to return, see pagination - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.reactionsNotModified public static Task Messages_GetRecentReactions(this Client client, int limit = int.MaxValue, long hash = default) => client.Invoke(new Messages_GetRecentReactions @@ -3911,7 +3911,7 @@ namespace TL }); /// Represents a list of emoji categories. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiGroups @@ -3920,7 +3920,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when selecting custom emojis to set as custom emoji status. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStatusGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStatusGroups @@ -3929,7 +3929,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when selecting custom emojis to set as profile picture. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiProfilePhotoGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiProfilePhotoGroups @@ -3939,7 +3939,7 @@ namespace TL /// Look for custom emojis associated to a UTF8 emoji See Possible codes: 400 (details) /// The emoji - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means emojiListNotModified public static Task Messages_SearchCustomEmoji(this Client client, string emoticon, long hash = default) => client.Invoke(new Messages_SearchCustomEmoji @@ -4006,7 +4006,7 @@ namespace TL /// Search for custom emoji stickersets » See /// Exclude featured stickersets from results /// Query string - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.foundStickerSetsNotModified public static Task Messages_SearchEmojiStickerSets(this Client client, string q, long hash = default, bool exclude_featured = false) => client.Invoke(new Messages_SearchEmojiStickerSets @@ -4099,7 +4099,7 @@ namespace TL /// Fetch the full list of saved message tags created by the user. See /// If set, returns tags only used in the specified saved message dialog. - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.savedReactionTagsNotModified public static Task Messages_GetSavedReactionTags(this Client client, long hash = default, InputPeer peer = null) => client.Invoke(new Messages_GetSavedReactionTags @@ -4121,7 +4121,7 @@ namespace TL }); /// Fetch a default recommended list of saved message tag reactions. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.reactionsNotModified public static Task Messages_GetDefaultTagReactions(this Client client, long hash = default) => client.Invoke(new Messages_GetDefaultTagReactions @@ -4238,7 +4238,7 @@ namespace TL }); /// Represents a list of emoji categories, to be used when choosing a sticker. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.emojiGroupsNotModified public static Task Messages_GetEmojiStickerGroups(this Client client, int hash = default) => client.Invoke(new Messages_GetEmojiStickerGroups @@ -4247,7 +4247,7 @@ namespace TL }); /// Fetch the full list of usable animated message effects ». See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means messages.availableEffectsNotModified public static Task Messages_GetAvailableEffects(this Client client, int hash = default) => client.Invoke(new Messages_GetAvailableEffects @@ -4287,6 +4287,18 @@ namespace TL msg_id = msg_id, }); + /// See + public static Task Messages_RequestMainWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, DataJSON theme_params = null, string start_param = null, bool compact = false) + => client.Invoke(new Messages_RequestMainWebView + { + flags = (Messages_RequestMainWebView.Flags)((theme_params != null ? 0x1 : 0) | (start_param != null ? 0x2 : 0) | (compact ? 0x80 : 0)), + peer = peer, + bot = bot, + start_param = start_param, + theme_params = theme_params, + platform = platform, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4575,7 +4587,7 @@ namespace TL }); /// Get app-specific configuration, see client configuration for more info on the result. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.appConfigNotModified public static Task Help_GetAppConfig(this Client client, int hash = default) => client.Invoke(new Help_GetAppConfig @@ -4592,7 +4604,7 @@ namespace TL }); /// Get passport configuration See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.passportConfigNotModified public static Task Help_GetPassportConfig(this Client client, int hash = default) => client.Invoke(new Help_GetPassportConfig @@ -4654,7 +4666,7 @@ namespace TL /// Get name, ISO code, localized name and phone codes/patterns of all available countries See /// Language code of the current user - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.countriesListNotModified public static Task Help_GetCountriesList(this Client client, string lang_code, int hash = default) => client.Invoke(new Help_GetCountriesList @@ -4670,7 +4682,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used for message accents. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerColors @@ -4679,7 +4691,7 @@ namespace TL }); /// Get the set of accent color palettes » that can be used in profile page backgrounds. See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.peerColorsNotModified public static Task Help_GetPeerProfileColors(this Client client, int hash = default) => client.Invoke(new Help_GetPeerProfileColors @@ -4688,7 +4700,7 @@ namespace TL }); /// Returns timezone information that may be used elsewhere in the API, such as to set Telegram Business opening hours ». See - /// Hash used for caching, for more info click here.
Note: the usual hash generation algorithm cannot be used in this case, please re-use the .hash field returned by a previous call to the method, or pass 0 if this is the first call. + /// Hash used for caching, for more info click here. /// a null value means help.timezonesListNotModified public static Task Help_GetTimezonesList(this Client client, int hash = default) => client.Invoke(new Help_GetTimezonesList @@ -5574,6 +5586,66 @@ namespace TL params_ = params_, }); + /// See + public static Task Bots_GetPopularAppBots(this Client client, string offset, int limit = int.MaxValue) + => client.Invoke(new Bots_GetPopularAppBots + { + offset = offset, + limit = limit, + }); + + /// See + public static Task Bots_AddPreviewMedia(this Client client, InputUserBase bot, string lang_code, InputMedia media) + => client.Invoke(new Bots_AddPreviewMedia + { + bot = bot, + lang_code = lang_code, + media = media, + }); + + /// See + public static Task Bots_EditPreviewMedia(this Client client, InputUserBase bot, string lang_code, InputMedia media, InputMedia new_media) + => client.Invoke(new Bots_EditPreviewMedia + { + bot = bot, + lang_code = lang_code, + media = media, + new_media = new_media, + }); + + /// See + public static Task Bots_DeletePreviewMedia(this Client client, InputUserBase bot, string lang_code, params InputMedia[] media) + => client.Invoke(new Bots_DeletePreviewMedia + { + bot = bot, + lang_code = lang_code, + media = media, + }); + + /// See + public static Task Bots_ReorderPreviewMedias(this Client client, InputUserBase bot, string lang_code, params InputMedia[] order) + => client.Invoke(new Bots_ReorderPreviewMedias + { + bot = bot, + lang_code = lang_code, + order = order, + }); + + /// See + public static Task Bots_GetPreviewInfo(this Client client, InputUserBase bot, string lang_code) + => client.Invoke(new Bots_GetPreviewInfo + { + bot = bot, + lang_code = lang_code, + }); + + /// See + public static Task Bots_GetPreviewMedias(this Client client, InputUserBase bot) + => client.Invoke(new Bots_GetPreviewMedias + { + bot = bot, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -5813,6 +5885,14 @@ namespace TL id = id, }); + /// See + public static Task Payments_GetStarsGiftOptions(this Client client, InputUserBase user_id = null) + => client.Invoke(new Payments_GetStarsGiftOptions + { + flags = (Payments_GetStarsGiftOptions.Flags)(user_id != null ? 0x1 : 0), + user_id = user_id, + }); + /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -6234,7 +6314,7 @@ namespace TL subscribed = subscribed, }); - /// Start a scheduled group call. See Possible codes: 400 (details) + /// Start a scheduled group call. See Possible codes: 400,403 (details) /// The scheduled group call public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) => client.Invoke(new Phone_StartScheduledGroupCall @@ -8242,6 +8322,7 @@ namespace TL.Methods forward_chats = 0x20, groups = 0x400, channels = 0x8000, + bots_app = 0x10000, } } @@ -10558,6 +10639,24 @@ namespace TL.Methods public int[] msg_id; } + [TLDef(0xC9E01E7B)] + public sealed partial class Messages_RequestMainWebView : IMethod + { + public Flags flags; + public InputPeer peer; + public InputUserBase bot; + [IfFlag(1)] public string start_param; + [IfFlag(0)] public DataJSON theme_params; + public string platform; + + [Flags] public enum Flags : uint + { + has_theme_params = 0x1, + has_start_param = 0x2, + compact = 0x80, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -11543,6 +11642,59 @@ namespace TL.Methods public DataJSON params_; } + [TLDef(0xC2510192)] + public sealed partial class Bots_GetPopularAppBots : IMethod + { + public string offset; + public int limit; + } + + [TLDef(0x17AEB75A)] + public sealed partial class Bots_AddPreviewMedia : IMethod + { + public InputUserBase bot; + public string lang_code; + public InputMedia media; + } + + [TLDef(0x8525606F)] + public sealed partial class Bots_EditPreviewMedia : IMethod + { + public InputUserBase bot; + public string lang_code; + public InputMedia media; + public InputMedia new_media; + } + + [TLDef(0x2D0135B3)] + public sealed partial class Bots_DeletePreviewMedia : IMethod + { + public InputUserBase bot; + public string lang_code; + public InputMedia[] media; + } + + [TLDef(0xB627F3AA)] + public sealed partial class Bots_ReorderPreviewMedias : IMethod + { + public InputUserBase bot; + public string lang_code; + public InputMedia[] order; + } + + [TLDef(0x423AB3AD)] + public sealed partial class Bots_GetPreviewInfo : IMethod + { + public InputUserBase bot; + public string lang_code; + } + + [TLDef(0xA2A5594D)] + public sealed partial class Bots_GetPreviewMedias : IMethod + { + public InputUserBase bot; + } + [TLDef(0x37148DBB)] public sealed partial class Payments_GetPaymentForm : IMethod { @@ -11758,6 +11910,18 @@ namespace TL.Methods public InputStarsTransaction[] id; } + [TLDef(0xD3C96BC8)] + public sealed partial class Payments_GetStarsGiftOptions : IMethod + { + public Flags flags; + [IfFlag(0)] public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + has_user_id = 0x1, + } + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f1ec34a..c3d993d 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 = 184; // fetched 17/07/2024 09:17:31 + public const int Version = 185; // fetched 31/07/2024 17:28:03 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -123,7 +123,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x215C4438] = typeof(User), + [0x83314FCA] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -210,6 +210,7 @@ namespace TL [0xCC02AA6D] = typeof(MessageActionBoostApply), [0x93B31848] = typeof(MessageActionRequestedPeerSentMe), [0x41B3E202] = typeof(MessageActionPaymentRefunded), + [0x45D5B021] = typeof(MessageActionGiftStars), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -508,7 +509,7 @@ namespace TL [0x6C37C15C] = typeof(DocumentAttributeImageSize), [0x11B58939] = typeof(DocumentAttributeAnimated), [0x6319D612] = typeof(DocumentAttributeSticker), - [0xD38FF1C2] = typeof(DocumentAttributeVideo), + [0x17399FAD] = typeof(DocumentAttributeVideo), [0x9852F9C6] = typeof(DocumentAttributeAudio), [0x15590068] = typeof(DocumentAttributeFilename), [0x9801D2F7] = typeof(DocumentAttributeHasStickers), @@ -1080,7 +1081,7 @@ namespace TL [0xC5B56859] = typeof(InputInvoiceMessage), [0xC326CAEF] = typeof(InputInvoiceSlug), [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), - [0x1DA33AD8] = typeof(InputInvoiceStars), + [0x65F00CE3] = typeof(InputInvoiceStars), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1088,7 +1089,8 @@ namespace TL [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0xA3805F3F] = typeof(InputStorePaymentPremiumGiftCode), [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), - [0x4F0EE8DF] = typeof(InputStorePaymentStars), + [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), + [0x1D741EF7] = typeof(InputStorePaymentStarsGift), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty @@ -1182,6 +1184,7 @@ namespace TL [0x770416AF] = typeof(MediaAreaChannelPost), [0x2271F2BF] = typeof(InputMediaAreaChannelPost), [0x37381085] = typeof(MediaAreaUrl), + [0x49A6549C] = typeof(MediaAreaWeather), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), @@ -1301,6 +1304,10 @@ namespace TL [0x1DAB80B7] = typeof(Payments_StarsRevenueWithdrawalUrl), [0x394E7F21] = typeof(Payments_StarsRevenueAdsAccountUrl), [0x206AE6D1] = typeof(InputStarsTransaction), + [0x5E0589F1] = typeof(StarsGiftOption), + [0x1991B13B] = typeof(Bots_PopularAppBots), + [0x23E91BA3] = typeof(BotPreviewMedia), + [0x0CA71D64] = typeof(Bots_PreviewInfo), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index c8d1dcc..9b4353c 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: 184 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 185 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From a28b9843956214da425af5a78290ed643f018c0c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 10 Aug 2024 23:29:08 +0200 Subject: [PATCH 224/336] Fix infinite recursion on Dispose after downloads (fix #274) --- .github/dev.yml | 2 +- src/Client.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7893558..567ecd3 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.6-dev.$(Rev:r) +name: 4.1.7-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 5efd138..5bb497f 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -49,7 +49,8 @@ namespace WTelegram /// Size of chunks when uploading/downloading files. Reduce this if you don't have much memory public int FilePartSize { get; set; } = 512 * 1024; /// Is this Client instance the main or a secondary DC session - public bool IsMainDC => (_dcSession?.DataCenter?.id - _session.MainDC) is null or 0; + public bool IsMainDC => _dcSession?.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) != true + && (_dcSession?.DataCenter?.id - _session.MainDC) is null or 0; /// Has this Client established connection been disconnected? public bool Disconnected => _tcpClient != null && !(_tcpClient.Client?.Connected ?? false); /// ID of the current logged-in user or 0 From dea7691075ad2facbc42c66cbce37efd3808bf3b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 Aug 2024 14:41:26 +0200 Subject: [PATCH 225/336] api doc --- .github/dev.yml | 2 +- FAQ.md | 5 +- src/TL.Schema.cs | 281 +++++++++++++++++++++++++++++------------- src/TL.SchemaFuncs.cs | 126 +++++++++++++------ 4 files changed, 286 insertions(+), 128 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 567ecd3..b994351 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.7-dev.$(Rev:r) +name: 4.1.8-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/FAQ.md b/FAQ.md index 8a5a040..76a889d 100644 --- a/FAQ.md +++ b/FAQ.md @@ -59,7 +59,6 @@ You also need to obtain their `access_hash` which is specific to the resource yo This serves as a proof that the logged-in user is entitled to access that channel/user/photo/document/... (otherwise, anybody with the ID could access it) -> [!IMPORTANT] > A small private group `Chat` don't need an access_hash and can be queried using their `chat_id` only. However most common chat groups are not `Chat` but a `Channel` supergroup (without the `broadcast` flag). See [Terminology in ReadMe](README.md#terminology). Some TL methods only applies to private `Chat`, some only applies to `Channel` and some to both. @@ -109,8 +108,8 @@ To fix this, you should also switch to using the [WTelegramClient Nuget package] You can get these kind of problems if you abuse Telegram [Terms of Service](https://telegram.org/tos), or the [API Terms of Service](https://core.telegram.org/api/terms), or make excessive requests. You can try to wait more between the requests, wait for a day or two to see if the requests become possible again. -> [!NOTE] -> For FLOOD_WAIT_X with X < 60 seconds (see `client.FloodRetryThreshold`), WTelegramClient will automatically wait the specified delay and retry the request for you. + +>ℹ️ For FLOOD_WAIT_X with X < 60 seconds (see `client.FloodRetryThreshold`), WTelegramClient will automatically wait the specified delay and retry the request for you. For longer delays, you can catch the thrown `RpcException` and check the value of property X. An account that was restricted due to reported spam might receive PEER_FLOOD errors. Read [Telegram Spam FAQ](https://telegram.org/faq_spam) to learn more. diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 53e163c..c6d7063 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -129,7 +129,7 @@ namespace TL public string last_name; } - /// Defines a file uploaded by the client. See Derived classes: , + /// Defines a file uploaded by the client. See Derived classes: , , public abstract partial class InputFileBase : IObject { /// Random file identifier created by the client @@ -178,7 +178,7 @@ namespace TL public override string Name { get => name; set => name = value; } } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract partial class InputMedia : IObject { } /// Photo See @@ -385,7 +385,7 @@ namespace TL public DataJSON provider_data; /// Unique bot deep links start parameter. If present, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter. If absent, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. [IfFlag(1)] public string start_param; - /// Extended media + /// Deprecated [IfFlag(2)] public InputMedia extended_media; [Flags] public enum Flags : uint @@ -485,11 +485,13 @@ namespace TL optional = 0x4, } } - /// See + /// Paid media, see here » for more info. See [TLDef(0xAA661FC3)] public sealed partial class InputMediaPaidMedia : InputMedia { + /// The price of the media in Telegram Stars. public long stars_amount; + /// Photos or videos. public InputMedia[] extended_media; } @@ -768,7 +770,7 @@ namespace TL [IfFlag(1)] public string first_name; /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(2)] public string last_name; - /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag should invalidate the local cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
[IfFlag(3)] public string username; /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
[IfFlag(4)] public string phone; @@ -776,7 +778,7 @@ namespace TL [IfFlag(5)] public UserProfilePhoto photo; /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set OR
- The locally cached user entry is equal to .
[IfFlag(6)] public UserStatus status; - /// Version of the bot_info field in userFull, incremented every time it changes.
Changes to this flag should invalidate the local cache for this user ID.
+ /// Version of the bot_info field in userFull, incremented every time it changes.
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
[IfFlag(14)] public int bot_info_version; /// Contains the reason why access to this user must be restricted. [IfFlag(18)] public RestrictionReason[] restriction_reason; @@ -788,12 +790,13 @@ namespace TL [IfFlag(30)] public EmojiStatus emoji_status; /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; - /// ID of the maximum read story. + /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
[IfFlag(37)] public int stories_max_id; /// The user's accent color. [IfFlag(40)] public PeerColor color; /// The user's profile color. [IfFlag(41)] public PeerColor profile_color; + /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; [Flags] public enum Flags : uint @@ -818,9 +821,9 @@ namespace TL contact = 0x800, /// Whether this user is a mutual contact.
When updating the local peer database, do not apply changes to this field if the min flag is set.
mutual_contact = 0x1000, - /// Whether the account of this user was deleted + /// Whether the account of this user was deleted.
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
deleted = 0x2000, - /// Is this user a bot?
Changes to this flag should invalidate the local cache for this user ID.
+ /// Is this user a bot?
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
bot = 0x4000, /// Can the bot see all messages in groups? bot_chat_history = 0x8000, @@ -848,7 +851,7 @@ namespace TL fake = 0x4000000, /// Whether this bot offers an attachment menu web app bot_attach_menu = 0x8000000, - /// Whether this user is a Telegram Premium user
Changes to this flag should invalidate the local cache for this user ID.
Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches:
- The Help_GetConfig cache
- The Messages_GetTopReactions cache if the bot flag is not set
+ /// Whether this user is a Telegram Premium user
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
Changes to this flag if the self flag is set should also trigger the following calls, to refresh the respective caches:
- The Help_GetConfig cache
- The Messages_GetTopReactions cache if the bot flag is not set
premium = 0x10000000, /// Whether we installed the attachment menu web app offered by this bot.
When updating the local peer database, do not apply changes to this field if the min flag is set.
attach_menu_enabled = 0x20000000, @@ -874,12 +877,13 @@ namespace TL has_color = 0x100, /// Field has a value has_profile_color = 0x200, - /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
+ /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user; alternatively, the .contact_require_premium flag contains the same (fully checked, i.e. it's not just a copy of this flag) info returned by Users_GetIsPremiumRequiredToContact.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
contact_require_premium = 0x400, /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, /// Field has a value has_bot_active_users = 0x1000, + /// If set, this bot has configured a Main Mini App ». bot_has_main_app = 0x2000, } } @@ -984,7 +988,7 @@ namespace TL /// Group identifier public override long ID => id; } - /// Info about a group See + /// Info about a group. See [TLDef(0x41CBF256)] public sealed partial class Chat : ChatBase { @@ -1070,7 +1074,7 @@ namespace TL public ChatPhoto photo; /// Date when the user joined the supergroup/channel, or if the user isn't a member, its creation date public DateTime date; - /// Contains the reason why access to this channel must be restricted. + /// Contains the reason why access to this channel must be restricted.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see
here » for more info.
[IfFlag(9)] public RestrictionReason[] restriction_reason; /// Admin rights of the user in this channel (see rights) [IfFlag(14)] public ChatAdminRights admin_rights; @@ -1090,7 +1094,7 @@ namespace TL [IfFlag(40)] public PeerColor profile_color; /// Emoji status [IfFlag(41)] public EmojiStatus emoji_status; - /// Boost level + /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
[IfFlag(42)] public int level; [Flags] public enum Flags : uint @@ -1105,9 +1109,9 @@ namespace TL has_username = 0x40, /// Is this channel verified by telegram? verified = 0x80, - /// Is this a supergroup? + /// Is this a supergroup?
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
megagroup = 0x100, - /// Whether viewing/writing in this channel for a reason (see restriction_reason + /// Whether viewing/writing in this channel for a reason (see restriction_reason) restricted = 0x200, /// Whether signatures are enabled (channels) signatures = 0x800, @@ -1123,29 +1127,29 @@ namespace TL has_participants_count = 0x20000, /// Field has a value has_default_banned_rights = 0x40000, - /// This channel/supergroup is probably a scam + /// This channel/supergroup is probably a scam
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
scam = 0x80000, - /// Whether this channel has a private join link + /// Whether this channel has a linked discussion group » (or this supergroup is a channel's discussion group). The actual ID of the linked channel/supergroup is contained in .linked_chat_id.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
has_link = 0x100000, /// Whether this chanel has a geoposition has_geo = 0x200000, - /// Whether slow mode is enabled for groups to prevent flood in chat + /// Whether slow mode is enabled for groups to prevent flood in chat.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
slowmode_enabled = 0x400000, /// Whether a group call or livestream is currently active call_active = 0x800000, /// Whether there's anyone in the group call or livestream call_not_empty = 0x1000000, - /// If set, this supergroup/channel was reported by many users as a fake or scam: be careful when interacting with it. + /// If set, this supergroup/channel was reported by many users as a fake or scam: be careful when interacting with it.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
fake = 0x2000000, - /// Whether this supergroup is a gigagroup + /// Whether this supergroup is a gigagroup
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
gigagroup = 0x4000000, /// Whether this channel or group is protected, thus does not allow forwarding messages from it noforwards = 0x8000000, - /// Whether a user needs to join the supergroup before they can send messages: can be false only for discussion groups », toggle using Channels_ToggleJoinToSend + /// Whether a user needs to join the supergroup before they can send messages: can be false only for discussion groups », toggle using Channels_ToggleJoinToSend
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
join_to_send = 0x10000000, - /// Whether a user's join request will have to be approved by administrators, toggle using Channels_ToggleJoinRequest + /// Whether a user's join request will have to be approved by administrators, toggle using Channels_ToggleJoinRequest
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
join_request = 0x20000000, - /// Whether this supergroup is a forum + /// Whether this supergroup is a forum.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
forum = 0x40000000, } @@ -1399,7 +1403,7 @@ namespace TL [IfFlag(9)] public int available_min_id; /// Peer folder ID, for more info click here [IfFlag(11)] public int folder_id; - /// ID of the linked discussion chat for channels + /// ID of the linked discussion chat for channels (and vice versa, the ID of the linked channel for discussion chats). [IfFlag(14)] public long linked_chat_id; /// Location of the geogroup [IfFlag(15)] public ChannelLocation location; @@ -1534,11 +1538,13 @@ namespace TL has_emojiset = 0x400, /// Whether ads on this channel were disabled as specified here » (this flag is only visible to the owner of the channel). restricted_sponsored = 0x800, - /// If set, this user can view ad revenue statistics » for this channel. + /// If set, this user can view ad revenue statistics » for this channel. can_view_revenue = 0x1000, /// Field has a value has_reactions_limit = 0x2000, + /// Whether the current user can send or forward paid media » to this channel. paid_media_allowed = 0x4000, + /// If set, this user can view Telegram Star revenue statistics » for this channel. can_view_stars_revenue = 0x8000, } @@ -1919,7 +1925,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2066,7 +2072,7 @@ namespace TL public long total_amount; /// Unique bot deep-linking parameter that can be used to generate this invoice public string start_param; - /// Extended media + /// Deprecated [IfFlag(4)] public MessageExtendedMediaBase extended_media; [Flags] public enum Flags : uint @@ -2213,15 +2219,17 @@ namespace TL has_additional_peers_count = 0x8, } } - /// See + /// Paid media, see here » for more info. See [TLDef(0xA8852491)] public sealed partial class MessageMediaPaidMedia : MessageMedia { + /// The price of the media in Telegram Stars. public long stars_amount; + /// Either the paid-for media, or super low resolution media previews if the media wasn't purchased yet, see here » for more info. public MessageExtendedMediaBase[] extended_media; } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2688,37 +2696,53 @@ namespace TL /// Info about the shared peers. public RequestedPeer[] peers; } - /// See + /// Describes a payment refund (service message received by both users and bots). See [TLDef(0x41B3E202)] public sealed partial class MessageActionPaymentRefunded : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the peer that returned the funds. public Peer peer; + /// Currency, XTR for Telegram Stars. public string currency; + /// Total price 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; + /// Bot specified invoice payload (only received by bots). [IfFlag(0)] public byte[] payload; + /// Provider payment identifier public PaymentCharge charge; [Flags] public enum Flags : uint { + /// Field has a value has_payload = 0x1, } } - /// See + /// You gifted or were gifted some Telegram Stars. See [TLDef(0x45D5B021)] public sealed partial class MessageActionGiftStars : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Three-letter ISO 4217 currency code public string currency; + /// Price of the gift 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 amount; + /// Amount of gifted stars public long stars; + /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; + /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. [IfFlag(0)] public long crypto_amount; + /// Identifier of the transaction, only visible to the receiver of the gift. [IfFlag(1)] public string transaction_id; [Flags] public enum Flags : uint { + /// Fields and have a value has_crypto_currency = 0x1, + /// Field has a value has_transaction_id = 0x2, } } @@ -3442,7 +3466,7 @@ namespace TL blocked_my_stories_from = 0x8000000, /// Whether the other user has chosen a custom wallpaper for us using Messages_SetChatWallPaper and the for_both flag, see here » for more info. wallpaper_overridden = 0x10000000, - /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
+ /// If set, we cannot write to this user: subscribe to Telegram Premium to get permission to write to this user.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag, see here » for more info.
contact_require_premium = 0x20000000, /// If set, we cannot fetch the exact read date of messages we send to this user using Messages_GetOutboxReadDate.
The exact read date of messages might still be unavailable for other reasons, see Messages_GetOutboxReadDate for more info.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.hide_read_marks flag.
read_dates_private = 0x40000000, @@ -3784,7 +3808,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4102,7 +4126,7 @@ namespace TL public override (long, int, int) GetMBox() => (channel_id, pts, 0); } - /// A new channel or supergroup is available, or info about an existing channel has changed and must be refeteched. See + /// Channel/supergroup ( and/or ) information was updated. See [TLDef(0x635B4C09)] public partial class UpdateChannel : Update { @@ -4825,7 +4849,7 @@ namespace TL public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); } - /// A new chat is available See + /// Chat ( and/or ) information was updated. See [TLDef(0xF89A6A4E)] public partial class UpdateChat : Update { @@ -5109,15 +5133,15 @@ namespace TL emojis = 0x2, } } - /// Extended media update See + /// You bought a paid media »: this update contains the revealed media. See [TLDef(0xD5A41724)] public sealed partial class UpdateMessageExtendedMedia : Update { - /// Peer + /// Peer where the paid media was posted public Peer peer; - /// Message ID + /// ID of the message containing the paid media public int msg_id; - /// Extended media + /// Revealed media, contains only s. public MessageExtendedMediaBase[] extended_media; } /// A forum topic » was pinned or unpinned. See @@ -5154,7 +5178,7 @@ namespace TL has_order = 0x1, } } - /// User ( and/or ) information was updated, it must be refetched using Users_GetFullUser. See + /// User ( and/or ) information was updated. See [TLDef(0x20529438)] public partial class UpdateUser : Update { @@ -5460,30 +5484,42 @@ namespace TL /// New balance. public long balance; } - /// See + /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] public sealed partial class UpdateBusinessBotCallbackQuery : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Query ID public long query_id; + /// ID of the user that pressed the button public long user_id; + /// Business connection ID public string connection_id; + /// Message that contains the keyboard (also contains info about the chat where the message was sent). public MessageBase message; + /// The message that message is replying to. [IfFlag(2)] public MessageBase reply_to_message; + /// Global identifier, uniquely corresponding to the chat to which the message with the callback button was sent. Useful for high scores in games. public long chat_instance; + /// Callback data [IfFlag(0)] public byte[] data; [Flags] public enum Flags : uint { + /// Field has a value has_data = 0x1, + /// Field has a value has_reply_to_message = 0x4, } } - /// See + /// The Telegram Star balance of a channel/bot we own has changed ». See [TLDef(0xA584B019)] public sealed partial class UpdateStarsRevenueStatus : Update { + /// Channel/bot public Peer peer; + /// New Telegram Star balance. public StarsRevenueStatus status; } @@ -6824,6 +6860,7 @@ namespace TL public int h; /// Number of bytes to preload when preloading videos (particularly video stories). [IfFlag(2)] public int preload_prefix_size; + /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; [Flags] public enum Flags : uint @@ -7532,6 +7569,7 @@ namespace TL has_description_photo = 0x10, /// Field has a value has_description_document = 0x20, + /// If set, the bot has some preview medias for the configured Main Mini App, see here » for more info on Main Mini App preview medias. has_preview_medias = 0x40, } } @@ -8008,7 +8046,7 @@ namespace TL public Flags flags; /// The latest PTS public int pts; - /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed + /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed, if the user is currently viewing the chat, see here » for more info. [IfFlag(1)] public int timeout; [Flags] public enum Flags : uint @@ -8056,7 +8094,7 @@ namespace TL public Flags flags; /// The PTS from which to start getting updates the next time public int pts; - /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed + /// Clients are supposed to refetch the channel difference after timeout seconds have elapsed, if the user is currently viewing the chat, see here » for more info. [IfFlag(1)] public int timeout; /// New messages public MessageBase[] new_messages; @@ -9161,6 +9199,7 @@ namespace TL public Flags flags; /// On Android, the nonce to be used as described in the auth documentation » [IfFlag(0)] public byte[] nonce; + /// Google Play Integrity project ID [IfFlag(2)] public long play_integrity_project_id; /// Play Integrity API nonce [IfFlag(2)] public byte[] play_integrity_nonce; @@ -9352,7 +9391,7 @@ namespace TL ForwardUsers = 0xA8406CA9, ///Chats to which the users often forwards messages to ForwardChats = 0xFBEEC0F0, - ///See + ///Most frequently used Main Mini Bot Apps. BotsApp = 0xFD9E7BEC, } @@ -9421,6 +9460,7 @@ namespace TL [IfFlag(5)] public InputMedia media; /// Date of last update of the draft. public DateTime date; + /// A message effect that should be played as specified here ». [IfFlag(7)] public long effect; [Flags] public enum Flags : uint @@ -12792,7 +12832,7 @@ namespace TL [TLDef(0xFF16E2CA)] public sealed partial class PollAnswer : IObject { - /// Textual representation of the answer (Premium users only, only custom emoji entities are supported). + /// Textual representation of the answer (only Premium users can use custom emoji entities here). public TextWithEntities text; /// The param that has to be passed to Messages_SendVote. public byte[] option; @@ -12806,7 +12846,7 @@ namespace TL public long id; /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The question of the poll (Premium users only, only custom emoji entities are supported). + /// The question of the poll (only Premium users can use custom emoji entities here). public TextWithEntities question; /// The possible answers, vote using Messages_SendVote. public PollAnswer[] answers; @@ -15270,8 +15310,9 @@ namespace TL [TLDef(0x4D22FF98)] public sealed partial class WebViewResultUrl : WebViewResult { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Webview session ID + /// Webview session ID (only returned by inline button mini apps, menu button mini apps, attachment menu mini apps). [IfFlag(0)] public long query_id; /// Webview URL to open public string url; @@ -15280,6 +15321,7 @@ namespace TL { /// Field has a value has_query_id = 0x1, + /// If set, the app must be opened in fullsize mode instead of compact mode. fullsize = 0x2, } } @@ -15378,11 +15420,11 @@ namespace TL /// An invoice See Derived classes: , , , public abstract partial class InputInvoice : IObject { } - /// An invoice contained in a message. See + /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] public sealed partial class InputInvoiceMessage : InputInvoice { - /// Chat where the invoice was sent + /// Chat where the invoice/paid media was sent public InputPeer peer; /// Message ID public int msg_id; @@ -15403,10 +15445,11 @@ namespace TL /// Should be populated with one of the giveaway options returned by Payments_GetPremiumGiftCodeOptions, see the giveaways » documentation for more info. public PremiumGiftCodeOption option; } - /// Used to top up the current account's Telegram Stars balance. See + /// Used to top up the Telegram Stars balance of the current account or someone else's account. See [TLDef(0x65F00CE3)] public sealed partial class InputInvoiceStars : InputInvoice { + /// Either an or an . public InputStorePaymentPurpose purpose; } @@ -15460,7 +15503,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , , , , + /// Info about a Telegram Premium purchase See Derived classes: , , , , , public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -15546,21 +15589,28 @@ namespace TL has_prize_description = 0x10, } } - /// See + /// Used to top up the Telegram Stars balance of the current account. See [TLDef(0xDDDD0F56)] public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { + /// Amount of stars to topup public long stars; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; } - /// See + /// Used to gift Telegram Stars to a friend. See [TLDef(0x1D741EF7)] public sealed partial class InputStorePaymentStarsGift : InputStorePaymentPurpose { + /// The user to which the stars should be gifted. public InputUserBase user_id; + /// Amount of stars to gift public long stars; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; } @@ -15783,9 +15833,9 @@ namespace TL } } - /// Extended media See Derived classes: , + /// Paid media, see here » for more info. See Derived classes: , public abstract partial class MessageExtendedMediaBase : IObject { } - /// Extended media preview See + /// Paid media preview for not yet purchased paid media, see here » for more info. See [TLDef(0xAD628CC8)] public sealed partial class MessageExtendedMediaPreview : MessageExtendedMediaBase { @@ -15795,9 +15845,9 @@ namespace TL [IfFlag(0)] public int w; /// Height [IfFlag(0)] public int h; - /// Thumbnail + /// Extremely low resolution thumbnail. [IfFlag(1)] public PhotoSizeBase thumb; - /// Video duration + /// Video duration for videos. [IfFlag(2)] public int video_duration; [Flags] public enum Flags : uint @@ -15810,11 +15860,11 @@ namespace TL has_video_duration = 0x4, } } - /// Extended media See + /// Already purchased paid media, see here » for more info. See [TLDef(0xEE479C64)] public sealed partial class MessageExtendedMedia : MessageExtendedMediaBase { - /// Media + /// The media we purchased. public MessageMedia media; } @@ -16871,6 +16921,7 @@ namespace TL [TLDef(0xCFC9E002)] public sealed partial class MediaAreaCoordinates : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The abscissa of the rectangle's center, as a percentage of the media width (0-100). public double x; @@ -16882,6 +16933,7 @@ namespace TL public double h; /// Clockwise rotation angle of the rectangle, in degrees (0-360). public double rotation; + /// The radius of the rectangle corner rounding, as a percentage of the media width. [IfFlag(0)] public double radius; [Flags] public enum Flags : uint @@ -16891,7 +16943,7 @@ namespace TL } } - /// Represents a story media area » See Derived classes: , , , , , + /// Represents a story media area » See Derived classes: , , , , , , , public abstract partial class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] @@ -16927,11 +16979,13 @@ namespace TL [TLDef(0xCAD5452D)] public sealed partial class MediaAreaGeoPoint : MediaArea { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The size and position of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; /// Coordinates of the geolocation tag. public GeoPoint geo; + /// Optional textual representation of the address. [IfFlag(0)] public GeoPointAddress address; [Flags] public enum Flags : uint @@ -16981,20 +17035,26 @@ namespace TL /// ID of the channel message public int msg_id; } - /// See + /// Represents a URL media area. See [TLDef(0x37381085)] public sealed partial class MediaAreaUrl : MediaArea { + /// The size and location of the media area corresponding to the URL button on top of the story media. public MediaAreaCoordinates coordinates; + /// URL to open when clicked. public string url; } - /// See + /// Represents a weather widget ». See [TLDef(0x49A6549C)] public sealed partial class MediaAreaWeather : MediaArea { + /// The size and location of the media area corresponding to the widget on top of the story media. public MediaAreaCoordinates coordinates; + /// Weather emoji, should be rendered as an animated emoji. public string emoji; + /// Temperature in degrees Celsius. public double temperature_c; + /// ARGB background color. public int color; } @@ -18481,7 +18541,7 @@ namespace TL public double usd_rate; } - /// Contains the URL to use to withdraw channel ad revenue. See + /// Contains the URL to use to withdraw channel ad revenue. See [TLDef(0xEC659737)] public sealed partial class Stats_BroadcastRevenueWithdrawalUrl : IObject { @@ -18502,7 +18562,7 @@ namespace TL /// End unixtime for the timeframe. public DateTime to_date; } - /// Describes a withdrawal of ad earnings » See + /// Describes a withdrawal of ad earnings » See [TLDef(0x5A590978)] public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction { @@ -18529,7 +18589,7 @@ namespace TL failed = 0x4, } } - /// Describes a refund for failed withdrawal of ad earnings » See + /// Describes a refund for failed withdrawal of ad earnings » See [TLDef(0x42D30D2E)] public sealed partial class BroadcastRevenueTransactionRefund : BroadcastRevenueTransaction { @@ -18659,7 +18719,7 @@ namespace TL } } - /// Source of an incoming Telegram Star transaction, or its recipient for outgoing Telegram Star transactions. See Derived classes: , , , , , + /// Source of an incoming Telegram Star transaction, or its recipient for outgoing Telegram Star transactions. See Derived classes: , , , , , , public abstract partial class StarsTransactionPeerBase : IObject { } /// Describes a Telegram Star transaction that cannot be described using the current layer. See [TLDef(0x95F2BFE4)] @@ -18670,20 +18730,20 @@ namespace TL /// Describes a Telegram Star transaction with the Play Store, used when purchasing Telegram Stars through the Play Store. See [TLDef(0x7B560A0B)] public sealed partial class StarsTransactionPeerPlayMarket : StarsTransactionPeerBase { } - /// Describes a Telegram Star transaction made using @PremiumBot (i.e. using the flow described here »). See + /// Describes a Telegram Star transaction made using @PremiumBot (i.e. using the flow described here »). See [TLDef(0x250DBAF8)] public sealed partial class StarsTransactionPeerPremiumBot : StarsTransactionPeerBase { } /// Describes a Telegram Star transaction with Fragment, used when purchasing Telegram Stars through Fragment. See [TLDef(0xE92FD902)] public sealed partial class StarsTransactionPeerFragment : StarsTransactionPeerBase { } - /// Describes a Telegram Star transaction with another peer (usually a bot or a channel). See + /// Describes a Telegram Star transaction with another peer. See [TLDef(0xD80DA15D)] public sealed partial class StarsTransactionPeer : StarsTransactionPeerBase { /// The peer. public Peer peer; } - /// See + /// Describes a Telegram Star transaction used to pay for Telegram ads as specified here ». See [TLDef(0x60682812)] public sealed partial class StarsTransactionPeerAds : StarsTransactionPeerBase { } @@ -18731,10 +18791,15 @@ namespace TL [IfFlag(1)] public string description; /// For transactions with bots, photo of the bought product. [IfFlag(2)] public WebDocumentBase photo; + /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain the point in time (Unix timestamp) when the withdrawal was completed successfully. [IfFlag(5)] public DateTime transaction_date; + /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain a URL where the withdrawal transaction can be viewed. [IfFlag(5)] public string transaction_url; + /// Bot specified invoice payload (i.e. the payload passed to when creating the invoice). [IfFlag(7)] public byte[] bot_payload; + /// For paid media transactions », message ID of the paid media posted to peer.peer (can point to a deleted message; either way, extended_media will always contain the bought media). [IfFlag(8)] public int msg_id; + /// The purchased paid media ». [IfFlag(9)] public MessageMedia[] extended_media; [Flags] public enum Flags : uint @@ -18747,9 +18812,11 @@ namespace TL has_photo = 0x4, /// Whether this transaction is a refund. refund = 0x8, + /// The transaction is currently pending. pending = 0x10, /// Fields and have a value has_transaction_date = 0x20, + /// This transaction has failed. failed = 0x40, /// Field has a value has_bot_payload = 0x80, @@ -18757,6 +18824,7 @@ namespace TL has_msg_id = 0x100, /// Field has a value has_extended_media = 0x200, + /// This transaction was a gift from the user in peer.peer. gift = 0x400, } } @@ -18787,148 +18855,195 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// A story found using global story search ». See [TLDef(0xE87ACBC0)] public sealed partial class FoundStory : IObject { + /// The peer that posted the story. public Peer peer; + /// The story. public StoryItemBase story; } - /// See + /// Stories found using global story search ». See [TLDef(0xE2DE7737)] public sealed partial class Stories_FoundStories : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results found for the query. public int count; + /// Matching stories. public FoundStory[] stories; + /// Offset used to fetch the next page, if not set this is the final page. [IfFlag(0)] public string next_offset; + /// Mentioned chats public Dictionary chats; + /// Mentioned users public Dictionary users; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Address optionally associated to a . See [TLDef(0xDE4C5D93)] public sealed partial class GeoPointAddress : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Two-letter ISO 3166-1 alpha-2 country code public string country_iso2; + /// State [IfFlag(0)] public string state; + /// City [IfFlag(1)] public string city; + /// Street [IfFlag(2)] public string street; [Flags] public enum Flags : uint { + /// Field has a value has_state = 0x1, + /// Field has a value has_city = 0x2, + /// Field has a value has_street = 0x4, } } - /// See + /// Describes Telegram Star revenue balances ». See [TLDef(0x79342946)] public sealed partial class StarsRevenueStatus : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Amount of not-yet-withdrawn Telegram Stars. public long current_balance; + /// Amount of withdrawable Telegram Stars. public long available_balance; + /// Total amount of earned Telegram Stars. public long overall_revenue; + /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. [IfFlag(1)] public int next_withdrawal_at; [Flags] public enum Flags : uint { + /// If set, the user may withdraw up to available_balance stars. withdrawal_enabled = 0x1, + /// Field has a value has_next_withdrawal_at = 0x2, } } - /// See + /// Star revenue statistics, see here » for more info. See [TLDef(0xC92BB73B)] public sealed partial class Payments_StarsRevenueStats : IObject { + /// Star revenue graph (number of earned stars) public StatsGraphBase revenue_graph; + /// Current balance, current withdrawable balance and overall earned Telegram Stars public StarsRevenueStatus status; + /// Current conversion rate of Telegram Stars to USD public double usd_rate; } - /// See + /// Contains the URL to use to withdraw Telegram Star revenue. See [TLDef(0x1DAB80B7)] public sealed partial class Payments_StarsRevenueWithdrawalUrl : IObject { + /// Contains the URL to use to withdraw Telegram Star revenue. public string url; } - /// See + /// Contains a URL leading to a page where the user will be able to place ads for the channel/bot, paying using Telegram Stars. See [TLDef(0x394E7F21)] public sealed partial class Payments_StarsRevenueAdsAccountUrl : IObject { + /// URL to open. public string url; } - /// See + /// Used to fetch info about a Telegram Star transaction ». See [TLDef(0x206AE6D1)] public sealed partial class InputStarsTransaction : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Transaction ID. public string id; [Flags] public enum Flags : uint { + /// If set, fetches info about the refund transaction for this transaction. refund = 0x1, } } - /// See + /// Telegram Stars gift option. See [TLDef(0x5E0589F1)] public sealed partial class StarsGiftOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Amount of Telegram stars. public long stars; + /// Identifier of the store product associated with the option, official apps only. [IfFlag(0)] public string store_product; + /// 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 amount; [Flags] public enum Flags : uint { + /// Field has a value has_store_product = 0x1, + /// If set, the option must only be shown in the full list of topup options. extended = 0x2, } } - /// See + /// Popular Main Mini Apps, to be used in the apps tab of global search ». See [TLDef(0x1991B13B)] public sealed partial class Bots_PopularAppBots : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Offset for pagination. [IfFlag(0)] public string next_offset; + /// The bots associated to each Main Mini App, see here » for more info. public Dictionary users; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } - /// See + /// Represents a Main Mini App preview media, see here » for more info. See [TLDef(0x23E91BA3)] public sealed partial class BotPreviewMedia : IObject { + /// When was this media last updated. public DateTime date; + /// The actual photo/video. public MessageMedia media; } - /// See + /// Contains info about Main Mini App previews, see here » for more info. See [TLDef(0x0CA71D64)] public sealed partial class Bots_PreviewInfo : IObject { + /// All preview medias for the language code passed to Bots_GetPreviewInfo. public BotPreviewMedia[] media; + /// All available language codes for which preview medias were uploaded (regardless of the language code passed to Bots_GetPreviewInfo). public string[] lang_codes; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 1c5ddc9..3b07b98 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -33,10 +33,10 @@ namespace TL /// Operation system version /// Application version /// Code for the language used on the device's OS, ISO 639-1 standard - /// Language pack to use - /// Code for the language used on the client, ISO 639-1 standard + /// Platform identifier (i.e. android, tdesktop, etc). + /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. /// Info about an MTProto proxy - /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying timezone offset in seconds. + /// Additional initConnection parameters.
For now, only the tz_offset field is supported, for specifying the timezone offset in seconds. /// The query itself public static Task InitConnection(this Client client, int api_id, string device_model, string system_version, string app_version, string system_lang_code, string lang_pack, string lang_code, IMethod query, InputClientProxy proxy = null, JSONValue params_ = null) => client.Invoke(new InitConnection @@ -1557,6 +1557,7 @@ namespace TL /// Chats to which the users often forwards messages to /// Often-opened groups and supergroups /// Most frequently visited channels + /// Most frequently used Main Mini Bot Apps. /// Offset for pagination /// Maximum number of results to return, see pagination /// Hash used for caching, for more info click here @@ -2547,6 +2548,7 @@ namespace TL /// The draft /// Message entities for styled text /// Attached media + /// Specifies a message effect » to use for the message. public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { @@ -3700,6 +3702,7 @@ namespace TL /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400,403 (details) /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). + /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the attachment menu deep link is equal to compact. /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). /// Bot that owns the web app /// Web app URL @@ -3742,10 +3745,11 @@ namespace TL /// Open a bot mini app. See Possible codes: 400 (details) /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. - /// Set this flag if opening the Mini App from the installed side menu entry » or from a Mini App link ». + /// Set this flag if opening the Mini App from the installed side menu entry ». + /// Deprecated. /// Bot that owns the mini app /// Web app URL, if opening from a keyboard button or inline result - /// Start parameter, if opening from a Mini App link ». + /// Deprecated. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false, bool compact = false) @@ -3872,9 +3876,9 @@ namespace TL { }); - /// Get information about extended media See - /// Peer - /// Message IDs + /// Fetch updated information about paid media, see here » for the full flow. See + /// Peer with visible paid media messages. + /// IDs of currently visible messages containing paid media. public static Task Messages_GetExtendedMedia(this Client client, InputPeer peer, params int[] id) => client.Invoke(new Messages_GetExtendedMedia { @@ -3970,6 +3974,7 @@ namespace TL /// Open a bot mini app from a direct Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) /// Set this flag if the bot is asking permission to send messages to the user as specified in the direct Mini App deep link docs, and the user agreed. + /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the direct Mini App deep link is equal to compact. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. /// The app obtained by invoking Messages_GetBotApp as specified in the direct Mini App deep link docs. /// If the startapp query string parameter is present in the direct Mini App deep link, pass it to start_param. @@ -4287,7 +4292,13 @@ namespace TL msg_id = msg_id, }); - /// See + /// Open a Main Mini App. See Possible codes: 400 (details) + /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the Main Mini App link is equal to compact. + /// Currently open chat, may be if no chat is currently open. + /// Bot that owns the main mini app. + /// Start parameter, if opening from a Main Mini App link ». + /// Theme parameters » + /// Short name of the application; 0-64 English letters, digits, and underscores public static Task Messages_RequestMainWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, DataJSON theme_params = null, string start_param = null, bool compact = false) => client.Invoke(new Messages_RequestMainWebView { @@ -4486,7 +4497,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400,500 (details) + /// 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, long offset = default) @@ -5586,7 +5597,9 @@ namespace TL params_ = params_, }); - /// See + /// Fetch popular Main Mini Apps, to be used in the apps tab of global search ». See + /// Offset for pagination, initially an empty string, then re-use the next_offset returned by the previous query. + /// Maximum number of results to return, see pagination public static Task Bots_GetPopularAppBots(this Client client, string offset, int limit = int.MaxValue) => client.Invoke(new Bots_GetPopularAppBots { @@ -5594,7 +5607,10 @@ namespace TL limit = limit, }); - /// See + /// Add a main mini app preview, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. + /// ISO 639-1 language code, indicating the localization of the preview to add. + /// The photo/video preview, uploaded using Messages_UploadMedia. public static Task Bots_AddPreviewMedia(this Client client, InputUserBase bot, string lang_code, InputMedia media) => client.Invoke(new Bots_AddPreviewMedia { @@ -5603,7 +5619,11 @@ namespace TL media = media, }); - /// See + /// Edit a main mini app preview, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. + /// ISO 639-1 language code, indicating the localization of the preview to edit. + /// The photo/video preview to replace, previously fetched as specified here ». + /// The new photo/video preview, uploaded using Messages_UploadMedia. public static Task Bots_EditPreviewMedia(this Client client, InputUserBase bot, string lang_code, InputMedia media, InputMedia new_media) => client.Invoke(new Bots_EditPreviewMedia { @@ -5613,7 +5633,10 @@ namespace TL new_media = new_media, }); - /// See + /// Delete a main mini app preview, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. + /// ISO 639-1 language code, indicating the localization of the preview to delete. + /// The photo/video preview to delete, previously fetched as specified here ». public static Task Bots_DeletePreviewMedia(this Client client, InputUserBase bot, string lang_code, params InputMedia[] media) => client.Invoke(new Bots_DeletePreviewMedia { @@ -5622,7 +5645,10 @@ namespace TL media = media, }); - /// See + /// Reorder a main mini app previews, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. + /// ISO 639-1 language code, indicating the localization of the previews to reorder. + /// New order of the previews. public static Task Bots_ReorderPreviewMedias(this Client client, InputUserBase bot, string lang_code, params InputMedia[] order) => client.Invoke(new Bots_ReorderPreviewMedias { @@ -5631,7 +5657,9 @@ namespace TL order = order, }); - /// See + /// Bot owners only, fetch main mini app preview information, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. + /// Fetch previews for the specified ISO 639-1 language code. public static Task Bots_GetPreviewInfo(this Client client, InputUserBase bot, string lang_code) => client.Invoke(new Bots_GetPreviewInfo { @@ -5639,7 +5667,8 @@ namespace TL lang_code = lang_code, }); - /// See + /// Fetch main mini app previews, see here » for more info. See Possible codes: 400 (details) + /// The bot that owns the Main Mini App. public static Task Bots_GetPreviewMedias(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetPreviewMedias { @@ -5749,7 +5778,7 @@ namespace TL purpose = purpose, }); - /// Checks whether Telegram Premium purchase is possible. Must be called before in-store Premium purchase, official apps only. See + /// 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 @@ -5804,7 +5833,7 @@ namespace TL purpose = purpose, }); - /// Obtain a list of Telegram Stars topup options » as s. See + /// Obtain a list of Telegram Stars topup options » as s. See public static Task Payments_GetStarsTopupOptions(this Client client) => client.Invoke(new Payments_GetStarsTopupOptions { @@ -5821,8 +5850,10 @@ namespace TL /// Fetch Telegram Stars transactions. See [bots: ✓] Possible codes: 400 (details) /// If set, fetches only incoming transactions. /// If set, fetches only outgoing transactions. + /// Return transactions in ascending order by date (instead of descending order by date). /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». + /// Maximum number of results to return, see pagination public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool inbound = false, bool outbound = false, bool ascending = false) => client.Invoke(new Payments_GetStarsTransactions { @@ -5853,7 +5884,9 @@ namespace TL charge_id = charge_id, }); - /// See + /// Get Telegram Star revenue statistics ». See Possible codes: 400 (details) + /// Whether to enable dark theme for graph colors + /// Get statistics for the specified bot, channel or ourselves (). public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false) => client.Invoke(new Payments_GetStarsRevenueStats { @@ -5861,7 +5894,10 @@ namespace TL peer = peer, }); - /// See + /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// Channel or bot from which to withdraw funds. + /// Amount of stars to withdraw. + /// 2FA password, see here » for more info. public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, long stars, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl { @@ -5870,14 +5906,17 @@ namespace TL password = password, }); - /// See + /// Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for channel/bot in peer, paid using the Telegram Stars owned by the specified peer, see here » for more info. See Possible codes: 400 (details) + /// Channel or bot that owns the stars. public static Task Payments_GetStarsRevenueAdsAccountUrl(this Client client, InputPeer peer) => client.Invoke(new Payments_GetStarsRevenueAdsAccountUrl { peer = peer, }); - /// See + /// Obtain info about Telegram Star transactions » using specific transaction IDs. See Possible codes: 400 (details) + /// Channel or bot. + /// Transaction IDs. public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, params InputStarsTransaction[] id) => client.Invoke(new Payments_GetStarsTransactionsByID { @@ -5885,7 +5924,8 @@ namespace TL id = id, }); - /// See + /// Obtain a list of Telegram Stars gift options » as s. See + /// Receiver of the gift (optional). public static Task Payments_GetStarsGiftOptions(this Client client, InputUserBase user_id = null) => client.Invoke(new Payments_GetStarsGiftOptions { @@ -5893,7 +5933,7 @@ namespace TL user_id = user_id, }); - /// Create a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. /// Whether the color of TGS custom emojis contained in this set should be changed to the text color when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context. For custom emoji stickersets only. @@ -5916,7 +5956,7 @@ namespace TL software = software, }); - /// Remove a sticker from the set where it belongs, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400 (details) + /// Remove a sticker from the set where it belongs. The sticker set must have been created by the current user/bot. See [bots: ✓] Possible codes: 400 (details) /// The sticker to remove /// a null value means messages.stickerSetNotModified public static Task Stickers_RemoveStickerFromSet(this Client client, InputDocument sticker) @@ -5925,7 +5965,7 @@ namespace TL sticker = sticker, }); - /// Changes the absolute position of a sticker in the set to which it belongs; for bots only. The sticker set must have been created by the bot See [bots: ✓] Possible codes: 400 (details) + /// Changes the absolute position of a sticker in the set to which it belongs. The sticker set must have been created by the current user/bot. See [bots: ✓] Possible codes: 400 (details) /// The sticker /// The new position of the sticker, zero-based /// a null value means messages.stickerSetNotModified @@ -5936,7 +5976,7 @@ namespace TL position = position, }); - /// Add a sticker to a stickerset, bots only. The sticker set must have been created by the bot. See [bots: ✓] Possible codes: 400,406 (details) + /// Add a sticker to a stickerset. The sticker set must have been created by the current user/bot. See [bots: ✓] Possible codes: 400,406 (details) /// The stickerset /// The sticker /// a null value means messages.stickerSetNotModified @@ -5977,7 +6017,7 @@ namespace TL title = title, }); - /// Update the keywords, emojis or mask coordinates of a sticker, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Update the keywords, emojis or mask coordinates of a sticker. See [bots: ✓] Possible codes: 400 (details) /// The sticker /// If set, updates the emoji list associated to the sticker /// If set, updates the mask coordinates @@ -5993,7 +6033,7 @@ namespace TL keywords = keywords, }); - /// Renames a stickerset, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Renames a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Stickerset to rename /// New stickerset title /// a null value means messages.stickerSetNotModified @@ -6004,7 +6044,7 @@ namespace TL title = title, }); - /// Deletes a stickerset we created, bots only. See [bots: ✓] Possible codes: 400 (details) + /// Deletes a stickerset we created. See [bots: ✓] Possible codes: 400 (details) /// Stickerset to delete public static Task Stickers_DeleteStickerSet(this Client client, InputStickerSet stickerset) => client.Invoke(new Stickers_DeleteStickerSet @@ -6379,8 +6419,8 @@ namespace TL }); /// Get localization pack strings See Possible codes: 400 (details) - /// Language pack name, usually obtained from a language pack link - /// Language code + /// Platform identifier (i.e. android, tdesktop, etc). + /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. public static Task Langpack_GetLangPack(this Client client, string lang_pack, string lang_code) => client.Invoke(new Langpack_GetLangPack { @@ -6389,8 +6429,8 @@ namespace TL }); /// Get strings from a language pack See Possible codes: 400 (details) - /// Language pack name, usually obtained from a language pack link - /// Language code + /// Platform identifier (i.e. android, tdesktop, etc). + /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. /// Strings to get public static Task Langpack_GetStrings(this Client client, string lang_pack, string lang_code, params string[] keys) => client.Invoke(new Langpack_GetStrings @@ -6401,8 +6441,8 @@ namespace TL }); /// Get new strings in language pack See Possible codes: 400 (details) - /// Language pack - /// Language code + /// Platform identifier (i.e. android, tdesktop, etc). + /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. /// Previous localization pack version public static Task Langpack_GetDifference(this Client client, string lang_pack, string lang_code, int from_version) => client.Invoke(new Langpack_GetDifference @@ -6413,7 +6453,7 @@ namespace TL }); /// Get information about all languages in a localization pack See Possible codes: 400 (details) - /// Language pack + /// Platform identifier (i.e. android, tdesktop, etc). public static Task Langpack_GetLanguages(this Client client, string lang_pack) => client.Invoke(new Langpack_GetLanguages { @@ -6421,8 +6461,8 @@ namespace TL }); /// Get information about a language in a localization pack See Possible codes: 400 (details) - /// Language pack name, usually obtained from a language pack link - /// Language code + /// Platform identifier (i.e. android, tdesktop, etc). + /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. public static Task Langpack_GetLanguage(this Client client, string lang_pack, string lang_code) => client.Invoke(new Langpack_GetLanguage { @@ -6957,7 +6997,11 @@ namespace TL id = id, }); - /// See + /// Globally search for stories using a hashtag or a location media area, see here » for more info on the full flow. See Possible codes: 400 (details) + /// Hashtag (without the #) + /// A or a .
Note areas may be searched only if they have an associated address. + /// Offset for pagination: initially an empty string, then the next_offset from the previously returned . + /// Maximum number of results to return, see pagination public static Task Stories_SearchPosts(this Client client, string offset, int limit = int.MaxValue, string hashtag = null, MediaArea area = null) => client.Invoke(new Stories_SearchPosts { From aef4fb795ad0da0b6e709114e07ee62283f8dbcc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 Aug 2024 15:14:41 +0200 Subject: [PATCH 226/336] API Layer 186: star subscriptions, Super Channels, paid reactions, ... --- README.md | 2 +- src/TL.Schema.cs | 165 +++++++++++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 151 +++++++++++++++++++++++++++++---- src/TL.Table.cs | 29 ++++--- src/TL.Xtended.cs | 20 +++++ src/WTelegramClient.csproj | 2 +- 6 files changed, 305 insertions(+), 64 deletions(-) diff --git a/README.md b/README.md index ffeec94..9a6e007 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-185-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-186-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://www.buymeacoffee.com/wizou) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index c6d7063..162370e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -130,15 +130,7 @@ namespace TL } /// Defines a file uploaded by the client. See Derived classes: , , - public abstract partial class InputFileBase : IObject - { - /// Random file identifier created by the client - public abstract long ID { get; set; } - /// Number of parts saved - public abstract int Parts { get; set; } - /// Full name of the file - public abstract string Name { get; set; } - } + public abstract partial class InputFileBase : IObject { } /// Defines a file saved in parts using the method Upload_SaveFilePart. See [TLDef(0xF52FF27F)] public sealed partial class InputFile : InputFileBase @@ -151,13 +143,6 @@ namespace TL public string name; /// In case the file's md5-hash was passed, contents of the file will be checked prior to use public string md5_checksum; - - /// Random file identifier created by the client - public override long ID { get => id; set => id = value; } - /// Number of parts saved - public override int Parts { get => parts; set => parts = value; } - /// Full name of the file - public override string Name { get => name; set => name = value; } } /// Assigns a big file (over 10 MB in size), saved in part using the method Upload_SaveBigFilePart. See [TLDef(0xFA4F0BB5)] @@ -169,13 +154,13 @@ namespace TL public int parts; /// Full file name public string name; - - /// Random file id, created by the client - public override long ID { get => id; set => id = value; } - /// Number of parts saved - public override int Parts { get => parts; set => parts = value; } - /// Full file name - public override string Name { get => name; set => name = value; } + } + /// Used to edit the thumbnail/static preview of a story, see here » for more info on the full flow. See + [TLDef(0x62DC8B48)] + public sealed partial class InputFileStoryDocument : InputFileBase + { + /// The old story video. + public InputDocument id; } /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , @@ -1055,7 +1040,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x0AADFC8F)] + [TLDef(0xFE4478BD)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1096,6 +1081,7 @@ namespace TL [IfFlag(41)] public EmojiStatus emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
[IfFlag(42)] public int level; + [IfFlag(43)] public DateTime subscription_until_date; [Flags] public enum Flags : uint { @@ -1173,6 +1159,9 @@ namespace TL has_emoji_status = 0x200, /// Field has a value has_level = 0x400, + /// Field has a value + has_subscription_until_date = 0x800, + signature_profiles = 0x1000, } /// ID of the channel, see here » for more info @@ -1546,6 +1535,7 @@ namespace TL paid_media_allowed = 0x4000, /// If set, this user can view Telegram Star revenue statistics » for this channel. can_view_stars_revenue = 0x8000, + paid_reactions_available = 0x10000, } /// ID of the channel @@ -7297,7 +7287,7 @@ namespace TL /// Exported chat invite See Derived classes: , public abstract partial class ExportedChatInvite : IObject { } /// Exported chat invite See - [TLDef(0x0AB4A819)] + [TLDef(0xA22CBD96)] public sealed partial class ChatInviteExported : ExportedChatInvite { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7318,8 +7308,10 @@ namespace TL [IfFlag(3)] public int usage; /// Number of users that have already used this link to join [IfFlag(7)] public int requested; + [IfFlag(10)] public int subscription_expired; /// Custom description for the invite link, visible only to admins [IfFlag(8)] public string title; + [IfFlag(9)] public StarsSubscriptionPricing subscription_pricing; [Flags] public enum Flags : uint { @@ -7341,6 +7333,10 @@ namespace TL has_requested = 0x80, /// Field has a value has_title = 0x100, + /// Field has a value + has_subscription_pricing = 0x200, + /// Field has a value + has_subscription_expired = 0x400, } } /// Used in updates and in the channel log to indicate when a user is requesting to join or has joined a discussion group See @@ -7357,7 +7353,7 @@ namespace TL public ChatBase chat; } /// Chat invite info See - [TLDef(0xCDE0EC40)] + [TLDef(0xFE65389D)] public sealed partial class ChatInvite : ChatInviteBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7374,6 +7370,8 @@ namespace TL [IfFlag(4)] public UserBase[] participants; /// Profile color palette ID public int color; + [IfFlag(10)] public StarsSubscriptionPricing subscription_pricing; + [IfFlag(12)] public long subscription_form_id; [Flags] public enum Flags : uint { @@ -7397,6 +7395,11 @@ namespace TL scam = 0x100, /// If set, this chat was reported by many users as a fake or scam: be careful when interacting with it. fake = 0x200, + /// Field has a value + has_subscription_pricing = 0x400, + can_refulfill_subscription = 0x800, + /// Field has a value + has_subscription_form_id = 0x1000, } } /// A chat invitation that also allows peeking into the group to read messages without joining it. See @@ -7537,7 +7540,7 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0x8F300B57)] + [TLDef(0x82437E74)] public sealed partial class BotInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7554,6 +7557,7 @@ namespace TL [IfFlag(2)] public BotCommand[] commands; /// Indicates the action to execute when pressing the in-UI menu button for bots [IfFlag(3)] public BotMenuButtonBase menu_button; + [IfFlag(7)] public string privacy_policy_url; [Flags] public enum Flags : uint { @@ -7571,6 +7575,8 @@ namespace TL has_description_document = 0x20, /// If set, the bot has some preview medias for the configured Main Mini App, see here » for more info on Main Mini App preview medias. has_preview_medias = 0x40, + /// Field has a value + has_privacy_policy_url = 0x80, } } @@ -8136,16 +8142,24 @@ namespace TL /// Channel participant See Derived classes: , , , , , public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See - [TLDef(0xC00C07C0)] + [TLDef(0xCB397619)] public sealed partial class ChannelParticipant : ChannelParticipantBase { + public Flags flags; /// Participant user ID public long user_id; /// Date joined public DateTime date; + [IfFlag(0)] public DateTime subscription_until_date; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_subscription_until_date = 0x1, + } } /// Myself See - [TLDef(0x35A8BFA7)] + [TLDef(0x4F607BEF)] public sealed partial class ChannelParticipantSelf : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -8156,11 +8170,14 @@ namespace TL public long inviter_id; /// When did I join the channel/supergroup public DateTime date; + [IfFlag(1)] public DateTime subscription_until_date; [Flags] public enum Flags : uint { /// Whether I joined upon specific approval of an admin via_request = 0x1, + /// Field has a value + has_subscription_until_date = 0x2, } } /// Channel/supergroup creator See @@ -11390,7 +11407,7 @@ namespace TL } /// Channel signatures were enabled/disabled See [TLDef(0x26AE0971)] - public sealed partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction + public partial class ChannelAdminLogEventActionToggleSignatures : ChannelAdminLogEventAction { /// New value public bool new_value; @@ -11727,6 +11744,9 @@ namespace TL /// The supergroup's custom emoji stickerset was changed. See [TLDef(0x46D840AB)] public sealed partial class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } + /// See + [TLDef(0x60A79C79)] + public sealed partial class ChannelAdminLogEventActionToggleSignatureProfiles : ChannelAdminLogEventActionToggleSignatures { } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -14848,7 +14868,7 @@ namespace TL public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0xBDEDF566)] + [TLDef(0x4D93A990)] public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14865,6 +14885,7 @@ namespace TL [IfFlag(1)] public MessageEntity[] entities; /// If set, contains a custom profile photo bubble that should be displayed for the sponsored message, like for messages sent in groups. [IfFlag(6)] public PhotoBase photo; + [IfFlag(14)] public MessageMedia media; /// If set, the sponsored message should use the message accent color » specified in color. [IfFlag(13)] public PeerColor color; /// Label of the sponsored message button. @@ -14890,6 +14911,8 @@ namespace TL can_report = 0x1000, /// Field has a value has_color = 0x2000, + /// Field has a value + has_media = 0x4000, } } @@ -15069,7 +15092,7 @@ namespace TL } /// Message reactions » See - [TLDef(0x4F2B9479)] + [TLDef(0x0A339F0B)] public sealed partial class MessageReactions : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15078,6 +15101,7 @@ namespace TL public ReactionCount[] results; /// List of recent peers and their reactions [IfFlag(1)] public MessagePeerReaction[] recent_reactions; + [IfFlag(4)] public MessageReactor[] top_reactors; [Flags] public enum Flags : uint { @@ -15089,6 +15113,8 @@ namespace TL can_see_list = 0x4, /// If set or if there are no reactions, all present and future reactions should be treated as message tags, see here » for more info. reactions_as_tags = 0x8, + /// Field has a value + has_top_reactors = 0x10, } } @@ -15452,6 +15478,12 @@ namespace TL /// Either an or an . public InputStorePaymentPurpose purpose; } + /// See + [TLDef(0x34E793F1)] + public sealed partial class InputInvoiceChatInviteSubscription : InputInvoice + { + public string hash; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -15692,6 +15724,9 @@ namespace TL /// Custom emoji document ID public long document_id; } + /// See + [TLDef(0x523DA4EB)] + public sealed partial class ReactionPaid : Reaction { } /// Available chat reactions See Derived classes: , /// a value means chatReactionsNone @@ -18772,7 +18807,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0x2DB5418F)] + [TLDef(0x433AEB2B)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18801,6 +18836,7 @@ namespace TL [IfFlag(8)] public int msg_id; /// The purchased paid media ». [IfFlag(9)] public MessageMedia[] extended_media; + [IfFlag(12)] public int subscription_period; [Flags] public enum Flags : uint { @@ -18826,19 +18862,25 @@ namespace TL has_extended_media = 0x200, /// This transaction was a gift from the user in peer.peer. gift = 0x400, + reaction = 0x800, + /// Field has a value + has_subscription_period = 0x1000, } } /// Info about the current Telegram Star balance and transaction history ». See - [TLDef(0x8CF4EE60)] + [TLDef(0xBBFA316C)] public sealed partial class Payments_StarsStatus : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current Telegram Star balance. public long balance; + [IfFlag(1)] public StarsSubscription[] subscriptions; + [IfFlag(2)] public string subscriptions_next_offset; + [IfFlag(4)] public long subscriptions_missing_balance; /// List of Telegram Star transactions (partial if next_offset is set). - public StarsTransaction[] history; + [IfFlag(3)] public StarsTransaction[] history; /// Offset to use to fetch more transactions from the transaction history using Payments_GetStarsTransactions. [IfFlag(0)] public string next_offset; /// Chats mentioned in history. @@ -18850,6 +18892,14 @@ namespace TL { /// Field has a value has_next_offset = 0x1, + /// Field has a value + has_subscriptions = 0x2, + /// Field has a value + has_subscriptions_next_offset = 0x4, + /// Field has a value + has_history = 0x8, + /// Field has a value + has_subscriptions_missing_balance = 0x10, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -19046,4 +19096,49 @@ namespace TL /// All available language codes for which preview medias were uploaded (regardless of the language code passed to Bots_GetPreviewInfo). public string[] lang_codes; } + + /// See + [TLDef(0x05416D58)] + public sealed partial class StarsSubscriptionPricing : IObject + { + public int period; + public long amount; + } + + /// See + [TLDef(0x538ECF18)] + public sealed partial class StarsSubscription : IObject + { + public Flags flags; + public string id; + public Peer peer; + public DateTime until_date; + public StarsSubscriptionPricing pricing; + [IfFlag(3)] public string chat_invite_hash; + + [Flags] public enum Flags : uint + { + canceled = 0x1, + can_refulfill = 0x2, + missing_balance = 0x4, + has_chat_invite_hash = 0x8, + } + } + + /// See + [TLDef(0x4BA3A95A)] + public sealed partial class MessageReactor : IObject + { + public Flags flags; + [IfFlag(3)] public Peer peer_id; + public int count; + + [Flags] public enum Flags : uint + { + top = 0x1, + my = 0x2, + anonymous = 0x4, + has_peer_id = 0x8, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 3b07b98..490010f 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2212,14 +2212,15 @@ namespace TL /// Expiration date /// Maximum number of users that can join using this link /// Description of the invite link, visible only to administrators - public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, DateTime? expire_date = null, int? usage_limit = null, string title = null, bool legacy_revoke_permanent = false, bool request_needed = false) + public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, DateTime? expire_date = null, int? usage_limit = null, string title = null, StarsSubscriptionPricing subscription_pricing = null, bool legacy_revoke_permanent = false, bool request_needed = false) => client.Invoke(new Messages_ExportChatInvite { - flags = (Messages_ExportChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0) | (legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0)), + flags = (Messages_ExportChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0) | (subscription_pricing != null ? 0x20 : 0) | (legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0)), peer = peer, expire_date = expire_date.GetValueOrDefault(), usage_limit = usage_limit.GetValueOrDefault(), title = title, + subscription_pricing = subscription_pricing, }); /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) @@ -3411,10 +3412,10 @@ namespace TL /// Offsets for pagination, for more info click here /// User ID for pagination: if set, offset_date must also be set. /// Maximum number of results to return, see pagination - public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false) + public static Task Messages_GetChatInviteImporters(this Client client, InputPeer peer, DateTime offset_date = default, InputUserBase offset_user = null, int limit = int.MaxValue, string link = null, string q = null, bool requested = false, bool subscription_expired = false) => client.Invoke(new Messages_GetChatInviteImporters { - flags = (Messages_GetChatInviteImporters.Flags)((link != null ? 0x2 : 0) | (q != null ? 0x4 : 0) | (requested ? 0x1 : 0)), + flags = (Messages_GetChatInviteImporters.Flags)((link != null ? 0x2 : 0) | (q != null ? 0x4 : 0) | (requested ? 0x1 : 0) | (subscription_expired ? 0x8 : 0)), peer = peer, link = link, q = q, @@ -3585,13 +3586,14 @@ namespace TL /// Group where to apply changes /// Allowed reaction emojis /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max); this field and the other info set by the method will then be available to users in and . - public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null) + public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null, bool? paid_enabled = default) => client.Invoke(new Messages_SetChatAvailableReactions { - flags = (Messages_SetChatAvailableReactions.Flags)(reactions_limit != null ? 0x1 : 0), + flags = (Messages_SetChatAvailableReactions.Flags)((reactions_limit != null ? 0x1 : 0) | (paid_enabled != default ? 0x2 : 0)), peer = peer, available_reactions = available_reactions, reactions_limit = reactions_limit.GetValueOrDefault(), + paid_enabled = paid_enabled.GetValueOrDefault(), }); /// Obtain available message reactions » See @@ -4310,6 +4312,26 @@ namespace TL platform = platform, }); + /// See + public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool private_ = false) + => client.Invoke(new Messages_SendPaidReaction + { + flags = (Messages_SendPaidReaction.Flags)(private_ ? 0x1 : 0), + peer = peer, + msg_id = msg_id, + count = count, + random_id = random_id, + }); + + /// See + public static Task Messages_TogglePaidReactionPrivacy(this Client client, InputPeer peer, int msg_id, bool private_) + => client.Invoke(new Messages_TogglePaidReactionPrivacy + { + peer = peer, + msg_id = msg_id, + private_ = private_, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -4928,12 +4950,11 @@ namespace TL /// Enable/disable message signatures in channels See Possible codes: 400 (details) /// Channel - /// Value - public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool enabled) + public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool signatures_enabled = false, bool profiles_enabled = false) => client.Invoke(new Channels_ToggleSignatures { + flags = (Channels_ToggleSignatures.Flags)((signatures_enabled ? 0x1 : 0) | (profiles_enabled ? 0x2 : 0)), channel = channel, - enabled = enabled, }); /// Get channels/supergroups/geogroups we're admin in. Usually called when the user exceeds the limit for owned public channels/supergroups/geogroups, and the user is given the choice to remove one of his channels/supergroups/geogroups. See Possible codes: 400 (details) @@ -5854,10 +5875,11 @@ namespace TL /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». /// Maximum number of results to return, see pagination - public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool inbound = false, bool outbound = false, bool ascending = false) + public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, string subscription_id = null, bool inbound = false, bool outbound = false, bool ascending = false) => client.Invoke(new Payments_GetStarsTransactions { - flags = (Payments_GetStarsTransactions.Flags)((inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0)), + flags = (Payments_GetStarsTransactions.Flags)((subscription_id != null ? 0x8 : 0) | (inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0)), + subscription_id = subscription_id, peer = peer, offset = offset, limit = limit, @@ -5933,6 +5955,33 @@ namespace TL user_id = user_id, }); + /// See + public static Task Payments_GetStarsSubscriptions(this Client client, InputPeer peer, string offset, bool missing_balance = false) + => client.Invoke(new Payments_GetStarsSubscriptions + { + flags = (Payments_GetStarsSubscriptions.Flags)(missing_balance ? 0x1 : 0), + peer = peer, + offset = offset, + }); + + /// See + public static Task Payments_ChangeStarsSubscription(this Client client, InputPeer peer, string subscription_id, bool? canceled = default) + => client.Invoke(new Payments_ChangeStarsSubscription + { + flags = (Payments_ChangeStarsSubscription.Flags)(canceled != default ? 0x1 : 0), + peer = peer, + subscription_id = subscription_id, + canceled = canceled.GetValueOrDefault(), + }); + + /// See + public static Task Payments_FulfillStarsSubscription(this Client client, InputPeer peer, string subscription_id) + => client.Invoke(new Payments_FulfillStarsSubscription + { + peer = peer, + subscription_id = subscription_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8906,7 +8955,7 @@ namespace TL.Methods } } - [TLDef(0xA02CE5D5)] + [TLDef(0xA455DE90)] public sealed partial class Messages_ExportChatInvite : IMethod { public Flags flags; @@ -8914,6 +8963,7 @@ namespace TL.Methods [IfFlag(0)] public DateTime expire_date; [IfFlag(1)] public int usage_limit; [IfFlag(4)] public string title; + [IfFlag(5)] public StarsSubscriptionPricing subscription_pricing; [Flags] public enum Flags : uint { @@ -8922,6 +8972,7 @@ namespace TL.Methods legacy_revoke_permanent = 0x4, request_needed = 0x8, has_title = 0x10, + has_subscription_pricing = 0x20, } } @@ -9955,6 +10006,7 @@ namespace TL.Methods requested = 0x1, has_link = 0x2, has_q = 0x4, + subscription_expired = 0x8, } } @@ -10098,17 +10150,19 @@ namespace TL.Methods } } - [TLDef(0x5A150BD4)] + [TLDef(0x864B2581)] public sealed partial class Messages_SetChatAvailableReactions : IMethod { public Flags flags; public InputPeer peer; public ChatReactions available_reactions; [IfFlag(0)] public int reactions_limit; + [IfFlag(1)] public bool paid_enabled; [Flags] public enum Flags : uint { has_reactions_limit = 0x1, + has_paid_enabled = 0x2, } } @@ -10701,6 +10755,29 @@ namespace TL.Methods } } + [TLDef(0x25C8FE3E)] + public sealed partial class Messages_SendPaidReaction : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + public int count; + public long random_id; + + [Flags] public enum Flags : uint + { + private_ = 0x1, + } + } + + [TLDef(0x849AD397)] + public sealed partial class Messages_TogglePaidReactionPrivacy : IMethod + { + public InputPeer peer; + public int msg_id; + public bool private_; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -11161,11 +11238,17 @@ namespace TL.Methods } } - [TLDef(0x1F69B606)] + [TLDef(0x418D549C)] public sealed partial class Channels_ToggleSignatures : IMethod { + public Flags flags; public InputChannelBase channel; - public bool enabled; + + [Flags] public enum Flags : uint + { + signatures_enabled = 0x1, + profiles_enabled = 0x2, + } } [TLDef(0xF8B036AF)] @@ -11886,10 +11969,11 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x97938D5A)] + [TLDef(0x69DA4557)] public sealed partial class Payments_GetStarsTransactions : IMethod { public Flags flags; + [IfFlag(3)] public string subscription_id; public InputPeer peer; public string offset; public int limit; @@ -11899,6 +11983,7 @@ namespace TL.Methods inbound = 0x1, outbound = 0x2, ascending = 0x4, + has_subscription_id = 0x8, } } @@ -11966,6 +12051,40 @@ namespace TL.Methods } } + [TLDef(0x032512C5)] + public sealed partial class Payments_GetStarsSubscriptions : IMethod + { + public Flags flags; + public InputPeer peer; + public string offset; + + [Flags] public enum Flags : uint + { + missing_balance = 0x1, + } + } + + [TLDef(0xC7770878)] + public sealed partial class Payments_ChangeStarsSubscription : IMethod + { + public Flags flags; + public InputPeer peer; + public string subscription_id; + [IfFlag(0)] public bool canceled; + + [Flags] public enum Flags : uint + { + has_canceled = 0x1, + } + } + + [TLDef(0xCC5BEBB3)] + public sealed partial class Payments_FulfillStarsSubscription : IMethod + { + public InputPeer peer; + public string subscription_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index c3d993d..4a6cb66 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 = 185; // fetched 31/07/2024 17:28:03 + public const int Version = 186; // fetched 14/08/2024 12:45:43 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -84,6 +84,7 @@ namespace TL [0xF392B7F4] = typeof(InputPhoneContact), [0xF52FF27F] = typeof(InputFile), [0xFA4F0BB5] = typeof(InputFileBig), + [0x62DC8B48] = typeof(InputFileStoryDocument), [0x9664F57F] = null,//InputMediaEmpty [0x1E287D04] = typeof(InputMediaUploadedPhoto), [0xB3BA0635] = typeof(InputMediaPhoto), @@ -135,7 +136,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x0AADFC8F] = typeof(Channel), + [0xFE4478BD] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0xBBAB348D] = typeof(ChannelFull), @@ -531,10 +532,10 @@ namespace TL [0xC23727C9] = typeof(Account_PasswordInputSettings), [0x137948A5] = typeof(Auth_PasswordRecovery), [0xA384B779] = typeof(ReceivedNotifyMessage), - [0x0AB4A819] = typeof(ChatInviteExported), + [0xA22CBD96] = typeof(ChatInviteExported), [0xED107AB7] = typeof(ChatInvitePublicJoinRequests), [0x5A686D7C] = typeof(ChatInviteAlready), - [0xCDE0EC40] = typeof(ChatInvite), + [0xFE65389D] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), [0xFFB62B95] = null,//InputStickerSetEmpty [0x9DE7A269] = typeof(InputStickerSetID), @@ -551,7 +552,7 @@ namespace TL [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0x8F300B57] = typeof(BotInfo), + [0x82437E74] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -605,8 +606,8 @@ namespace TL [0x2064674E] = typeof(Updates_ChannelDifference), [0x94D42EE7] = null,//ChannelMessagesFilterEmpty [0xCD77D957] = typeof(ChannelMessagesFilter), - [0xC00C07C0] = typeof(ChannelParticipant), - [0x35A8BFA7] = typeof(ChannelParticipantSelf), + [0xCB397619] = typeof(ChannelParticipant), + [0x4F607BEF] = typeof(ChannelParticipantSelf), [0x2FE601D3] = typeof(ChannelParticipantCreator), [0x34C3BB53] = typeof(ChannelParticipantAdmin), [0x6DF8014E] = typeof(ChannelParticipantBanned), @@ -834,6 +835,7 @@ namespace TL [0x31BB5D52] = typeof(ChannelAdminLogEventActionChangeWallpaper), [0x3EA9FEB1] = typeof(ChannelAdminLogEventActionChangeEmojiStatus), [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), + [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1038,7 +1040,7 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0xBDEDF566] = typeof(SponsoredMessage), + [0x4D93A990] = typeof(SponsoredMessage), [0xC9EE1D87] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), @@ -1050,7 +1052,7 @@ namespace TL [0x6880B94D] = typeof(Messages_PeerSettings), [0xC3A2835F] = typeof(Auth_LoggedOut), [0xA3D1CB80] = typeof(ReactionCount), - [0x4F2B9479] = typeof(MessageReactions), + [0x0A339F0B] = typeof(MessageReactions), [0x31BD492D] = typeof(Messages_MessageReactionsList), [0xC077EC01] = typeof(AvailableReaction), [0x9F071957] = null,//Messages_AvailableReactionsNotModified @@ -1082,6 +1084,7 @@ namespace TL [0xC326CAEF] = typeof(InputInvoiceSlug), [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0x65F00CE3] = typeof(InputInvoiceStars), + [0x34E793F1] = typeof(InputInvoiceChatInviteSubscription), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1101,6 +1104,7 @@ namespace TL [0x79F5D419] = null,//ReactionEmpty [0x1B2286B8] = typeof(ReactionEmoji), [0x8935FC73] = typeof(ReactionCustomEmoji), + [0x523DA4EB] = typeof(ReactionPaid), [0xEAFC32BC] = null,//ChatReactionsNone [0x52928BCA] = typeof(ChatReactionsAll), [0x661D4037] = typeof(ChatReactionsSome), @@ -1294,8 +1298,8 @@ namespace TL [0xD80DA15D] = typeof(StarsTransactionPeer), [0x60682812] = typeof(StarsTransactionPeerAds), [0x0BD915C0] = typeof(StarsTopupOption), - [0x2DB5418F] = typeof(StarsTransaction), - [0x8CF4EE60] = typeof(Payments_StarsStatus), + [0x433AEB2B] = typeof(StarsTransaction), + [0xBBFA316C] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), [0xDE4C5D93] = typeof(GeoPointAddress), @@ -1308,6 +1312,9 @@ namespace TL [0x1991B13B] = typeof(Bots_PopularAppBots), [0x23E91BA3] = typeof(BotPreviewMedia), [0x0CA71D64] = typeof(Bots_PreviewInfo), + [0x05416D58] = typeof(StarsSubscriptionPricing), + [0x538ECF18] = typeof(StarsSubscription), + [0x4BA3A95A] = typeof(MessageReactor), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 0433a0a..334ecc4 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -86,16 +86,36 @@ namespace TL else return new InputChatUploadedPhoto { file = this, flags = InputChatUploadedPhoto.Flags.has_file }; } + /// Random file identifier created by the client + public abstract long ID { get; set; } + /// Number of parts saved + public abstract int Parts { get; set; } + /// Full name of the file + public abstract string Name { get; set; } } partial class InputFile { public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, key_fingerprint = key_fingerprint }; public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, md5_checksum = md5_checksum, file_hash = file_hash, secret = secret }; + public override long ID { get => id; set => id = value; } + public override int Parts { get => parts; set => parts = value; } + public override string Name { get => name; set => name = value; } } partial class InputFileBig { public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => new InputEncryptedFileBigUploaded { id = id, parts = parts, key_fingerprint = key_fingerprint }; public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => new InputSecureFileUploaded { id = id, parts = parts, file_hash = file_hash, secret = secret }; + public override long ID { get => id; set => id = value; } + public override int Parts { get => parts; set => parts = value; } + public override string Name { get => name; set => name = value; } + } + partial class InputFileStoryDocument // apparently this is used only in InputMediaUploadedDocument.file + { + public override InputEncryptedFileBase ToInputEncryptedFile(int key_fingerprint) => throw new NotSupportedException(); + public override InputSecureFileBase ToInputSecureFile(byte[] file_hash, byte[] secret) => throw new NotSupportedException(); + public override long ID { get => 0; set => throw new NotSupportedException(); } + public override int Parts { get => 0; set => throw new NotSupportedException(); } + public override string Name { get => null; set => throw new NotSupportedException(); } } partial class InputMediaUploadedDocument diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 9b4353c..3d71cd9 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: 185 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 186 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 15b6346d2ae5af63487e22dc0968c9bda5e83806 Mon Sep 17 00:00:00 2001 From: wiz0u <11647984+wiz0u@users.noreply.github.com> Date: Thu, 22 Aug 2024 15:14:26 +0200 Subject: [PATCH 227/336] Update autolock.yml --- .github/workflows/autolock.yml | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/autolock.yml b/.github/workflows/autolock.yml index 635bcda..981b029 100644 --- a/.github/workflows/autolock.yml +++ b/.github/workflows/autolock.yml @@ -2,21 +2,23 @@ name: 'Auto-Lock Issues' on: schedule: - - cron: '0 12 * * *' + - cron: '0 2 * * *' workflow_dispatch: permissions: issues: write pull-requests: write + discussions: write concurrency: - group: lock + group: lock-threads jobs: action: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v4 + - uses: dessant/lock-threads@v5.0.1 with: issue-inactive-days: '60' pr-inactive-days: '60' + discussion-inactive-days: '60' From 931591351968f55f12b99fa5c2cc675405ea1479 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 5 Sep 2024 18:51:53 +0200 Subject: [PATCH 228/336] =?UTF-8?q?Fix=20infinite=20recursion=20on=20Dispo?= =?UTF-8?q?se=20(#274)=20=F0=9F=8E=ACTake=202?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/dev.yml | 2 +- EXAMPLES.md | 2 +- README.md | 6 ++++-- src/Client.cs | 15 +++++++++++---- 4 files changed, 17 insertions(+), 8 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index b994351..0128bc4 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.8-dev.$(Rev:r) +name: 4.1.9-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/EXAMPLES.md b/EXAMPLES.md index ff86a4d..6fb7ee1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -504,7 +504,7 @@ These two fields derive from class `Peer` and can be of type `PeerChat`, `PeerCh The root structure where you obtained the message (typically `UpdatesBase` or `Messages_MessagesBase`) inherits from `IPeerResolver`. This allows you to call `.UserOrChat(peer)` on the root structure, in order to resolve those fields into a `User` class, or a `ChatBase`-derived class -(typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID. +(typically `Chat` or `Channel`) which will give you details about the peer, instead of just the ID, and can be implicitly converted to `InputPeer`. However, in some case _(typically when dealing with updates)_, Telegram might choose to not include details about a peer because it expects you to already know about it (`UserOrChat` returns `null`). diff --git a/README.md b/README.md index 9a6e007..8e10baa 100644 --- a/README.md +++ b/README.md @@ -1,13 +1,15 @@ [![API Layer](https://img.shields.io/badge/API_Layer-186-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://www.buymeacoffee.com/wizou) +[![Donate](https://img.shields.io/badge/Help_this_project:-Donate-ff4444)](https://buymeacoffee.com/wizou) ## *_Telegram Client API library written 100% in C# and .NET_* This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. +Library was developed solely by one unemployed guy. [Donations are welcome](https://buymeacoffee.com/wizou). + This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. > ⚠️ This library requires understanding advanced C# techniques such as **asynchronous programming** or **subclass pattern matching**... @@ -202,6 +204,6 @@ as well as the [API Terms of Service](https://core.telegram.org/api/terms) or yo If you read all this ReadMe, the [Frequently Asked Questions](https://wiz0u.github.io/WTelegramClient/FAQ), the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still have questions, feedback is welcome in our Telegram group [@WTelegramClient](https://t.me/WTelegramClient) -If you like this library, you can [buy me a coffee](https://www.buymeacoffee.com/wizou) ❤ This will help the project keep going. +If you like this library, you can [buy me a coffee](https://buymeacoffee.com/wizou) ❤ This will help the project keep going. © 2024 Olivier Marcoux diff --git a/src/Client.cs b/src/Client.cs index 5bb497f..3a85c60 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -246,6 +246,7 @@ namespace WTelegram return dcSession; // if we have already a session with this DC and we are connected or it is a perfect match, use it if (dcSession == null && _session.DCSessions.TryGetValue(-dcId, out dcSession) && dcSession.AuthKey != null) { + // we have already negociated an AuthKey with this DC if (dcSession.DataCenter.flags == flags && _session.DCSessions.Remove(-dcId)) return _session.DCSessions[dcId] = dcSession; // we found a misclassed DC, change its sign dcSession = new Session.DCSession { Id = Helpers.RandomLong(), // clone AuthKey for a session on the matching media_only DC @@ -872,9 +873,11 @@ namespace WTelegram var triedEndpoints = new HashSet { endpoint }; if (_session.DcOptions != null) { - var altOptions = _session.DcOptions.Where(dco => dco.id == _dcSession.DataCenter.id && dco.flags != _dcSession.DataCenter.flags - && (dco.flags & (DcOption.Flags.cdn | DcOption.Flags.tcpo_only | DcOption.Flags.media_only)) == 0) - .OrderBy(dco => dco.flags); + var flags = _dcSession.DataCenter.flags; + var altOptions = _session.DcOptions.Where(dc => dc.id == _dcSession.DataCenter.id && dc.flags != flags + && (dc.flags & DcOption.Flags.media_only) <= (flags & DcOption.Flags.media_only) + && (dc.flags & (DcOption.Flags.cdn | DcOption.Flags.tcpo_only)) == 0) + .OrderBy(dc => (dc.flags ^ flags) & DcOption.Flags.media_only).ThenBy(dc => dc.flags ^ flags); // try alternate addresses for this DC foreach (var dcOption in altOptions) { @@ -884,7 +887,11 @@ namespace WTelegram try { tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); - _dcSession.DataCenter = dcOption; + if (((dcOption.flags ^ flags) & DcOption.Flags.media_only) == 0) // test to prevent AltDC becoming MainDC + _dcSession.DataCenter = dcOption; + else + _dcSession.DataCenter = new DcOption { flags = dcOption.flags ^ DcOption.Flags.media_only, + id = dcOption.id, ip_address = dcOption.ip_address, port = dcOption.port, secret = dcOption.secret }; break; } catch (SocketException) { } From 9fe6a9d74f24e0cae34ad8c43384f38801cee710 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 6 Sep 2024 18:22:05 +0200 Subject: [PATCH 229/336] Added DisposeAsync, ResetAsync. Now Login() starts Reactor on current context, useful for UI access within OnUpdates/OnOther (LoginUserIfNeeded was already doing that) --- src/Client.cs | 22 +++++++++++++++------- src/Compat.cs | 20 +++++++++++++++++--- 2 files changed, 32 insertions(+), 10 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 3a85c60..d470309 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -20,7 +20,7 @@ using static WTelegram.Encryption; namespace WTelegram { - public partial class Client : IDisposable + public partial class Client : IDisposable, IAsyncDisposable { /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// Make your handler , or return or
See Examples/Program_ReactorError.cs for how to use this
or Examples/Program_ListenUpdate.cs using the UpdateManager class instead
@@ -178,10 +178,12 @@ namespace WTelegram public static Task InputCheckPassword(Account_Password accountPassword, string password) => Check2FA(accountPassword, () => Task.FromResult(password)); - public void Dispose() + [System.Diagnostics.CodeAnalysis.SuppressMessage("Usage", "CA1816")] + public void Dispose() => DisposeAsync().AsTask().Wait(); + public async ValueTask DisposeAsync() { Helpers.Log(2, $"{_dcSession.DcID}>Disposing the client"); - Reset(false, IsMainDC); + await ResetAsync(false, IsMainDC).ConfigureAwait(false); var ex = new ObjectDisposedException("WTelegram.Client was disposed"); lock (_pendingRpcs) // abort all pending requests foreach (var rpc in _pendingRpcs.Values) @@ -197,19 +199,24 @@ namespace WTelegram /// Disconnect from Telegram (shouldn't be needed in normal usage) /// Forget about logged-in user /// Disconnect secondary sessions with other DCs - public void Reset(bool resetUser = true, bool resetSessions = true) + public void Reset(bool resetUser = true, bool resetSessions = true) => ResetAsync(resetUser, resetSessions).Wait(); + + /// Disconnect from Telegram (shouldn't be needed in normal usage) + /// Forget about logged-in user + /// Disconnect secondary sessions with other DCs + public async Task ResetAsync(bool resetUser = true, bool resetSessions = true) { try { if (CheckMsgsToAck() is MsgsAck msgsAck) - SendAsync(msgsAck, false).Wait(1000); + await SendAsync(msgsAck, false).WaitAsync(1000).ConfigureAwait(false); } catch { } _cts?.Cancel(); _sendSemaphore = new(0); // initially taken, first released during DoConnectAsync try { - _reactorTask?.Wait(1000); + await _reactorTask.WaitAsync(1000).ConfigureAwait(false); } catch { } _reactorTask = resetSessions ? null : Task.CompletedTask; @@ -350,7 +357,7 @@ namespace WTelegram try { lock (_msgsToAck) _msgsToAck.Clear(); - Reset(false, false); + await ResetAsync(false, false); _reactorReconnects = (_reactorReconnects + 1) % MaxAutoReconnects; if (disconnectedAltDC && _pendingRpcs.Count <= 1) if (_pendingRpcs.Values.FirstOrDefault() is not Rpc rpc || rpc.type == typeof(Pong)) @@ -1047,6 +1054,7 @@ namespace WTelegram }; try { + await ConnectAsync(); // start reactor on the current (UI?) context // Login logic is executed on TaskScheduler while request TCS are still received on current SynchronizationContext await Task.Run(() => LoginUserIfNeeded()); _loginCfg.request.SetResult(null); diff --git a/src/Compat.cs b/src/Compat.cs index 53d54b4..4e9f9dc 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -6,11 +6,12 @@ using System.Linq; using System.Net; using System.Numerics; using System.Security.Cryptography; +using System.Threading.Tasks; #if NETCOREAPP2_1_OR_GREATER namespace WTelegram { - static class Compat + static partial class Compat { internal static BigInteger BigEndianInteger(byte[] value) => new(value, true, true); internal static IPEndPoint IPEndPoint_Parse(string addr) => IPEndPoint.Parse(addr); @@ -19,7 +20,7 @@ namespace WTelegram #else // Compatibility shims for methods missing in netstandard2.0: namespace WTelegram { - static class Compat + static partial class Compat { internal static BigInteger BigEndianInteger(byte[] value) { @@ -104,4 +105,17 @@ namespace System.Runtime.CompilerServices [EditorBrowsable(EditorBrowsableState.Never)] internal class IsExternalInit { } } -#endif \ No newline at end of file +#endif + +namespace WTelegram +{ + static partial class Compat + { + internal static Task WaitAsync(this Task source, int timeout) +#if NET8_0_OR_GREATER + => source?.WaitAsync(TimeSpan.FromMilliseconds(timeout)) ?? Task.CompletedTask; +#else + => source == null ? Task.CompletedTask : Task.WhenAny(source, Task.Delay(timeout)); +#endif + } +} From be7027b3184454ef7bfcf874f988edcb0bc190a0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Sep 2024 01:59:27 +0200 Subject: [PATCH 230/336] more IAsyncDisposable stuff --- Examples/Program_DownloadSavedMedia.cs | 2 +- Examples/Program_GetAllChats.cs | 2 +- Examples/Program_Heroku.cs | 2 +- Examples/Program_ListenUpdates.cs | 2 +- Examples/Program_ReactorError.cs | 4 ++-- src/Client.cs | 5 ++++- 6 files changed, 10 insertions(+), 7 deletions(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index 72c1f2b..e431d36 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -11,7 +11,7 @@ namespace WTelegramClientTest static async Task Main(string[] _) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); - using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); + await using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); client.OnUpdates += Client_OnUpdates; Console.ReadKey(); diff --git a/Examples/Program_GetAllChats.cs b/Examples/Program_GetAllChats.cs index 6e4a9c2..f9ce1ce 100644 --- a/Examples/Program_GetAllChats.cs +++ b/Examples/Program_GetAllChats.cs @@ -24,7 +24,7 @@ namespace WTelegramClientTest static async Task Main(string[] _) { - using var client = new WTelegram.Client(Config); + await using var client = new WTelegram.Client(Config); var user = await client.LoginUserIfNeeded(); Console.WriteLine($"We are logged-in as {user.username ?? user.first_name + " " + user.last_name} (id {user.id})"); diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index f1f9cbe..5ae5fe7 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -28,7 +28,7 @@ namespace WTelegramClientTest var store = new PostgreStore(Environment.GetEnvironmentVariable("DATABASE_URL"), Environment.GetEnvironmentVariable("SESSION_NAME")); // if DB does not contain a session yet, client will be run in interactive mode Client = new WTelegram.Client(store.Length == 0 ? null : Environment.GetEnvironmentVariable, store); - using (Client) + await using (Client) { Client.OnUpdates += Client_OnUpdates; My = await Client.LoginUserIfNeeded(); diff --git a/Examples/Program_ListenUpdates.cs b/Examples/Program_ListenUpdates.cs index 05f7f28..59abe49 100644 --- a/Examples/Program_ListenUpdates.cs +++ b/Examples/Program_ListenUpdates.cs @@ -16,7 +16,7 @@ namespace WTelegramClientTest Console.WriteLine("The program will display updates received for the logged-in user. Press any key to terminate"); WTelegram.Helpers.Log = (l, s) => System.Diagnostics.Debug.WriteLine(s); Client = new WTelegram.Client(Environment.GetEnvironmentVariable); - using (Client) + await using (Client) { Manager = Client.WithUpdateManager(Client_OnUpdate/*, "Updates.state"*/); My = await Client.LoginUserIfNeeded(); diff --git a/Examples/Program_ReactorError.cs b/Examples/Program_ReactorError.cs index 83c2d6f..d84b8a0 100644 --- a/Examples/Program_ReactorError.cs +++ b/Examples/Program_ReactorError.cs @@ -20,7 +20,7 @@ namespace WTelegramClientTest } finally { - Client?.Dispose(); + if (Client != null) await Client.DisposeAsync(); } } @@ -42,7 +42,7 @@ namespace WTelegramClientTest while (true) { Console.WriteLine("Disposing the client and trying to reconnect in 5 seconds..."); - Client?.Dispose(); + if (Client != null) await Client.DisposeAsync(); Client = null; await Task.Delay(5000); try diff --git a/src/Client.cs b/src/Client.cs index d470309..5f9fdea 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -20,7 +20,10 @@ using static WTelegram.Encryption; namespace WTelegram { - public partial class Client : IDisposable, IAsyncDisposable + public partial class Client : IDisposable +#if NETCOREAPP2_1_OR_GREATER + , IAsyncDisposable +#endif { /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// Make your handler , or return or
See Examples/Program_ReactorError.cs for how to use this
or Examples/Program_ListenUpdate.cs using the UpdateManager class instead
From 62a691359bb7f8b629a5be93dcf150681ef0941f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Sep 2024 02:09:42 +0200 Subject: [PATCH 231/336] API Layer 187: Star Giveaways, private paid reactions, bot msg for paid media --- README.md | 2 +- src/TL.Schema.cs | 213 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 28 ++++- src/TL.Table.cs | 28 +++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 241 insertions(+), 32 deletions(-) diff --git a/README.md b/README.md index 8e10baa..e8c37d0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-186-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-187-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 162370e..f5e93e8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -471,13 +471,21 @@ namespace TL } } /// Paid media, see here » for more info. See - [TLDef(0xAA661FC3)] + [TLDef(0xC4103386)] public sealed partial class InputMediaPaidMedia : InputMedia { + public Flags flags; /// The price of the media in Telegram Stars. public long stars_amount; /// Photos or videos. public InputMedia[] extended_media; + [IfFlag(0)] public string payload; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_payload = 0x1, + } } /// Defines a new group profile photo. See Derived classes: , @@ -2142,7 +2150,7 @@ namespace TL } } /// Contains info about a giveaway, see here » for more info. See - [TLDef(0xDAAD85B0)] + [TLDef(0xAA073BEB)] public sealed partial class MessageMediaGiveaway : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2156,7 +2164,8 @@ namespace TL /// Number of Telegram Premium subscriptions given away. public int quantity; /// Duration in months of each Telegram Premium subscription in the giveaway. - public int months; + [IfFlag(4)] public int months; + [IfFlag(5)] public long stars; /// The end date of the giveaway. public DateTime until_date; @@ -2170,10 +2179,14 @@ namespace TL winners_are_visible = 0x4, /// Field has a value has_prize_description = 0x8, + /// Field has a value + has_months = 0x10, + /// Field has a value + has_stars = 0x20, } } /// A giveaway with public winners has finished, this constructor contains info about the winners. See - [TLDef(0xC6991068)] + [TLDef(0xCEAA3EA1)] public sealed partial class MessageMediaGiveawayResults : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2191,7 +2204,8 @@ namespace TL /// Up to 100 user identifiers of the winners of the giveaway. public long[] winners; /// Duration in months of each Telegram Premium subscription in the giveaway. - public int months; + [IfFlag(4)] public int months; + [IfFlag(5)] public long stars; /// Can contain a textual description of additional giveaway prizes. [IfFlag(1)] public string prize_description; /// Point in time (Unix timestamp) when the winners were selected. May be bigger than winners selection date specified in initial parameters of the giveaway. @@ -2207,6 +2221,10 @@ namespace TL refunded = 0x4, /// Field has a value has_additional_peers_count = 0x8, + /// Field has a value + has_months = 0x10, + /// Field has a value + has_stars = 0x20, } } /// Paid media, see here » for more info. See @@ -2659,16 +2677,31 @@ namespace TL } } /// A giveaway was started. See - [TLDef(0x332BA9ED)] - public sealed partial class MessageActionGiveawayLaunch : MessageAction { } + [TLDef(0xA80F51E4)] + public sealed partial class MessageActionGiveawayLaunch : MessageAction + { + public Flags flags; + [IfFlag(0)] public long stars; + + [Flags] public enum Flags : uint + { + has_stars = 0x1, + } + } /// A giveaway has ended. See - [TLDef(0x2A9FADC5)] + [TLDef(0x87E2F155)] public sealed partial class MessageActionGiveawayResults : MessageAction { + public Flags flags; /// Number of winners in the giveaway public int winners_count; /// Number of undistributed prizes public int unclaimed_count; + + [Flags] public enum Flags : uint + { + stars = 0x1, + } } /// Some boosts » were applied to the channel or supergroup. See [TLDef(0xCC02AA6D)] @@ -2736,6 +2769,21 @@ namespace TL has_transaction_id = 0x2, } } + /// See + [TLDef(0xB00C47A2)] + public sealed partial class MessageActionPrizeStars : MessageAction + { + public Flags flags; + public long stars; + public string transaction_id; + public Peer boost_peer; + public int giveaway_msg_id; + + [Flags] public enum Flags : uint + { + unclaimed = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -5512,6 +5560,22 @@ namespace TL /// New Telegram Star balance. public StarsRevenueStatus status; } + /// See + [TLDef(0x283BD312)] + public sealed partial class UpdateBotPurchasedPaidMedia : Update + { + public long user_id; + public string payload; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } + /// See + [TLDef(0x51CA7AEC)] + public sealed partial class UpdatePaidReactionPrivacy : Update + { + public bool private_; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -11747,6 +11811,13 @@ namespace TL /// See [TLDef(0x60A79C79)] public sealed partial class ChannelAdminLogEventActionToggleSignatureProfiles : ChannelAdminLogEventActionToggleSignatures { } + /// See + [TLDef(0x64642DB3)] + public sealed partial class ChannelAdminLogEventActionParticipantSubExtend : ChannelAdminLogEventAction + { + public ChannelParticipantBase prev_participant; + public ChannelParticipantBase new_participant; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -11821,6 +11892,7 @@ namespace TL send = 0x10000, /// Forum-related events forums = 0x20000, + sub_extend = 0x40000, } } @@ -15645,6 +15717,31 @@ namespace TL /// Total price 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 amount; } + /// See + [TLDef(0x751F08FA)] + public sealed partial class InputStorePaymentStarsGiveaway : InputStorePaymentPurpose + { + public Flags flags; + public long stars; + public InputPeer boost_peer; + [IfFlag(1)] public InputPeer[] additional_peers; + [IfFlag(2)] public string[] countries_iso2; + [IfFlag(4)] public string prize_description; + public long random_id; + public DateTime until_date; + public string currency; + public long amount; + public int users; + + [Flags] public enum Flags : uint + { + only_new_subscribers = 0x1, + has_additional_peers = 0x2, + has_countries_iso2 = 0x4, + winners_are_visible = 0x8, + has_prize_description = 0x10, + } + } /// Telegram Premium gift option See [TLDef(0x74C34319)] @@ -17248,7 +17345,7 @@ namespace TL public override DateTime StartDate => start_date; } /// A giveaway has ended. See - [TLDef(0x00CD5570)] + [TLDef(0xE175E66F)] public sealed partial class Payments_GiveawayInfoResults : Payments_GiveawayInfoBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17256,13 +17353,14 @@ namespace TL /// Start date of the giveaway public DateTime start_date; /// If we're one of the winners of this giveaway, contains the Premium gift code, see here » for more info on the full giveaway flow. - [IfFlag(0)] public string gift_code_slug; + [IfFlag(3)] public string gift_code_slug; + [IfFlag(4)] public long stars_prize; /// End date of the giveaway. May be bigger than the end date specified in parameters of the giveaway. public DateTime finish_date; /// Number of winners in the giveaway public int winners_count; /// Number of winners, which activated their gift codes. - public int activated_count; + [IfFlag(2)] public int activated_count; [Flags] public enum Flags : uint { @@ -17270,15 +17368,31 @@ namespace TL winner = 0x1, /// Whether the giveaway was canceled and was fully refunded. refunded = 0x2, + /// Field has a value + has_activated_count = 0x4, + /// Field has a value + has_gift_code_slug = 0x8, + /// Field has a value + has_stars_prize = 0x10, } /// Start date of the giveaway public override DateTime StartDate => start_date; } + /// Contains info about a prepaid giveaway ». See Derived classes: + public abstract partial class PrepaidGiveawayBase : IObject + { + /// Prepaid giveaway ID. + public virtual long ID => default; + /// Number of given away Telegram Premium subscriptions. + public virtual int Quantity => default; + /// Payment date. + public virtual DateTime Date => default; + } /// Contains info about a prepaid giveaway ». See [TLDef(0xB2539D54)] - public sealed partial class PrepaidGiveaway : IObject + public sealed partial class PrepaidGiveaway : PrepaidGiveawayBase { /// Prepaid giveaway ID. public long id; @@ -17288,10 +17402,31 @@ namespace TL public int quantity; /// Payment date. public DateTime date; + + /// Prepaid giveaway ID. + public override long ID => id; + /// Number of given away Telegram Premium subscriptions. + public override int Quantity => quantity; + /// Payment date. + public override DateTime Date => date; + } + /// See + [TLDef(0x9A9D77E0)] + public sealed partial class PrepaidStarsGiveaway : PrepaidGiveawayBase + { + public long id; + public long stars; + public int quantity; + public int boosts; + public DateTime date; + + public override long ID => id; + public override int Quantity => quantity; + public override DateTime Date => date; } /// Info about one or more boosts applied by a specific user. See - [TLDef(0x2A1C8C71)] + [TLDef(0x4B3E14D6)] public sealed partial class Boost : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17310,6 +17445,7 @@ namespace TL [IfFlag(4)] public string used_gift_slug; /// If set, this boost counts as multiplier boosts, otherwise it counts as a single boost. [IfFlag(5)] public int multiplier; + [IfFlag(6)] public long stars; [Flags] public enum Flags : uint { @@ -17325,6 +17461,8 @@ namespace TL has_used_gift_slug = 0x10, /// Field has a value has_multiplier = 0x20, + /// Field has a value + has_stars = 0x40, } } @@ -17411,7 +17549,7 @@ namespace TL /// Boost deep link » that can be used to boost the chat. public string boost_url; /// A list of prepaid giveaways available for the chat; only returned to channel/supergroup admins. - [IfFlag(3)] public PrepaidGiveaway[] prepaid_giveaways; + [IfFlag(3)] public PrepaidGiveawayBase[] prepaid_giveaways; /// Indicates which of our boost slots we've assigned to this peer (populated if my_boost is set). [IfFlag(2)] public int[] my_boost_slots; @@ -18680,15 +18818,21 @@ namespace TL } /// Describes channel ad revenue balances ». See - [TLDef(0x8438F1C6)] + [TLDef(0xC3FF71E7)] public sealed partial class BroadcastRevenueBalances : IObject { + public Flags flags; /// Amount of not-yet-withdrawn cryptocurrency. public long current_balance; /// Amount of withdrawable cryptocurrency, out of the currently available balance (available_balance <= current_balance). public long available_balance; /// Total amount of earned cryptocurrency. public long overall_revenue; + + [Flags] public enum Flags : uint + { + withdrawal_enabled = 0x1, + } } /// Represents a message effect ». See @@ -18807,7 +18951,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0x433AEB2B)] + [TLDef(0xEE7522D5)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18837,6 +18981,7 @@ namespace TL /// The purchased paid media ». [IfFlag(9)] public MessageMedia[] extended_media; [IfFlag(12)] public int subscription_period; + [IfFlag(13)] public int giveaway_post_id; [Flags] public enum Flags : uint { @@ -18865,6 +19010,8 @@ namespace TL reaction = 0x800, /// Field has a value has_subscription_period = 0x1000, + /// Field has a value + has_giveaway_post_id = 0x2000, } } @@ -19141,4 +19288,38 @@ namespace TL has_peer_id = 0x8, } } + + /// See + [TLDef(0x94CE852A)] + public sealed partial class StarsGiveawayOption : IObject + { + public Flags flags; + public long stars; + public int yearly_boosts; + [IfFlag(2)] public string store_product; + public string currency; + public long amount; + public StarsGiveawayWinnersOption[] winners; + + [Flags] public enum Flags : uint + { + extended = 0x1, + default_ = 0x2, + has_store_product = 0x4, + } + } + + /// See + [TLDef(0x54236209)] + public sealed partial class StarsGiveawayWinnersOption : IObject + { + public Flags flags; + public int users; + public long per_user_stars; + + [Flags] public enum Flags : uint + { + default_ = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 490010f..8ebca1f 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4313,14 +4313,15 @@ namespace TL }); /// See - public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool private_ = false) + public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool? private_ = default) => client.Invoke(new Messages_SendPaidReaction { - flags = (Messages_SendPaidReaction.Flags)(private_ ? 0x1 : 0), + flags = (Messages_SendPaidReaction.Flags)(private_ != default ? 0x1 : 0), peer = peer, msg_id = msg_id, count = count, random_id = random_id, + private_ = private_.GetValueOrDefault(), }); /// See @@ -4332,6 +4333,12 @@ namespace TL private_ = private_, }); + /// See + public static Task Messages_GetPaidReactionPrivacy(this Client client) + => client.Invoke(new Messages_GetPaidReactionPrivacy + { + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5982,6 +5989,12 @@ namespace TL subscription_id = subscription_id, }); + /// See + public static Task Payments_GetStarsGiveawayOptions(this Client client) + => client.Invoke(new Payments_GetStarsGiveawayOptions + { + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -10755,7 +10768,7 @@ namespace TL.Methods } } - [TLDef(0x25C8FE3E)] + [TLDef(0x9DD6A67B)] public sealed partial class Messages_SendPaidReaction : IMethod { public Flags flags; @@ -10763,10 +10776,11 @@ namespace TL.Methods public int msg_id; public int count; public long random_id; + [IfFlag(0)] public bool private_; [Flags] public enum Flags : uint { - private_ = 0x1, + has_private = 0x1, } } @@ -10778,6 +10792,9 @@ namespace TL.Methods public bool private_; } + [TLDef(0x472455AA)] + public sealed partial class Messages_GetPaidReactionPrivacy : IMethod { } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12085,6 +12102,9 @@ namespace TL.Methods public string subscription_id; } + [TLDef(0xBD1EFD3E)] + public sealed partial class Payments_GetStarsGiveawayOptions : IMethod { } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 4a6cb66..7ceea1f 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 = 186; // fetched 14/08/2024 12:45:43 + public const int Version = 187; // fetched 07/09/2024 00:00:28 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -102,7 +102,7 @@ namespace TL [0xE66FBF7B] = typeof(InputMediaDice), [0x89FDD778] = typeof(InputMediaStory), [0xC21B8849] = typeof(InputMediaWebPage), - [0xAA661FC3] = typeof(InputMediaPaidMedia), + [0xC4103386] = typeof(InputMediaPaidMedia), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -164,8 +164,8 @@ namespace TL [0x4BD6E798] = typeof(MessageMediaPoll), [0x3F7EE58B] = typeof(MessageMediaDice), [0x68CB6283] = typeof(MessageMediaStory), - [0xDAAD85B0] = typeof(MessageMediaGiveaway), - [0xC6991068] = typeof(MessageMediaGiveawayResults), + [0xAA073BEB] = typeof(MessageMediaGiveaway), + [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), [0xA8852491] = typeof(MessageMediaPaidMedia), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), @@ -206,12 +206,13 @@ namespace TL [0x31518E9B] = typeof(MessageActionRequestedPeer), [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), [0x678C2E09] = typeof(MessageActionGiftCode), - [0x332BA9ED] = typeof(MessageActionGiveawayLaunch), - [0x2A9FADC5] = typeof(MessageActionGiveawayResults), + [0xA80F51E4] = typeof(MessageActionGiveawayLaunch), + [0x87E2F155] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), [0x93B31848] = typeof(MessageActionRequestedPeerSentMe), [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), + [0xB00C47A2] = typeof(MessageActionPrizeStars), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -415,6 +416,8 @@ namespace TL [0x0FB85198] = typeof(UpdateStarsBalance), [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), + [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), + [0x51CA7AEC] = typeof(UpdatePaidReactionPrivacy), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -836,6 +839,7 @@ namespace TL [0x3EA9FEB1] = typeof(ChannelAdminLogEventActionChangeEmojiStatus), [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), + [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1094,6 +1098,7 @@ namespace TL [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), + [0x751F08FA] = typeof(InputStorePaymentStarsGiveaway), [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty @@ -1195,9 +1200,10 @@ namespace TL [0x257E962B] = typeof(PremiumGiftCodeOption), [0x284A1096] = typeof(Payments_CheckedGiftCode), [0x4367DAA0] = typeof(Payments_GiveawayInfo), - [0x00CD5570] = typeof(Payments_GiveawayInfoResults), + [0xE175E66F] = typeof(Payments_GiveawayInfoResults), [0xB2539D54] = typeof(PrepaidGiveaway), - [0x2A1C8C71] = typeof(Boost), + [0x9A9D77E0] = typeof(PrepaidStarsGiveaway), + [0x4B3E14D6] = typeof(Boost), [0x86F8613C] = typeof(Premium_BoostsList), [0xC448415C] = typeof(MyBoost), [0x9AE228E2] = typeof(Premium_MyBoosts), @@ -1285,7 +1291,7 @@ namespace TL [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), [0x56E34970] = typeof(ReactionsNotifySettings), - [0x8438F1C6] = typeof(BroadcastRevenueBalances), + [0xC3FF71E7] = typeof(BroadcastRevenueBalances), [0x93C3E27E] = typeof(AvailableEffect), [0xD1ED9A5B] = null,//Messages_AvailableEffectsNotModified [0xBDDB616E] = typeof(Messages_AvailableEffects), @@ -1298,7 +1304,7 @@ namespace TL [0xD80DA15D] = typeof(StarsTransactionPeer), [0x60682812] = typeof(StarsTransactionPeerAds), [0x0BD915C0] = typeof(StarsTopupOption), - [0x433AEB2B] = typeof(StarsTransaction), + [0xEE7522D5] = typeof(StarsTransaction), [0xBBFA316C] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), @@ -1315,6 +1321,8 @@ namespace TL [0x05416D58] = typeof(StarsSubscriptionPricing), [0x538ECF18] = typeof(StarsSubscription), [0x4BA3A95A] = typeof(MessageReactor), + [0x94CE852A] = typeof(StarsGiveawayOption), + [0x54236209] = typeof(StarsGiveawayWinnersOption), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3d71cd9..5aa756e 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: 186 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 187 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 68a1c8650f36edcea7de732304c1f4847662022a Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Sep 2024 18:43:52 +0200 Subject: [PATCH 232/336] Use more ResetAsync/DisposeAsync internally for better async --- .github/dev.yml | 2 +- src/Client.cs | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 0128bc4..16ed768 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.9-dev.$(Rev:r) +name: 4.1.10-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.cs b/src/Client.cs index 5f9fdea..46a45aa 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -237,7 +237,7 @@ namespace WTelegram foreach (var altSession in _session.DCSessions.Values) if (altSession.Client != null && altSession.Client != this) { - altSession.Client.Dispose(); + await altSession.Client.DisposeAsync(); altSession.Client = null; } } @@ -735,7 +735,7 @@ namespace WTelegram retryLast = false; else { - Reset(false, false); + await ResetAsync(false, false); _dcSession.Renew(); await ConnectAsync(); } @@ -1562,7 +1562,7 @@ namespace WTelegram Session.DCSession dcSession; lock (_session) dcSession = GetOrCreateDCSession(dcId, _dcSession.DataCenter.flags); - Reset(false, false); + await ResetAsync(false, false); _session.MainDC = dcId; _dcSession.Client = null; _dcSession = dcSession; From b6cb62793c86e8d8a4f59654f81287187ebb5594 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Sep 2024 18:50:07 +0200 Subject: [PATCH 233/336] =?UTF-8?q?Fix=20infinite=20recursion=20on=20Dispo?= =?UTF-8?q?se=20(#274)=20=F0=9F=8E=ACTake=203?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/Client.cs | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 46a45aa..23c67ab 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -268,8 +268,7 @@ namespace WTelegram flags &= ~DcOption.Flags.media_only; dcId = Math.Abs(dcId); } - var dcOptions = _session.DcOptions.Where(dc => dc.id == Math.Abs(dcId)) - .OrderBy(dc => dc.flags.HasFlag(DcOption.Flags.media_only) ^ (dcId < 0)).ThenBy(dc => dc.flags ^ flags); + var dcOptions = GetDcOptions(Math.Abs(dcId), flags); var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing dcSession.DataCenter = dcOption; @@ -831,6 +830,14 @@ namespace WTelegram await _connecting; } + private IEnumerable GetDcOptions(int dcId, DcOption.Flags flags) => !flags.HasFlag(DcOption.Flags.media_only) + ? _session.DcOptions.Where(dc => dc.id == dcId && (dc.flags & (DcOption.Flags.cdn | DcOption.Flags.tcpo_only | DcOption.Flags.media_only)) == 0) + .OrderBy(dc => dc.flags ^ flags) + : _session.DcOptions.Where(dc => dc.id == dcId && (dc.flags & (DcOption.Flags.cdn | DcOption.Flags.tcpo_only)) == 0) + .OrderBy(dc => ~dc.flags & DcOption.Flags.media_only).ThenBy(dc => dc.flags ^ flags) + .Select(dc => dc.flags.HasFlag(DcOption.Flags.media_only) ? dc : new DcOption { id = dc.id, port = dc.port, + ip_address = dc.ip_address, secret = dc.secret, flags = dc.flags | DcOption.Flags.media_only }); + private async Task DoConnectAsync(bool quickResume) { _cts = new(); @@ -883,11 +890,7 @@ namespace WTelegram var triedEndpoints = new HashSet { endpoint }; if (_session.DcOptions != null) { - var flags = _dcSession.DataCenter.flags; - var altOptions = _session.DcOptions.Where(dc => dc.id == _dcSession.DataCenter.id && dc.flags != flags - && (dc.flags & DcOption.Flags.media_only) <= (flags & DcOption.Flags.media_only) - && (dc.flags & (DcOption.Flags.cdn | DcOption.Flags.tcpo_only)) == 0) - .OrderBy(dc => (dc.flags ^ flags) & DcOption.Flags.media_only).ThenBy(dc => dc.flags ^ flags); + var altOptions = GetDcOptions(_dcSession.DataCenter.id, _dcSession.DataCenter.flags); // try alternate addresses for this DC foreach (var dcOption in altOptions) { @@ -897,11 +900,7 @@ namespace WTelegram try { tcpClient = await TcpHandler(endpoint.Address.ToString(), endpoint.Port); - if (((dcOption.flags ^ flags) & DcOption.Flags.media_only) == 0) // test to prevent AltDC becoming MainDC - _dcSession.DataCenter = dcOption; - else - _dcSession.DataCenter = new DcOption { flags = dcOption.flags ^ DcOption.Flags.media_only, - id = dcOption.id, ip_address = dcOption.ip_address, port = dcOption.port, secret = dcOption.secret }; + _dcSession.DataCenter = dcOption; break; } catch (SocketException) { } From f0a649c14794f3512784a36e3335804ec0ca6cac Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 8 Sep 2024 19:16:23 +0200 Subject: [PATCH 234/336] Fix #284: OnOwnUpdates null warning on Messages_AffectedMessages --- src/Client.cs | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 23c67ab..dba4734 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -615,9 +615,8 @@ namespace WTelegram else { Helpers.Log(1, $" → {result?.GetType().Name,-37} #{(short)msgId.GetHashCode():X4}"); - if (OnOwnUpdates != null) - if (result is UpdatesBase updates) - RaiseOwnUpdates(updates); + if (OnOwnUpdates != null && result is UpdatesBase updates) + RaiseOwnUpdates(updates); } rpc.tcs.SetResult(result); @@ -797,7 +796,7 @@ namespace WTelegram { try { - await OnOwnUpdates(updates); + await OnOwnUpdates?.Invoke(updates); } catch (Exception ex) { @@ -1572,11 +1571,12 @@ namespace WTelegram public async Task InvokeAffected(IMethod query, long peerId) where T : Messages_AffectedMessages { var result = await Invoke(query); - RaiseOwnUpdates(new UpdateShort - { - update = new UpdateAffectedMessages { mbox_id = peerId, pts = result.pts, pts_count = result.pts_count}, - date = MsgIdToStamp(_lastRecvMsgId) - }); + if (OnOwnUpdates != null) + RaiseOwnUpdates(new UpdateShort + { + update = new UpdateAffectedMessages { mbox_id = peerId, pts = result.pts, pts_count = result.pts_count }, + date = MsgIdToStamp(_lastRecvMsgId) + }); return result; } } From 6cfa2a4da6e82831b5b30fa1cb7ed10e1363c660 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 19 Sep 2024 13:34:56 +0200 Subject: [PATCH 235/336] API Layer 188: Channels_ClickSponsoredMessage, KeyboardButtonCopy, alt_documents --- README.md | 2 +- src/TL.Schema.cs | 19 ++++++++++++++----- src/TL.SchemaFuncs.cs | 12 ++++++++++-- src/TL.Table.cs | 7 ++++--- src/WTelegramClient.csproj | 2 +- 5 files changed, 30 insertions(+), 12 deletions(-) diff --git a/README.md b/README.md index e8c37d0..4cb2c01 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-187-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-188-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 f5e93e8..bd4506f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1973,7 +1973,7 @@ namespace TL [TLDef(0x9F84F49E)] public sealed partial class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See - [TLDef(0x4CF4D72D)] + [TLDef(0xDD570BD5)] public sealed partial class MessageMediaDocument : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1981,7 +1981,7 @@ namespace TL /// Attached document [IfFlag(0)] public DocumentBase document; /// Currently only used for story videos, may contain an alternative version of the story video, explicitly encoded using H.264 (in MPEG4 transport) at a lower resolution than document. - [IfFlag(5)] public DocumentBase alt_document; + [IfFlag(5)] public DocumentBase[] alt_documents; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -1995,8 +1995,8 @@ namespace TL nopremium = 0x8, /// Whether this media should be hidden behind a spoiler warning spoiler = 0x10, - /// Field has a value - has_alt_document = 0x20, + /// Field has a value + has_alt_documents = 0x20, /// Whether this is a video. video = 0x40, /// Whether this is a round video. @@ -6901,7 +6901,7 @@ namespace TL } } /// Defines a video See - [TLDef(0x17399FAD)] + [TLDef(0x43C57C48)] public sealed partial class DocumentAttributeVideo : DocumentAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -6916,6 +6916,7 @@ namespace TL [IfFlag(2)] public int preload_prefix_size; /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; + [IfFlag(5)] public string video_codec; [Flags] public enum Flags : uint { @@ -6929,6 +6930,8 @@ namespace TL nosound = 0x8, /// Field has a value has_video_start_ts = 0x10, + /// Field has a value + has_video_codec = 0x20, } } /// Represents an audio file See @@ -7866,6 +7869,12 @@ namespace TL /// Button text public override string Text => text; } + /// See + [TLDef(0x75D2698E, inheritBefore = true)] + public sealed partial class KeyboardButtonCopy : KeyboardButton + { + public string copy_text; + } /// Inline keyboard row See [TLDef(0x77608B83)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 8ebca1f..9939bdb 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -5352,9 +5352,10 @@ namespace TL /// Informs the server that the user has either: See Possible codes: 400 (details) /// Channel where the sponsored message was posted /// Message ID - public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) + public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, bool media = false, bool fullscreen = false) => client.Invoke(new Channels_ClickSponsoredMessage { + flags = (Channels_ClickSponsoredMessage.Flags)((media ? 0x1 : 0) | (fullscreen ? 0x2 : 0)), channel = channel, random_id = random_id, }); @@ -11570,11 +11571,18 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x18AFBC93)] + [TLDef(0x01445D75)] public sealed partial class Channels_ClickSponsoredMessage : IMethod { + public Flags flags; public InputChannelBase channel; public byte[] random_id; + + [Flags] public enum Flags : uint + { + media = 0x1, + fullscreen = 0x2, + } } [TLDef(0xD8AA3671)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 7ceea1f..61ac1cc 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 = 187; // fetched 07/09/2024 00:00:28 + public const int Version = 188; // fetched 19/09/2024 11:16:22 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -155,7 +155,7 @@ namespace TL [0x56E0D474] = typeof(MessageMediaGeo), [0x70322949] = typeof(MessageMediaContact), [0x9F84F49E] = typeof(MessageMediaUnsupported), - [0x4CF4D72D] = typeof(MessageMediaDocument), + [0xDD570BD5] = typeof(MessageMediaDocument), [0xDDF10C3B] = typeof(MessageMediaWebPage), [0x2EC0533F] = typeof(MessageMediaVenue), [0xFDB19008] = typeof(MessageMediaGame), @@ -513,7 +513,7 @@ namespace TL [0x6C37C15C] = typeof(DocumentAttributeImageSize), [0x11B58939] = typeof(DocumentAttributeAnimated), [0x6319D612] = typeof(DocumentAttributeSticker), - [0x17399FAD] = typeof(DocumentAttributeVideo), + [0x43C57C48] = typeof(DocumentAttributeVideo), [0x9852F9C6] = typeof(DocumentAttributeAudio), [0x15590068] = typeof(DocumentAttributeFilename), [0x9801D2F7] = typeof(DocumentAttributeHasStickers), @@ -573,6 +573,7 @@ namespace TL [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), [0x53D7BFD8] = typeof(KeyboardButtonRequestPeer), [0xC9662D05] = typeof(InputKeyboardButtonRequestPeer), + [0x75D2698E] = typeof(KeyboardButtonCopy), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 5aa756e..c8fd8b3 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: 187 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 188 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From dcfd89c2a8f499bb26b7aeb947ffe09466c10a46 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 21 Sep 2024 19:39:41 +0200 Subject: [PATCH 236/336] AnalyzeInviteLink: hacky detection of request_needed/join_request for basic chat links --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 16ed768..e72c5c8 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.10-dev.$(Rev:r) +name: 4.1.11-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c0c13ab..d09b441 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -754,7 +754,8 @@ namespace WTelegram } var rrAbout = ci.about == null ? null : new RestrictionReason[] { new() { text = ci.about } }; return !ci.flags.HasFlag(ChatInvite.Flags.channel) - ? new Chat { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count } + ? new Chat { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count, + flags = ci.flags.HasFlag(ChatInvite.Flags.request_needed) ? (Chat.Flags)Channel.Flags.join_request : 0 } : new Channel { title = ci.title, photo = chatPhoto, participants_count = ci.participants_count, restriction_reason = rrAbout, flags = Channel.Flags.min | (ci.flags.HasFlag(ChatInvite.Flags.broadcast) ? Channel.Flags.broadcast : 0) | From 4f9accdfc80bc1e3d93f08bb1b156d217b042fd6 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 23 Sep 2024 00:21:14 +0200 Subject: [PATCH 237/336] SendAlbumAsync: For bots, upload external url natively instead of fetching via HttpClient --- src/Client.Helpers.cs | 27 ++++++++++++++++++++++----- 1 file changed, 22 insertions(+), 5 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index d09b441..c8fc6c9 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -215,18 +215,35 @@ namespace WTelegram var mmd = (MessageMediaDocument)await this.Messages_UploadMedia(peer, imud); ism.media = mmd.document; break; + case InputMediaPhotoExternal impe: + if (User.IsBot) + try + { + mmp = (MessageMediaPhoto)await this.Messages_UploadMedia(peer, impe); + ism.media = mmp.photo; + break; + } + catch (RpcException) { } + var inputFile = await UploadFromUrl(impe.url); + ism.media = new InputMediaUploadedPhoto { file = inputFile }; + goto retry; case InputMediaDocumentExternal imde: + if (!videoUrlAsFile && User.IsBot) + try + { + mmd = (MessageMediaDocument)await this.Messages_UploadMedia(peer, imde); + ism.media = mmd.document; + break; + } + catch (RpcException) { } string mimeType = null; - var inputFile = await UploadFromUrl(imde.url); + ism.media = (await this.Messages_UploadMedia(peer, ism.media)).ToInputMedia(); + inputFile = await UploadFromUrl(imde.url); if (videoUrlAsFile || mimeType?.StartsWith("video/") != true) ism.media = new InputMediaUploadedDocument(inputFile, mimeType); else ism.media = new InputMediaUploadedDocument(inputFile, mimeType, new DocumentAttributeVideo { flags = DocumentAttributeVideo.Flags.supports_streaming }); goto retry; - case InputMediaPhotoExternal impe: - inputFile = await UploadFromUrl(impe.url); - ism.media = new InputMediaUploadedPhoto { file = inputFile }; - goto retry; async Task UploadFromUrl(string url) { From a19db86c1db8c3d49c42dcee7cdb17bd77e7010f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 30 Sep 2024 02:15:10 +0200 Subject: [PATCH 238/336] Support for connecting to Telegram via on-demand HTTP requests instead of permanent TCP connection: client.HttpMode (experimental) --- src/Client.Helpers.cs | 6 ++-- src/Client.cs | 78 +++++++++++++++++++++++++++++++------------ 2 files changed, 59 insertions(+), 25 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c8fc6c9..a3c55c4 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -187,10 +187,10 @@ namespace WTelegram /// Text formatting entities for the caption. You can use MarkdownToEntities to create these /// UTC timestamp when the message should be sent /// Any URL pointing to a video should be considered as non-streamable - /// The last of the media group messages, confirmed by Telegram + /// The media group messages as received by Telegram /// - /// * The caption/entities are set on the last media
- /// * and are supported by downloading the file from the web via HttpClient and sending it to Telegram. + /// * The caption/entities are set on the first media
+ /// * and are supported natively for bot accounts, and for user accounts by downloading the file from the web via HttpClient and sending it to Telegram. /// WTelegramClient proxy settings don't apply to HttpClient
/// * You may run into errors if you mix, in the same album, photos and file documents having no thumbnails/video attributes ///
diff --git a/src/Client.cs b/src/Client.cs index dba4734..9ad0516 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -6,6 +6,7 @@ using System.Globalization; using System.IO; using System.Linq; using System.Net; +using System.Net.Http; using System.Net.Sockets; using System.Reflection; using System.Security.Cryptography; @@ -28,8 +29,6 @@ namespace WTelegram /// This event will be called when unsollicited updates/messages are sent by Telegram servers /// Make your handler , or return or
See Examples/Program_ReactorError.cs for how to use this
or Examples/Program_ListenUpdate.cs using the UpdateManager class instead
public event Func OnUpdates; - [Obsolete("This event was renamed OnUpdates (plural). You may also want to consider using our new UpdateManager class instead (see FAQ)")] - public event Func OnUpdate { add { OnUpdates += value; } remove { OnUpdates -= value; } } /// This event is called for other types of notifications (login states, reactor errors, ...) public event Func OnOther; /// Use this handler to intercept Updates that resulted from your own API calls @@ -67,6 +66,7 @@ namespace WTelegram private Session.DCSession _dcSession; private TcpClient _tcpClient; private Stream _networkStream; + private HttpClient _httpClient; private IObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = []; @@ -198,6 +198,10 @@ namespace WTelegram } public void DisableUpdates(bool disable = true) => _dcSession.DisableUpdates(disable); + + /// Enable connecting to Telegram via on-demand HTTP requests instead of permanent TCP connection + /// HttpClient to use. Leave for a default one + public void HttpMode(HttpClient httpClient = null) => _httpClient = httpClient ?? new(); /// Disconnect from Telegram (shouldn't be needed in normal usage) /// Forget about logged-in user @@ -513,16 +517,16 @@ namespace WTelegram return null; } } - - static string TransportError(int error_code) => error_code switch - { - 404 => "Auth key not found", - 429 => "Transport flood", - 444 => "Invalid DC", - _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" - }; } + static string TransportError(int error_code) => error_code switch + { + 404 => "Auth key not found", + 429 => "Transport flood", + 444 => "Invalid DC", + _ => Enum.GetName(typeof(HttpStatusCode), error_code) ?? "Transport error" + }; + internal void CheckSalt() { lock (_session) @@ -871,6 +875,8 @@ namespace WTelegram throw new Exception("Library was not compiled with OBFUSCATION symbol"); #endif } + if (_httpClient != null) + _reactorTask = Task.CompletedTask; else { endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out int defaultDc); @@ -930,16 +936,19 @@ namespace WTelegram _networkStream = _tcpClient.GetStream(); } - byte protocolId = (byte)(_paddedMode ? 0xDD : 0xEE); -#if OBFUSCATION - (_sendCtr, _recvCtr, preamble) = InitObfuscation(secret, protocolId, dcId); -#else - preamble = new byte[] { protocolId, protocolId, protocolId, protocolId }; -#endif - await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _dcSession.Salts?.Remove(DateTime.MaxValue); - _reactorTask = Reactor(_networkStream, _cts); + if (_networkStream != null) + { + byte protocolId = (byte)(_paddedMode ? 0xDD : 0xEE); +#if OBFUSCATION + (_sendCtr, _recvCtr, preamble) = InitObfuscation(secret, protocolId, dcId); +#else + preamble = new byte[] { protocolId, protocolId, protocolId, protocolId }; +#endif + await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); + + _reactorTask = Reactor(_networkStream, _cts); + } _sendSemaphore.Release(); try @@ -947,7 +956,7 @@ namespace WTelegram if (_dcSession.AuthKeyID == 0) await CreateAuthorizationKey(this, _dcSession); - var keepAliveTask = KeepAlive(_cts.Token); + if (_networkStream != null) _ = KeepAlive(_cts.Token); if (quickResume && _dcSession.Layer == Layer.Version && _dcSession.DataCenter != null && _session.MainDC != 0) TLConfig = new Config { this_dc = _session.MainDC, dc_options = _session.DcOptions }; else @@ -1467,10 +1476,11 @@ namespace WTelegram int frameLength = (int)memStream.Length; BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value #if OBFUSCATION - _sendCtr.EncryptDecrypt(buffer, frameLength); + _sendCtr?.EncryptDecrypt(buffer, frameLength); #endif - await _networkStream.WriteAsync(buffer, 0, frameLength); + var sending = SendFrame(buffer, frameLength); _lastSentMsg = msg; + await sending; } finally { @@ -1478,6 +1488,24 @@ namespace WTelegram } } + private async Task SendFrame(byte[] buffer, int frameLength) + { + if (_httpClient == null) + await _networkStream.WriteAsync(buffer, 0, frameLength); + else + { + var endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out _); + var content = new ByteArrayContent(buffer, 4, frameLength - 4); + var response = await _httpClient.PostAsync($"http://{endpoint}/api", content); + if (response.StatusCode != HttpStatusCode.OK) + throw new RpcException((int)response.StatusCode, TransportError((int)response.StatusCode)); + var data = await response.Content.ReadAsByteArrayAsync(); + var obj = ReadFrame(data, data.Length); + if (obj != null) + await HandleMessageAsync(obj); + } + } + internal async Task InvokeBare(IMethod request) { if (_bareRpc != null) throw new WTException("A bare request is already undergoing"); @@ -1501,6 +1529,12 @@ namespace WTelegram retry: var rpc = new Rpc { type = typeof(T) }; await SendAsync(query, true, rpc); + if (_httpClient != null && !rpc.Task.IsCompleted) + { + await SendAsync(new HttpWait { max_delay = 30, wait_after = 10, max_wait = 1000 * PingInterval }, true); + if (!rpc.Task.IsCompleted) rpc.tcs.TrySetException(new RpcException(417, "Missing RPC response via HTTP")); + } + var result = await rpc.Task; switch (result) { From 62c105959c96930edec70f6f25e307b12c097119 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 7 Oct 2024 02:43:07 +0200 Subject: [PATCH 239/336] Improved HTTP support --- generator/MTProtoGenerator.cs | 4 +-- src/Client.cs | 59 ++++++++++++++++++++++++++--------- src/TL.cs | 26 +++++++-------- 3 files changed, 60 insertions(+), 29 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 06ad7d1..5cc7719 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -159,7 +159,7 @@ public class MTProtoGenerator : IIncrementalGenerator readTL.AppendLine($"r.{member.Name} = new Int256(reader);"); writeTl.AppendLine($"writer.Write({member.Name});"); break; - case "TL._Message[]": + case "System.Collections.Generic.List": readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<_Message>(0x5BB8E511);"); writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); break; @@ -179,7 +179,7 @@ public class MTProtoGenerator : IIncrementalGenerator if (member.Type is IArrayTypeSymbol arrayType) { if (name is "FutureSalts") - readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC);"); + readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC).ToArray();"); else readTL.AppendLine($"r.{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); diff --git a/src/Client.cs b/src/Client.cs index 9ad0516..04ec435 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -67,6 +67,7 @@ namespace WTelegram private TcpClient _tcpClient; private Stream _networkStream; private HttpClient _httpClient; + private HttpWait _httpWait; private IObject _lastSentMsg; private long _lastRecvMsgId; private readonly List _msgsToAck = []; @@ -192,16 +193,23 @@ namespace WTelegram foreach (var rpc in _pendingRpcs.Values) rpc.tcs.TrySetException(ex); _sendSemaphore.Dispose(); + _httpClient?.Dispose(); _networkStream = null; if (IsMainDC) _session.Dispose(); GC.SuppressFinalize(this); } public void DisableUpdates(bool disable = true) => _dcSession.DisableUpdates(disable); - + /// Enable connecting to Telegram via on-demand HTTP requests instead of permanent TCP connection /// HttpClient to use. Leave for a default one - public void HttpMode(HttpClient httpClient = null) => _httpClient = httpClient ?? new(); + /// Default HttpWait parameters for requests.⚠️ Telegram servers don't support this correctly at the moment.So leave for the default 25 seconds long poll + public void HttpMode(HttpClient httpClient = null, HttpWait defaultHttpWait = null) + { + if (_tcpClient != null) throw new InvalidOperationException("Cannot switch to HTTP after TCP connection"); + _httpClient = httpClient ?? new(); + _httpWait = defaultHttpWait; + } /// Disconnect from Telegram (shouldn't be needed in normal usage) /// Forget about logged-in user @@ -560,10 +568,11 @@ namespace WTelegram internal MsgContainer ReadMsgContainer(BinaryReader reader) { int count = reader.ReadInt32(); - var array = new _Message[count]; + var messages = new List<_Message>(count); for (int i = 0; i < count; i++) { - var msg = array[i] = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() }; + var msg = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() }; + messages.Add(msg); if ((msg.seq_no & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); var pos = reader.BaseStream.Position; try @@ -584,9 +593,9 @@ namespace WTelegram { Helpers.Log(4, "While deserializing vector<%Message>: " + ex.ToString()); } - reader.BaseStream.Position = pos + array[i].bytes; + reader.BaseStream.Position = pos + msg.bytes; } - return new MsgContainer { messages = array }; + return new MsgContainer { messages = messages }; } private RpcResult ReadRpcResult(BinaryReader reader) @@ -1407,16 +1416,23 @@ namespace WTelegram { if (_reactorTask == null) throw new WTException("You must connect to Telegram first"); isContent &= _dcSession.AuthKeyID != 0; - (long msgId, int seqno) = NewMsgId(isContent); + var (msgId, seqno) = NewMsgId(isContent); if (rpc != null) lock (_pendingRpcs) _pendingRpcs[rpc.msgId = msgId] = rpc; - if (isContent && CheckMsgsToAck() is MsgsAck msgsAck) + if (isContent) { - var (ackId, ackSeqno) = NewMsgId(false); - var container = new MsgContainer { messages = [new(msgId, seqno, msg), new(ackId, ackSeqno, msgsAck)] }; - await SendAsync(container, false); - return; + List<_Message> messages = null; + if (_httpWait != null && NewMsgId(false) is var (hwId, hwSeqno)) + (messages ??= []).Add(new(hwId, hwSeqno, _httpWait)); + if (CheckMsgsToAck() is MsgsAck msgsAck && NewMsgId(false) is var (ackId, ackSeqno)) + (messages ??= []).Add(new(ackId, ackSeqno, msgsAck)); + if (messages != null) + { + messages.Add(new(msgId, seqno, msg)); + await SendAsync(new MsgContainer { messages = messages }, false); + return; + } } await _sendSemaphore.WaitAsync(_cts.Token); try @@ -1490,7 +1506,7 @@ namespace WTelegram private async Task SendFrame(byte[] buffer, int frameLength) { - if (_httpClient == null) + if (_networkStream != null) await _networkStream.WriteAsync(buffer, 0, frameLength); else { @@ -1506,6 +1522,20 @@ namespace WTelegram } } + /// Long poll on HTTP connections + /// Parameters for the long poll. Leave for the default 25 seconds. + /// ⚠️ Telegram servers don't seem to support other parameter than correctly + public async Task HttpWait(HttpWait httpWait = null) + { + if (_networkStream != null) throw new InvalidOperationException("Can't use HttpWait over TCP connection"); + var container = new MsgContainer { messages = [] }; + if (httpWait != null && NewMsgId(false) is var (hwId, hwSeqno)) + container.messages.Add(new(hwId, hwSeqno, httpWait)); + if (CheckMsgsToAck() is MsgsAck msgsAck && NewMsgId(false) is var (ackId, ackSeqno)) + container.messages.Add(new(ackId, ackSeqno, msgsAck)); + await SendAsync(container, false); + } + internal async Task InvokeBare(IMethod request) { if (_bareRpc != null) throw new WTException("A bare request is already undergoing"); @@ -1531,7 +1561,8 @@ namespace WTelegram await SendAsync(query, true, rpc); if (_httpClient != null && !rpc.Task.IsCompleted) { - await SendAsync(new HttpWait { max_delay = 30, wait_after = 10, max_wait = 1000 * PingInterval }, true); + // usually happens when a batch of unrelated messages were serialized before in the previous MsgContainer reply + await HttpWait(_httpWait); // wait a bit more if (!rpc.Task.IsCompleted) rpc.tcs.TrySetException(new RpcException(417, "Missing RPC response via HTTP")); } diff --git a/src/TL.cs b/src/TL.cs index 6884b25..741bab4 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -127,16 +127,16 @@ namespace TL if (type.IsArray) if (value is byte[] bytes) writer.WriteTLBytes(bytes); - else if (value is _Message[] messages) - writer.WriteTLMessages(messages); else writer.WriteTLVector((Array)value); + else if (value is IObject tlObject) + WriteTLObject(writer, tlObject); + else if (value is List<_Message> messages) + writer.WriteTLMessages(messages); else if (value is Int128 int128) writer.Write(int128); else if (value is Int256 int256) writer.Write(int256); - else if (value is IObject tlObject) - WriteTLObject(writer, tlObject); else if (type.IsEnum) // needed for Mono (enums in generic types are seen as TypeCode.Object) writer.Write((uint)value); else @@ -191,22 +191,22 @@ namespace TL } } - internal static void WriteTLMessages(this BinaryWriter writer, _Message[] messages) + internal static void WriteTLMessages(this BinaryWriter writer, List<_Message> messages) { - writer.Write(messages.Length); + writer.Write(messages.Count); foreach (var msg in messages) { writer.Write(msg.msg_id); writer.Write(msg.seq_no); var patchPos = writer.BaseStream.Position; - writer.Write(0); // patched below + writer.Write(0); // patched below if ((msg.seq_no & 1) != 0) WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); writer.WriteTLObject(msg.body); writer.BaseStream.Position = patchPos; - writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field + writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field writer.Seek(0, SeekOrigin.End); } } @@ -222,13 +222,13 @@ namespace TL writer.WriteTLValue(array.GetValue(i), elementType); } - internal static T[] ReadTLRawVector(this BinaryReader reader, uint ctorNb) + internal static List ReadTLRawVector(this BinaryReader reader, uint ctorNb) { int count = reader.ReadInt32(); - var array = new T[count]; + var list = new List(count); for (int i = 0; i < count; i++) - array[i] = (T)reader.ReadTLObject(ctorNb); - return array; + list.Add((T)reader.ReadTLObject(ctorNb)); + return list; } internal static T[] ReadTLVector(this BinaryReader reader) @@ -437,7 +437,7 @@ namespace TL } [TLDef(0x73F1F8DC)] //msg_container#73f1f8dc messages:vector<%Message> = MessageContainer - public sealed partial class MsgContainer : IObject { public _Message[] messages; } + public sealed partial class MsgContainer : IObject { public List<_Message> messages; } [TLDef(0xE06046B2)] //msg_copy#e06046b2 orig_message:Message = MessageCopy public sealed partial class MsgCopy : IObject { public _Message orig_message; } From 73e4b6c871c276d70903bc7f8249333d3684efdc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:42:22 +0200 Subject: [PATCH 240/336] API Layer 189: Star Gifts, improved reporting --- README.md | 2 +- src/TL.Schema.cs | 198 +++++++++++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 98 ++++++++++++++---- src/TL.Table.cs | 19 +++- src/WTelegramClient.csproj | 2 +- 5 files changed, 254 insertions(+), 65 deletions(-) diff --git a/README.md b/README.md index 4cb2c01..db8cbd9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-188-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-189-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 bd4506f..f510d62 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -757,19 +757,19 @@ namespace TL public Flags2 flags2; /// ID of the user, see here » for more info. public long id; - /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
- The phone flag is not set OR
- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
- There is no locally cached object for this user OR
- There is no access_hash in the local cache OR
- The cached object's min_access_hash is also true
If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
+ /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
-- The phone flag is not set OR
-- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
-- There is no locally cached object for this user OR
-- There is no access_hash in the local cache OR
-- The cached object's min_access_hash is also true

If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
[IfFlag(0)] public long access_hash; - /// First name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// First name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(1)] public string first_name; - /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// Last name.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(2)] public string last_name; - /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag should invalidate the local cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
+ /// Main active username.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag should invalidate the local cache for this user ID if the above conditions are respected and the bot_can_edit flag is also set.
[IfFlag(3)] public string username; - /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
+ /// Phone number.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
[IfFlag(4)] public string phone; - /// Profile picture of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The apply_min_photo flag is set OR
- The min flag of the locally cached user entry is set.
+ /// Profile picture of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The apply_min_photo flag is set OR
-- The min flag of the locally cached user entry is set.
[IfFlag(5)] public UserProfilePhoto photo; - /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set OR
- The locally cached user entry is equal to .
+ /// Online status of user.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set OR
-- The locally cached user entry is equal to .
[IfFlag(6)] public UserStatus status; /// Version of the bot_info field in userFull, incremented every time it changes.
Changes to this flag should invalidate the local cache for this user ID, see here » for more info.
[IfFlag(14)] public int bot_info_version; @@ -781,7 +781,7 @@ namespace TL [IfFlag(22)] public string lang_code; /// Emoji status [IfFlag(30)] public EmojiStatus emoji_status; - /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
+ /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
[IfFlag(37)] public int stories_max_id; @@ -1980,7 +1980,6 @@ namespace TL public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; - /// Currently only used for story videos, may contain an alternative version of the story video, explicitly encoded using H.264 (in MPEG4 transport) at a lower resolution than document. [IfFlag(5)] public DocumentBase[] alt_documents; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2784,6 +2783,23 @@ namespace TL unclaimed = 0x1, } } + /// See + [TLDef(0x9BB3EF44)] + public sealed partial class MessageActionStarGift : MessageAction + { + public Flags flags; + public StarGift gift; + [IfFlag(1)] public TextWithEntities message; + public long convert_stars; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_message = 0x2, + saved = 0x4, + converted = 0x8, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3388,7 +3404,7 @@ namespace TL } /// Extended user info See - [TLDef(0xCC997720)] + [TLDef(0x1F58E369)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3449,6 +3465,7 @@ namespace TL [IfFlag(38)] public long personal_channel_id; /// ID of the latest message of the associated personal channel », that should be previewed in the profile page. [IfFlag(38)] public int personal_channel_message; + [IfFlag(40)] public int stargifts_count; [Flags] public enum Flags : uint { @@ -3528,6 +3545,8 @@ namespace TL has_personal_channel_id = 0x40, /// Whether ads were re-enabled for the current account (only accessible to the currently logged-in user), see here » for more info. sponsored_enabled = 0x80, + /// Field has a value + has_stargifts_count = 0x100, } } @@ -10520,18 +10539,8 @@ namespace TL { /// Form ID public virtual long FormId => default; - /// Bot ID - public virtual long BotId => default; - /// Form title - public virtual string Title => default; - /// Description - public virtual string Description => default; - /// Product photo - public virtual WebDocumentBase Photo => default; /// Invoice public virtual Invoice Invoice => default; - /// Users - public virtual Dictionary Users => default; } /// Payment form See [TLDef(0xA0058751)] @@ -10588,18 +10597,8 @@ namespace TL /// Form ID public override long FormId => form_id; - /// Bot ID - public override long BotId => bot_id; - /// Form title - public override string Title => title; - /// Description - public override string Description => description; - /// Product photo - public override WebDocumentBase Photo => photo; /// Invoice public override Invoice Invoice => invoice; - /// Users - public override Dictionary Users => users; } /// Represents a payment form, for payments to be using Telegram Stars, see here » for more info. See [TLDef(0x7BF6B15C)] @@ -10630,18 +10629,18 @@ namespace TL /// Form ID. public override long FormId => form_id; - /// Bot ID. - public override long BotId => bot_id; - /// Form title - public override string Title => title; - /// Description - public override string Description => description; - /// Product photo - public override WebDocumentBase Photo => photo; /// Invoice public override Invoice Invoice => invoice; - /// Info about users mentioned in the other fields. - public override Dictionary Users => users; + } + /// See + [TLDef(0xB425CFE1)] + public sealed partial class Payments_PaymentFormStarGift : Payments_PaymentFormBase + { + public long form_id; + public Invoice invoice; + + public override long FormId => form_id; + public override Invoice Invoice => invoice; } /// Validated user-provided info See @@ -15565,6 +15564,21 @@ namespace TL { public string hash; } + /// See + [TLDef(0x25D8C1D8)] + public sealed partial class InputInvoiceStarGift : InputInvoice + { + public Flags flags; + public InputUserBase user_id; + public long gift_id; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + hide_name = 0x1, + has_message = 0x2, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -18960,7 +18974,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0xEE7522D5)] + [TLDef(0x0A9EE4C2)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18991,6 +19005,7 @@ namespace TL [IfFlag(9)] public MessageMedia[] extended_media; [IfFlag(12)] public int subscription_period; [IfFlag(13)] public int giveaway_post_id; + [IfFlag(14)] public StarGift stargift; [Flags] public enum Flags : uint { @@ -19021,6 +19036,8 @@ namespace TL has_subscription_period = 0x1000, /// Field has a value has_giveaway_post_id = 0x2000, + /// Field has a value + has_stargift = 0x4000, } } @@ -19331,4 +19348,103 @@ namespace TL default_ = 0x1, } } + + /// See + [TLDef(0xAEA174EE)] + public sealed partial class StarGift : IObject + { + public Flags flags; + public long id; + public DocumentBase sticker; + public long stars; + [IfFlag(0)] public int availability_remains; + [IfFlag(0)] public int availability_total; + public long convert_stars; + + [Flags] public enum Flags : uint + { + limited = 0x1, + } + } + + /// See + /// a value means payments.starGiftsNotModified + [TLDef(0x901689EA)] + public sealed partial class Payments_StarGifts : IObject + { + public int hash; + public StarGift[] gifts; + } + + /// See + [TLDef(0xEEA49A6E)] + public sealed partial class UserStarGift : IObject + { + public Flags flags; + [IfFlag(1)] public long from_id; + public DateTime date; + public StarGift gift; + [IfFlag(2)] public TextWithEntities message; + [IfFlag(3)] public int msg_id; + [IfFlag(4)] public long convert_stars; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_from_id = 0x2, + has_message = 0x4, + has_msg_id = 0x8, + has_convert_stars = 0x10, + unsaved = 0x20, + } + } + + /// See + [TLDef(0x6B65B517)] + public sealed partial class Payments_UserStarGifts : IObject + { + public Flags flags; + public int count; + public UserStarGift[] gifts; + [IfFlag(0)] public string next_offset; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0x7903E3D9)] + public sealed partial class MessageReportOption : IObject + { + public string text; + public byte[] option; + } + + /// See + public abstract partial class ReportResult : IObject { } + /// See + [TLDef(0xF0E4E0B6)] + public sealed partial class ReportResultChooseOption : ReportResult + { + public string title; + public MessageReportOption[] options; + } + /// See + [TLDef(0x6F09AC31)] + public sealed partial class ReportResultAddComment : ReportResult + { + public Flags flags; + public byte[] option; + + [Flags] public enum Flags : uint + { + optional = 0x1, + } + } + /// See + [TLDef(0x8DB33C4B)] + public sealed partial class ReportResultReported : ReportResult { } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9939bdb..2ed88ca 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1959,14 +1959,13 @@ namespace TL /// Report a message in a chat for violation of telegram's Terms of Service See Possible codes: 400 (details) /// Peer /// IDs of messages to report - /// Why are these messages being reported /// Comment for report moderation - public static Task Messages_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) + public static Task Messages_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Messages_Report { peer = peer, id = id, - reason = reason, + option = option, message = message, }); @@ -5899,7 +5898,6 @@ namespace TL public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) => client.Invoke(new Payments_SendStarsForm { - flags = 0, form_id = form_id, invoice = invoice, }); @@ -5996,6 +5994,40 @@ namespace TL { }); + /// See + /// a null value means payments.starGiftsNotModified + public static Task Payments_GetStarGifts(this Client client, int hash = default) + => client.Invoke(new Payments_GetStarGifts + { + hash = hash, + }); + + /// See + public static Task Payments_GetUserStarGifts(this Client client, InputUserBase user_id, string offset, int limit = int.MaxValue) + => client.Invoke(new Payments_GetUserStarGifts + { + user_id = user_id, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_SaveStarGift(this Client client, InputUserBase user_id, int msg_id, bool unsave = false) + => client.Invoke(new Payments_SaveStarGift + { + flags = (Payments_SaveStarGift.Flags)(unsave ? 0x1 : 0), + user_id = user_id, + msg_id = msg_id, + }); + + /// See + public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) + => client.Invoke(new Payments_ConvertStarGift + { + user_id = user_id, + msg_id = msg_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -6960,14 +6992,13 @@ namespace TL /// Report a story. See Possible codes: 400 (details) /// The peer that uploaded the story. /// IDs of the stories to report. - /// Why are these storeis being reported. /// Comment for report moderation - public static Task Stories_Report(this Client client, InputPeer peer, int[] id, ReportReason reason, string message) + public static Task Stories_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Stories_Report { peer = peer, id = id, - reason = reason, + option = option, message = message, }); @@ -8769,12 +8800,12 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x8953AB4E)] - public sealed partial class Messages_Report : IMethod + [TLDef(0xFC78AF9B)] + public sealed partial class Messages_Report : IMethod { public InputPeer peer; public int[] id; - public ReportReason reason; + public byte[] option; public string message; } @@ -12012,16 +12043,11 @@ namespace TL.Methods } } - [TLDef(0x02BB731D)] + [TLDef(0x7998C914)] public sealed partial class Payments_SendStarsForm : IMethod { - public Flags flags; public long form_id; public InputInvoice invoice; - - [Flags] public enum Flags : uint - { - } } [TLDef(0x25AE8F4A)] @@ -12113,6 +12139,40 @@ namespace TL.Methods [TLDef(0xBD1EFD3E)] public sealed partial class Payments_GetStarsGiveawayOptions : IMethod { } + [TLDef(0xC4563590)] + public sealed partial class Payments_GetStarGifts : IMethod + { + public int hash; + } + + [TLDef(0x5E72C7E1)] + public sealed partial class Payments_GetUserStarGifts : IMethod + { + public InputUserBase user_id; + public string offset; + public int limit; + } + + [TLDef(0x87ACF08E)] + public sealed partial class Payments_SaveStarGift : IMethod + { + public Flags flags; + public InputUserBase user_id; + public int msg_id; + + [Flags] public enum Flags : uint + { + unsave = 0x1, + } + } + + [TLDef(0x0421E027)] + public sealed partial class Payments_ConvertStarGift : IMethod + { + public InputUserBase user_id; + public int msg_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -12904,12 +12964,12 @@ namespace TL.Methods public int id; } - [TLDef(0x1923FA8C)] - public sealed partial class Stories_Report : IMethod + [TLDef(0x19D8EB45)] + public sealed partial class Stories_Report : IMethod { public InputPeer peer; public int[] id; - public ReportReason reason; + public byte[] option; public string message; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 61ac1cc..a6bd52c 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 = 188; // fetched 19/09/2024 11:16:22 + public const int Version = 189; // fetched 07/10/2024 12:32:56 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -213,6 +213,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), + [0x9BB3EF44] = typeof(MessageActionStarGift), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -240,7 +241,7 @@ namespace TL [0xACD66C5E] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xCC997720] = typeof(UserFull), + [0x1F58E369] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -758,6 +759,7 @@ namespace TL [0x21E753BC] = typeof(Upload_WebFile), [0xA0058751] = typeof(Payments_PaymentForm), [0x7BF6B15C] = typeof(Payments_PaymentFormStars), + [0xB425CFE1] = typeof(Payments_PaymentFormStarGift), [0xD1451883] = typeof(Payments_ValidatedRequestedInfo), [0x4E5F810D] = typeof(Payments_PaymentResult), [0xD8411139] = typeof(Payments_PaymentVerificationNeeded), @@ -1090,6 +1092,7 @@ namespace TL [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0x65F00CE3] = typeof(InputInvoiceStars), [0x34E793F1] = typeof(InputInvoiceChatInviteSubscription), + [0x25D8C1D8] = typeof(InputInvoiceStarGift), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1305,7 +1308,7 @@ namespace TL [0xD80DA15D] = typeof(StarsTransactionPeer), [0x60682812] = typeof(StarsTransactionPeerAds), [0x0BD915C0] = typeof(StarsTopupOption), - [0xEE7522D5] = typeof(StarsTransaction), + [0x0A9EE4C2] = typeof(StarsTransaction), [0xBBFA316C] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), @@ -1324,6 +1327,15 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), + [0xAEA174EE] = typeof(StarGift), + [0xA388A368] = null,//Payments_StarGiftsNotModified + [0x901689EA] = typeof(Payments_StarGifts), + [0xEEA49A6E] = typeof(UserStarGift), + [0x6B65B517] = typeof(Payments_UserStarGifts), + [0x7903E3D9] = typeof(MessageReportOption), + [0xF0E4E0B6] = typeof(ReportResultChooseOption), + [0x6F09AC31] = typeof(ReportResultAddComment), + [0x8DB33C4B] = typeof(ReportResultReported), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1452,6 +1464,7 @@ namespace TL [typeof(Help_TimezonesList)] = 0x970708CC, //help.timezonesListNotModified [typeof(Messages_QuickReplies)] = 0x5F91EB5B, //messages.quickRepliesNotModified [typeof(Messages_AvailableEffects)] = 0xD1ED9A5B, //messages.availableEffectsNotModified + [typeof(Payments_StarGifts)] = 0xA388A368, //payments.starGiftsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index c8fd8b3..b9d0dea 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: 188 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 189 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 3b52b3a2007b6b6ed115cc44396df5919eaadace Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 7 Oct 2024 14:58:12 +0200 Subject: [PATCH 241/336] Updated version to 4.2 --- .github/dev.yml | 2 +- .github/release.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index e72c5c8..483357a 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.1.11-dev.$(Rev:r) +name: 4.2.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index 13cedb5..de79b3b 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 4.1.$(Rev:r) +name: 4.2.$(Rev:r) pool: vmImage: ubuntu-latest From e4d66925e3de110b68cb5f9a977b9186879b4387 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 15 Oct 2024 16:49:22 +0200 Subject: [PATCH 242/336] Update System.Text.Json due to vulnerability CVE-2024-43485 --- .github/FUNDING.yml | 2 +- .github/dev.yml | 2 +- .github/workflows/autolock.yml | 2 +- src/WTelegramClient.csproj | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml index 1accf5e..51bae9d 100644 --- a/.github/FUNDING.yml +++ b/.github/FUNDING.yml @@ -1,2 +1,2 @@ github: wiz0u -custom: ["https://www.buymeacoffee.com/wizou", "http://t.me/WTelegramBot?start=donate"] +custom: ["https://www.buymeacoffee.com/wizou", "http://t.me/WTelegramClientBot?start=donate"] diff --git a/.github/dev.yml b/.github/dev.yml index 483357a..1b468e9 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.1-dev.$(Rev:r) +name: 4.2.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/workflows/autolock.yml b/.github/workflows/autolock.yml index 981b029..9c86508 100644 --- a/.github/workflows/autolock.yml +++ b/.github/workflows/autolock.yml @@ -2,7 +2,7 @@ name: 'Auto-Lock Issues' on: schedule: - - cron: '0 2 * * *' + - cron: '17 2 * * *' workflow_dispatch: permissions: diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index b9d0dea..1a9619a 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -53,7 +53,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "% - + From 75f5832ef62ada28b9b949bee878a685904d4958 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 15 Oct 2024 17:01:14 +0200 Subject: [PATCH 243/336] API Layer 190: Text attached to gifts --- README.md | 2 +- src/TL.Schema.cs | 15 ++++++++++++--- src/TL.Table.cs | 8 ++++---- src/WTelegramClient.csproj | 2 +- 4 files changed, 18 insertions(+), 9 deletions(-) diff --git a/README.md b/README.md index db8cbd9..e9b8fab 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-189-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-190-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 f510d62..657ae47 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2541,7 +2541,7 @@ namespace TL public string text; } /// Info about a gifted Telegram Premium subscription See - [TLDef(0xC83D6AEC)] + [TLDef(0x6C6274FA)] public sealed partial class MessageActionGiftPremium : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2556,11 +2556,14 @@ namespace TL [IfFlag(0)] public string crypto_currency; /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. [IfFlag(0)] public long crypto_amount; + [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint { /// Fields and have a value has_crypto_currency = 0x1, + /// Field has a value + has_message = 0x2, } } /// A forum topic was created. See @@ -2643,7 +2646,7 @@ namespace TL } } /// Contains a Telegram Premium giftcode link. See - [TLDef(0x678C2E09)] + [TLDef(0x56D03994)] public sealed partial class MessageActionGiftCode : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2662,6 +2665,7 @@ namespace TL [IfFlag(3)] public string crypto_currency; /// If crypto_currency is set, contains the paid amount, in the smallest units of the cryptocurrency. [IfFlag(3)] public long crypto_amount; + [IfFlag(4)] public TextWithEntities message; [Flags] public enum Flags : uint { @@ -2673,6 +2677,8 @@ namespace TL unclaimed = 0x4, /// Fields and have a value has_crypto_currency = 0x8, + /// Field has a value + has_message = 0x10, } } /// A giveaway was started. See @@ -15659,7 +15665,7 @@ namespace TL public long amount; } /// Used to gift Telegram Premium subscriptions only to some specific subscribers of a channel/supergroup or to some of our contacts, see here » for more info on giveaways and gifts. See - [TLDef(0xA3805F3F)] + [TLDef(0xFB790393)] public sealed partial class InputStorePaymentPremiumGiftCode : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15672,11 +15678,14 @@ namespace TL public string currency; /// Total price 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 amount; + [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint { /// Field has a value has_boost_peer = 0x1, + /// Field has a value + has_message = 0x2, } } /// Used to pay for a giveaway, see here » for more info. See diff --git a/src/TL.Table.cs b/src/TL.Table.cs index a6bd52c..f6ce107 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 = 189; // fetched 07/10/2024 12:32:56 + public const int Version = 190; // fetched 15/10/2024 14:49:33 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -199,13 +199,13 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), - [0xC83D6AEC] = typeof(MessageActionGiftPremium), + [0x6C6274FA] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0x31518E9B] = typeof(MessageActionRequestedPeer), [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), - [0x678C2E09] = typeof(MessageActionGiftCode), + [0x56D03994] = typeof(MessageActionGiftCode), [0xA80F51E4] = typeof(MessageActionGiveawayLaunch), [0x87E2F155] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), @@ -1098,7 +1098,7 @@ namespace TL [0x5334759C] = typeof(Help_PremiumPromo), [0xA6751E66] = typeof(InputStorePaymentPremiumSubscription), [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), - [0xA3805F3F] = typeof(InputStorePaymentPremiumGiftCode), + [0xFB790393] = typeof(InputStorePaymentPremiumGiftCode), [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1a9619a..6af3003 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: 189 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 190 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 6354d0e8b742ea250db013cf2385a37e7ad20add Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 18 Oct 2024 01:15:45 +0200 Subject: [PATCH 244/336] Manager: workaround Updates_GetState returning wrong QTS --- src/UpdateManager.cs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index cfd8053..0a321d1 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -92,7 +92,8 @@ namespace WTelegram private async Task ResyncState(Updates_State state = null) { - state ??= new() { qts = int.MaxValue }; + if (state != null) state.qts = 0; // for some reason Updates_GetState returns an invalid qts, so better consider we have no qts. + else state = new() { qts = int.MaxValue }; await _sem.WaitAsync(); try { From 9a4643ecef8bbe02591c2a9b9e7f40db66494ffc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 24 Oct 2024 23:57:26 +0200 Subject: [PATCH 245/336] added helper method ForwardMessagesAsync --- .github/workflows/autolock.yml | 2 +- EXAMPLES.md | 6 +++--- src/Client.Helpers.cs | 39 ++++++++++++++++++++++++++++------ 3 files changed, 37 insertions(+), 10 deletions(-) diff --git a/.github/workflows/autolock.yml b/.github/workflows/autolock.yml index 9c86508..0bd8a20 100644 --- a/.github/workflows/autolock.yml +++ b/.github/workflows/autolock.yml @@ -17,7 +17,7 @@ jobs: action: runs-on: ubuntu-latest steps: - - uses: dessant/lock-threads@v5.0.1 + - uses: dessant/lock-threads@v5 with: issue-inactive-days: '60' pr-inactive-days: '60' diff --git a/EXAMPLES.md b/EXAMPLES.md index 6fb7ee1..e32e10d 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -257,10 +257,10 @@ var history = await client.Messages_GetHistory(from_chat, limit: 1); var msg = history.Messages[0] as Message; // last message of source chat // • Forward the message (only the source message id is necessary) -await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat); +await client.ForwardMessagesAsync(from_chat, [msg.ID], to_chat); // • Copy the message without the "Forwarded" header (only the source message id is necessary) -await client.Messages_ForwardMessages(from_chat, new[] { msg.ID }, new[] { WTelegram.Helpers.RandomLong() }, to_chat, drop_author: true); +await client.ForwardMessagesAsync(from_chat, [msg.ID], to_chat, drop_author: true); // • Alternative solution to copy the message (the full message is needed) await client.SendMessageAsync(to_chat, msg.message, msg.media?.ToInputMedia(), entities: msg.entities); @@ -544,7 +544,7 @@ using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); client.MTProxyUrl = "https://t.me/proxy?server=...&port=...&secret=..."; await client.LoginUserIfNeeded(); ``` -You can find a list of working MTProxies in channels like [@ProxyMTProto](https://t.me/ProxyMTProto) or [@MTProxyT](https://t.me/MTProxyT) *(right-click the "Connect" buttons)* +You can find a list of working MTProxies in channels like [@ProxyMTProto](https://t.me/s/ProxyMTProto) or [@MTProxyT](https://t.me/s/MTProxyT) *(right-click the "Connect" buttons)* If your Telegram client is already connected to such MTPROTO proxy, you can also export its URL by clicking on the shield button ![🛡](https://raw.githubusercontent.com/telegramdesktop/tdesktop/dev/Telegram/Resources/icons/proxy_on.png) and then **⋮** > **Share** *Note: WTelegramClient always uses transport obfuscation when connecting to Telegram servers, even without MTProxy* diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index a3c55c4..c5891a5 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -19,14 +19,14 @@ namespace WTelegram /// total size of file in bytes, or 0 if unknown public delegate void ProgressCallback(long transmitted, long totalSize); - /// Helper function to upload a file to Telegram + /// Helper method to upload a file to Telegram /// Path to the file to upload /// (optional) Callback for tracking the progression of the transfer /// an or than can be used in various requests public Task UploadFileAsync(string pathname, ProgressCallback progress = null) => UploadFileAsync(File.OpenRead(pathname), Path.GetFileName(pathname), progress); - /// Helper function to upload a file to Telegram + /// Helper method to upload a file to Telegram /// Content of the file to upload. This method close/dispose the stream /// Name of the file /// (optional) Callback for tracking the progression of the transfer @@ -107,7 +107,7 @@ namespace WTelegram public Task Messages_SearchGlobal(string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() => this.Messages_SearchGlobal(text, new T(), offset_id: offset_id, limit: limit); - /// Helper function to send a media message more easily + /// Helper method to send a media message more easily /// Destination of message (chat group, channel, user chat, etc..) /// Caption for the media (in plain text) or /// Media file already uploaded to TG (see UploadFileAsync) @@ -137,7 +137,7 @@ namespace WTelegram } public enum LinkPreview { Disabled = 0, BelowText = 1, AboveText = 2 }; - /// Helper function to send a text or media message easily + /// Helper method to send a text or media message easily /// Destination of message (chat group, channel, user chat, etc..) /// The plain text of the message (or media caption) /// An instance of InputMedia-derived class, or if there is no associated media @@ -179,7 +179,7 @@ namespace WTelegram return null; } - /// Helper function to send an album (media group) of photos or documents more easily + /// Helper method to send an album (media group) of photos or documents more easily /// Destination of message (chat group, channel, user chat, etc..) /// An array or List of InputMedia-derived class /// Caption for the media (in plain text) or @@ -187,7 +187,7 @@ namespace WTelegram /// Text formatting entities for the caption. You can use MarkdownToEntities to create these /// UTC timestamp when the message should be sent /// Any URL pointing to a video should be considered as non-streamable - /// The media group messages as received by Telegram + /// The media group messages, as received by Telegram /// /// * The caption/entities are set on the first media
/// * and are supported natively for bot accounts, and for user accounts by downloading the file from the web via HttpClient and sending it to Telegram. @@ -280,6 +280,33 @@ namespace WTelegram return result; } + /// Helper method to forwards messages more easily by their IDs. + /// Whether to forward messages without quoting the original author + /// Whether to strip captions from media + /// Source of messages + /// IDs of messages + /// Destination peer + /// Destination
forum topic + /// The resulting forwarded messages, as received by Telegram + public async Task ForwardMessagesAsync(InputPeer from_peer, int[] msg_ids, InputPeer to_peer, int? top_msg_id = null, bool drop_author = false, bool drop_media_captions = false) + { + var random_id = Helpers.RandomLong(); + var random_ids = Enumerable.Range(0, msg_ids.Length).Select(i => random_id + i).ToArray(); + var updates = await this.Messages_ForwardMessages(from_peer, msg_ids, random_ids, to_peer, top_msg_id, drop_author: drop_author, drop_media_captions: drop_media_captions); + var msgIds = new int[updates.UpdateList.OfType().Count()]; + var result = new Message[msgIds.Length]; + foreach (var update in updates.UpdateList) + { + switch (update) + { + case UpdateMessageID updMsgId: msgIds[updMsgId.random_id - random_id] = updMsgId.id; break; + case UpdateNewMessage { message: Message message }: result[Array.IndexOf(msgIds, message.id)] = message; break; + case UpdateNewScheduledMessage { message: Message schedMsg }: result[Array.IndexOf(msgIds, schedMsg.id)] = schedMsg; break; + } + } + return result; + } + private Peer InputToPeer(InputPeer peer) => peer switch { InputPeerSelf => new PeerUser { user_id = _session.UserId }, From cb8bcb5b8b079dac379b5a0e0cdc711cd328fe91 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 25 Oct 2024 01:35:17 +0200 Subject: [PATCH 246/336] Fix MTProxy broken since HTTP support --- src/Client.Helpers.cs | 4 ++-- src/Client.cs | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index c5891a5..d252370 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -288,11 +288,11 @@ namespace WTelegram /// Destination peer /// Destination forum topic /// The resulting forwarded messages, as received by Telegram - public async Task ForwardMessagesAsync(InputPeer from_peer, int[] msg_ids, InputPeer to_peer, int? top_msg_id = null, bool drop_author = false, bool drop_media_captions = false) + public async Task ForwardMessagesAsync(InputPeer from_peer, int[] msg_ids, InputPeer to_peer, int top_msg_id = 0, bool drop_author = false, bool drop_media_captions = false) { var random_id = Helpers.RandomLong(); var random_ids = Enumerable.Range(0, msg_ids.Length).Select(i => random_id + i).ToArray(); - var updates = await this.Messages_ForwardMessages(from_peer, msg_ids, random_ids, to_peer, top_msg_id, drop_author: drop_author, drop_media_captions: drop_media_captions); + var updates = await this.Messages_ForwardMessages(from_peer, msg_ids, random_ids, to_peer, top_msg_id == 0 ? null : top_msg_id, drop_author: drop_author, drop_media_captions: drop_media_captions); var msgIds = new int[updates.UpdateList.OfType().Count()]; var result = new Message[msgIds.Length]; foreach (var update in updates.UpdateList) diff --git a/src/Client.cs b/src/Client.cs index 04ec435..97602c7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -884,7 +884,7 @@ namespace WTelegram throw new Exception("Library was not compiled with OBFUSCATION symbol"); #endif } - if (_httpClient != null) + else if (_httpClient != null) _reactorTask = Task.CompletedTask; else { From e758e9136c7c88d77b3b5424d6c8af828ad4911c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 26 Oct 2024 17:32:40 +0200 Subject: [PATCH 247/336] Fix issue with incomplete ForwardMessagesAsync --- src/Client.Helpers.cs | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index d252370..be50015 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -287,14 +287,15 @@ namespace WTelegram /// IDs of messages /// Destination peer /// Destination forum topic - /// The resulting forwarded messages, as received by Telegram + /// The resulting forwarded messages, as received by Telegram Some of them might be if they could not all be forwarded public async Task ForwardMessagesAsync(InputPeer from_peer, int[] msg_ids, InputPeer to_peer, int top_msg_id = 0, bool drop_author = false, bool drop_media_captions = false) { + int msgCount = msg_ids.Length; var random_id = Helpers.RandomLong(); - var random_ids = Enumerable.Range(0, msg_ids.Length).Select(i => random_id + i).ToArray(); + var random_ids = Enumerable.Range(0, msgCount).Select(i => random_id + i).ToArray(); var updates = await this.Messages_ForwardMessages(from_peer, msg_ids, random_ids, to_peer, top_msg_id == 0 ? null : top_msg_id, drop_author: drop_author, drop_media_captions: drop_media_captions); - var msgIds = new int[updates.UpdateList.OfType().Count()]; - var result = new Message[msgIds.Length]; + var msgIds = new int[msgCount]; + var result = new Message[msgCount]; foreach (var update in updates.UpdateList) { switch (update) From 322f5f132f2c1a2aec575ff63bf841272963769b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 29 Oct 2024 14:39:05 +0100 Subject: [PATCH 248/336] Fix: UpdateManager losing synchronization context --- src/UpdateManager.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 0a321d1..d778a21 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -164,7 +164,7 @@ namespace WTelegram { Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} pending {ExtendedLog(update)}"); _pending.Add((update, updates, own, now + HalfSec)); - _recoveringGaps ??= Task.Delay(HalfSec).ContinueWith(RecoverGaps); + _recoveringGaps ??= Task.Delay(HalfSec).ContinueWith(RecoverGaps, scheduler: TaskScheduler.FromCurrentSynchronizationContext()); continue; } // the update can be applied. @@ -242,7 +242,7 @@ namespace WTelegram var (update, updates, own, stamp) = _pending[0]; if (stamp > now) { - _recoveringGaps = Task.Delay(stamp - now).ContinueWith(RecoverGaps); + _recoveringGaps = Task.Delay(stamp - now).ContinueWith(RecoverGaps, scheduler: TaskScheduler.FromCurrentSynchronizationContext()); return; } var (mbox_id, pts, pts_count) = update.GetMBox(); From 6317fed8e045855c783c3f3eaaaceb491340afe3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 29 Oct 2024 15:42:02 +0100 Subject: [PATCH 249/336] Fix: UpdateManager losing synchronization context --- src/UpdateManager.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index d778a21..1f7e328 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -37,6 +37,7 @@ namespace WTelegram private readonly Func _onUpdate; private readonly IPeerCollector _collector; private readonly bool _reentrant; + private readonly TaskScheduler _scheduler; private readonly SemaphoreSlim _sem = new(1); private readonly List<(Update update, UpdatesBase updates, bool own, DateTime stamp)> _pending = []; private readonly Dictionary _local; // -2 for seq/date, -1 for qts, 0 for common pts, >0 for channel pts @@ -57,6 +58,7 @@ namespace WTelegram _client = client; _onUpdate = onUpdate; _collector = collector ?? new Services.CollectorPeer(Users = [], Chats = []); + _scheduler = SynchronizationContext.Current == null ? TaskScheduler.Current : TaskScheduler.FromCurrentSynchronizationContext(); if (state == null || state.Count < 3) _local = new() { [L_SEQ] = new() { access_hash = UndefinedSeqDate }, [L_QTS] = new(), [L_PTS] = new() }; @@ -164,7 +166,7 @@ namespace WTelegram { Log?.Invoke(1, $"({mbox_id,10}, {local.pts,6}+{pts_count}->{pts,-6}) {update,-30} pending {ExtendedLog(update)}"); _pending.Add((update, updates, own, now + HalfSec)); - _recoveringGaps ??= Task.Delay(HalfSec).ContinueWith(RecoverGaps, scheduler: TaskScheduler.FromCurrentSynchronizationContext()); + _recoveringGaps ??= Task.Delay(HalfSec).ContinueWith(RecoverGaps, _scheduler); continue; } // the update can be applied. @@ -242,7 +244,7 @@ namespace WTelegram var (update, updates, own, stamp) = _pending[0]; if (stamp > now) { - _recoveringGaps = Task.Delay(stamp - now).ContinueWith(RecoverGaps, scheduler: TaskScheduler.FromCurrentSynchronizationContext()); + _recoveringGaps = Task.Delay(stamp - now).ContinueWith(RecoverGaps, _scheduler); return; } var (mbox_id, pts, pts_count) = update.GetMBox(); From 0cc8a324cb26a7b55e4b8920177be78bb3fdc700 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 31 Oct 2024 18:19:53 +0100 Subject: [PATCH 250/336] API Layer 192: sponsored messages for bots, paid broadcast for bots (allow_paid_floodskip), video processing flags --- README.md | 2 +- src/TL.Schema.cs | 25 ++++- src/TL.SchemaFuncs.cs | 202 ++++++++++++++++++------------------- src/TL.Table.cs | 9 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 128 insertions(+), 112 deletions(-) diff --git a/README.md b/README.md index e9b8fab..2783d1e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-190-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-192-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 657ae47..a20162a 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1851,6 +1851,7 @@ namespace TL has_effect = 0x4, /// Field has a value has_factcheck = 0x8, + video_processing_pending = 0x10, } /// ID of the message @@ -3553,6 +3554,7 @@ namespace TL sponsored_enabled = 0x80, /// Field has a value has_stargifts_count = 0x100, + can_view_revenue = 0x200, } } @@ -4707,13 +4709,21 @@ namespace TL public MessageBase message; } /// Some scheduled messages were deleted from the schedule queue of a chat See - [TLDef(0x90866CEE)] + [TLDef(0xF2A71983)] public sealed partial class UpdateDeleteScheduledMessages : Update { + public Flags flags; /// Peer public Peer peer; /// Deleted scheduled messages public int[] messages; + [IfFlag(0)] public int[] sent_messages; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_sent_messages = 0x1, + } } /// A cloud theme was updated See [TLDef(0x8216FBA3)] @@ -18957,6 +18967,9 @@ namespace TL /// Describes a Telegram Star transaction used to pay for Telegram ads as specified here ». See [TLDef(0x60682812)] public sealed partial class StarsTransactionPeerAds : StarsTransactionPeerBase { } + /// See + [TLDef(0xF9677AAD)] + public sealed partial class StarsTransactionPeerAPI : StarsTransactionPeerBase { } /// Telegram Stars topup option. See [TLDef(0x0BD915C0)] @@ -18983,7 +18996,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0x0A9EE4C2)] + [TLDef(0x35D4F276)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19015,6 +19028,7 @@ namespace TL [IfFlag(12)] public int subscription_period; [IfFlag(13)] public int giveaway_post_id; [IfFlag(14)] public StarGift stargift; + [IfFlag(15)] public int floodskip_number; [Flags] public enum Flags : uint { @@ -19047,6 +19061,8 @@ namespace TL has_giveaway_post_id = 0x2000, /// Field has a value has_stargift = 0x4000, + /// Field has a value + has_floodskip_number = 0x8000, } } @@ -19359,7 +19375,7 @@ namespace TL } /// See - [TLDef(0xAEA174EE)] + [TLDef(0x49C577CD)] public sealed partial class StarGift : IObject { public Flags flags; @@ -19369,10 +19385,13 @@ namespace TL [IfFlag(0)] public int availability_remains; [IfFlag(0)] public int availability_total; public long convert_stars; + [IfFlag(1)] public DateTime first_sale_date; + [IfFlag(1)] public DateTime last_sale_date; [Flags] public enum Flags : uint { limited = 0x1, + sold_out = 0x2, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2ed88ca..6b83601 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1860,10 +1860,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1894,10 +1894,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1926,10 +1926,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -2878,10 +2878,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, multi_media = multi_media, @@ -4338,6 +4338,40 @@ namespace TL { }); + /// See + public static Task Messages_ViewSponsoredMessage(this Client client, InputPeer peer, byte[] random_id) + => client.Invoke(new Messages_ViewSponsoredMessage + { + peer = peer, + random_id = random_id, + }); + + /// See + public static Task Messages_ClickSponsoredMessage(this Client client, InputPeer peer, 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, + }); + + /// See + public static Task Messages_ReportSponsoredMessage(this Client client, InputPeer peer, byte[] random_id, byte[] option) + => client.Invoke(new Messages_ReportSponsoredMessage + { + peer = peer, + random_id = random_id, + option = option, + }); + + /// See + /// a null value means messages.sponsoredMessagesEmpty + public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetSponsoredMessages + { + peer = peer, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5120,25 +5154,6 @@ namespace TL channel = channel, }); - /// Mark a specific sponsored message as read See Possible codes: 400 (details) - /// Peer - /// Message ID - public static Task Channels_ViewSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id) - => client.Invoke(new Channels_ViewSponsoredMessage - { - channel = channel, - random_id = random_id, - }); - - /// Get a list of sponsored messages See Possible codes: 400 (details) - /// Peer - /// a null value means messages.sponsoredMessagesEmpty - public static Task Channels_GetSponsoredMessages(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_GetSponsoredMessages - { - channel = channel, - }); - /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) /// The group where we intend to send messages public static Task Channels_GetSendAs(this Client client, InputPeer peer) @@ -5348,17 +5363,6 @@ namespace TL enabled = enabled, }); - /// Informs the server that the user has either: See Possible codes: 400 (details) - /// Channel where the sponsored message was posted - /// Message ID - public static Task Channels_ClickSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, bool media = false, bool fullscreen = false) - => client.Invoke(new Channels_ClickSponsoredMessage - { - flags = (Channels_ClickSponsoredMessage.Flags)((media ? 0x1 : 0) | (fullscreen ? 0x2 : 0)), - channel = channel, - random_id = random_id, - }); - /// Update the accent color and background custom emoji » of a channel. See Possible codes: 400 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed.
Channels can change both message and profile palettes; supergroups can only change the profile palette, of course after reaching the appropriate boost level. /// Channel whose accent color should be changed. @@ -5422,18 +5426,6 @@ namespace TL stickerset = stickerset, }); - /// Report a sponsored message », see here » for more info on the full flow. See Possible codes: 400 (details) - /// The channel where the sponsored message can be seen. - /// ID of the sponsored message. - /// Chosen report option, initially an empty string, see here » for more info on the full flow. - public static Task Channels_ReportSponsoredMessage(this Client client, InputChannelBase channel, byte[] random_id, byte[] option) - => client.Invoke(new Channels_ReportSponsoredMessage - { - channel = channel, - random_id = random_id, - option = option, - }); - /// Disable ads on the specified channel, for all users. See Possible codes: 400 (details) /// The channel. /// Whether to disable or re-enable ads. @@ -6658,32 +6650,29 @@ namespace TL /// Get channel ad revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors - /// The channel - public static Task Stats_GetBroadcastRevenueStats(this Client client, InputChannelBase channel, bool dark = false) + public static Task Stats_GetBroadcastRevenueStats(this Client client, InputPeer peer, bool dark = false) => client.Invoke(new Stats_GetBroadcastRevenueStats { flags = (Stats_GetBroadcastRevenueStats.Flags)(dark ? 0x1 : 0), - channel = channel, + peer = peer, }); /// Withdraw funds from a channel's ad revenue balance ». See Possible codes: 400 (details) - /// The channel /// 2FA password, see here » for more info. - public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputChannelBase channel, InputCheckPasswordSRP password) + public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password) => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl { - channel = channel, + peer = peer, password = password, }); /// Fetch channel ad revenue transaction history ». See Possible codes: 400 (details) - /// The channel /// Offset for pagination /// Maximum number of results to return, see pagination - public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputChannelBase channel, int offset = default, int limit = int.MaxValue) + public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputPeer peer, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stats_GetBroadcastRevenueTransactions { - channel = channel, + peer = peer, offset = offset, limit = limit, }); @@ -7096,12 +7085,13 @@ namespace TL /// A or a .
Note areas may be searched only if they have an associated address. /// Offset for pagination: initially an empty string, then the next_offset from the previously returned . /// Maximum number of results to return, see pagination - public static Task Stories_SearchPosts(this Client client, string offset, int limit = int.MaxValue, string hashtag = null, MediaArea area = null) + public static Task Stories_SearchPosts(this Client client, string offset, int limit = int.MaxValue, string hashtag = null, MediaArea area = null, InputPeer peer = null) => client.Invoke(new Stories_SearchPosts { - flags = (Stories_SearchPosts.Flags)((hashtag != null ? 0x1 : 0) | (area != null ? 0x2 : 0)), + flags = (Stories_SearchPosts.Flags)((hashtag != null ? 0x1 : 0) | (area != null ? 0x2 : 0) | (peer != null ? 0x4 : 0)), hashtag = hashtag, area = area, + peer = peer, offset = offset, limit = limit, }); @@ -8723,6 +8713,7 @@ namespace TL.Methods invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, + allow_paid_floodskip = 0x80000, } } @@ -8757,6 +8748,7 @@ namespace TL.Methods invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, + allow_paid_floodskip = 0x80000, } } @@ -8785,6 +8777,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, has_quick_reply_shortcut = 0x20000, + allow_paid_floodskip = 0x80000, } } @@ -9615,6 +9608,7 @@ namespace TL.Methods invert_media = 0x10000, has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, + allow_paid_floodskip = 0x80000, } } @@ -10827,6 +10821,41 @@ namespace TL.Methods [TLDef(0x472455AA)] public sealed partial class Messages_GetPaidReactionPrivacy : IMethod { } + [TLDef(0x673AD8F1)] + public sealed partial class Messages_ViewSponsoredMessage : IMethod + { + public InputPeer peer; + public byte[] random_id; + } + + [TLDef(0x0F093465)] + public sealed partial class Messages_ClickSponsoredMessage : IMethod + { + public Flags flags; + public InputPeer peer; + public byte[] random_id; + + [Flags] public enum Flags : uint + { + media = 0x1, + fullscreen = 0x2, + } + } + + [TLDef(0x1AF3DBB8)] + public sealed partial class Messages_ReportSponsoredMessage : IMethod + { + public InputPeer peer; + public byte[] random_id; + public byte[] option; + } + + [TLDef(0x9BD2F439)] + public sealed partial class Messages_GetSponsoredMessages : IMethod + { + public InputPeer peer; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -11422,19 +11451,6 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0xBEAEDB94)] - public sealed partial class Channels_ViewSponsoredMessage : IMethod - { - public InputChannelBase channel; - public byte[] random_id; - } - - [TLDef(0xEC210FBF)] - public sealed partial class Channels_GetSponsoredMessages : IMethod - { - public InputChannelBase channel; - } - [TLDef(0x0DC770EE)] public sealed partial class Channels_GetSendAs : IMethod { @@ -11602,20 +11618,6 @@ namespace TL.Methods public bool enabled; } - [TLDef(0x01445D75)] - public sealed partial class Channels_ClickSponsoredMessage : IMethod - { - public Flags flags; - public InputChannelBase channel; - public byte[] random_id; - - [Flags] public enum Flags : uint - { - media = 0x1, - fullscreen = 0x2, - } - } - [TLDef(0xD8AA3671)] public sealed partial class Channels_UpdateColor : IMethod { @@ -11672,14 +11674,6 @@ namespace TL.Methods public InputStickerSet stickerset; } - [TLDef(0xAF8FF6B9)] - public sealed partial class Channels_ReportSponsoredMessage : IMethod - { - public InputChannelBase channel; - public byte[] random_id; - public byte[] option; - } - [TLDef(0x9AE91519)] public sealed partial class Channels_RestrictSponsoredMessages : IMethod { @@ -12695,11 +12689,11 @@ namespace TL.Methods public int limit; } - [TLDef(0x75DFB671)] + [TLDef(0xF788EE19)] public sealed partial class Stats_GetBroadcastRevenueStats : IMethod { public Flags flags; - public InputChannelBase channel; + public InputPeer peer; [Flags] public enum Flags : uint { @@ -12707,17 +12701,17 @@ namespace TL.Methods } } - [TLDef(0x2A65EF73)] + [TLDef(0x9DF4FAAD)] public sealed partial class Stats_GetBroadcastRevenueWithdrawalUrl : IMethod { - public InputChannelBase channel; + public InputPeer peer; public InputCheckPasswordSRP password; } - [TLDef(0x0069280F)] + [TLDef(0x70990B6D)] public sealed partial class Stats_GetBroadcastRevenueTransactions : IMethod { - public InputChannelBase channel; + public InputPeer peer; public int offset; public int limit; } @@ -13049,12 +13043,13 @@ namespace TL.Methods public int[] id; } - [TLDef(0x6CEA116A)] + [TLDef(0xD1810907)] public sealed partial class Stories_SearchPosts : IMethod { public Flags flags; [IfFlag(0)] public string hashtag; [IfFlag(1)] public MediaArea area; + [IfFlag(2)] public InputPeer peer; public string offset; public int limit; @@ -13062,6 +13057,7 @@ namespace TL.Methods { has_hashtag = 0x1, has_area = 0x2, + has_peer = 0x4, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index f6ce107..9d070a3 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 = 190; // fetched 15/10/2024 14:49:33 + public const int Version = 192; // fetched 31/10/2024 17:10:55 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -346,7 +346,7 @@ namespace TL [0x6A7E7366] = typeof(UpdatePeerSettings), [0xB4AFCFB0] = typeof(UpdatePeerLocated), [0x39A51DFB] = typeof(UpdateNewScheduledMessage), - [0x90866CEE] = typeof(UpdateDeleteScheduledMessages), + [0xF2A71983] = typeof(UpdateDeleteScheduledMessages), [0x8216FBA3] = typeof(UpdateTheme), [0x871FB939] = typeof(UpdateGeoLiveViewed), [0x564FE691] = typeof(UpdateLoginToken), @@ -1307,8 +1307,9 @@ namespace TL [0xE92FD902] = typeof(StarsTransactionPeerFragment), [0xD80DA15D] = typeof(StarsTransactionPeer), [0x60682812] = typeof(StarsTransactionPeerAds), + [0xF9677AAD] = typeof(StarsTransactionPeerAPI), [0x0BD915C0] = typeof(StarsTopupOption), - [0x0A9EE4C2] = typeof(StarsTransaction), + [0x35D4F276] = typeof(StarsTransaction), [0xBBFA316C] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), @@ -1327,7 +1328,7 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0xAEA174EE] = typeof(StarGift), + [0x49C577CD] = typeof(StarGift), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), [0xEEA49A6E] = typeof(UserStarGift), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6af3003..ea47934 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: 190 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 192 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 3d0de9ef9f9f0159ae8aba3921e4d361e6d67980 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 2 Nov 2024 00:14:23 +0100 Subject: [PATCH 251/336] added helper method Channels_GetAllForumTopics --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 26 ++++++++++++++++++++++++++ 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 1b468e9..6a17968 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.2-dev.$(Rev:r) +name: 4.2.3-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index be50015..33e5987 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -621,6 +621,32 @@ namespace WTelegram return resultFull; } + /// Helper simplified method: Get all topics of a forum See Possible codes: 400 (details) + /// Supergroup + /// Search query + public async Task Channels_GetAllForumTopics(InputChannelBase channel, string q = null) + { + var result = await this.Channels_GetForumTopics(channel, limit: 20, q: q); + if (result.topics.Length < result.count) + { + var topics = result.topics.ToList(); + var messages = result.messages.ToList(); + while (true) + { + var more_topics = await this.Channels_GetForumTopics(channel, messages[^1].Date, messages[^1].ID, topics[^1].ID); + if (more_topics.topics.Length == 0) break; + topics.AddRange(more_topics.topics); + messages.AddRange(more_topics.messages); + foreach (var kvp in more_topics.chats) result.chats[kvp.Key] = kvp.Value; + foreach (var kvp in more_topics.users) result.users[kvp.Key] = kvp.Value; + if (topics.Count >= more_topics.count) break; + } + result.topics = [.. topics]; + result.messages = [.. messages]; + } + return result; + } + private const string OnlyChatChannel = "This method works on Chat & Channel only"; /// Generic helper: Adds a single user to a Chat or Channel See
and
Possible codes: 400,403
/// Chat/Channel From 33dd2d02d64d4b599accdd30d0493f9583cdc8a7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 2 Nov 2024 02:40:34 +0100 Subject: [PATCH 252/336] Use ?? default, more clean/readable than GetValueOrDefault --- src/TL.SchemaFuncs.cs | 150 +++++++++++++++++++++--------------------- 1 file changed, 75 insertions(+), 75 deletions(-) diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 6b83601..69df50d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -764,7 +764,7 @@ namespace TL => client.Invoke(new Account_InitTakeoutSession { flags = (Account_InitTakeoutSession.Flags)((file_max_size != null ? 0x20 : 0) | (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 = file_max_size.GetValueOrDefault(), + file_max_size = file_max_size ?? default, }); /// Terminate a takeout session, see here » for more info. See Possible codes: 403 (details) @@ -1070,8 +1070,8 @@ namespace TL { flags = (Account_ChangeAuthorizationSettings.Flags)((encrypted_requests_disabled != default ? 0x1 : 0) | (call_requests_disabled != default ? 0x2 : 0) | (confirmed ? 0x8 : 0)), hash = hash, - encrypted_requests_disabled = encrypted_requests_disabled.GetValueOrDefault(), - call_requests_disabled = call_requests_disabled.GetValueOrDefault(), + encrypted_requests_disabled = encrypted_requests_disabled ?? default, + call_requests_disabled = call_requests_disabled ?? default, }); /// Fetch saved notification sounds See @@ -1215,8 +1215,8 @@ namespace TL => client.Invoke(new Account_UpdateColor { flags = (Account_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), - color = color.GetValueOrDefault(), - background_emoji_id = background_emoji_id.GetValueOrDefault(), + color = color ?? default, + background_emoji_id = background_emoji_id ?? default, }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See @@ -1634,7 +1634,7 @@ namespace TL { flags = (Contacts_GetLocated.Flags)((self_expires != null ? 0x1 : 0) | (background ? 0x2 : 0)), geo_point = geo_point, - self_expires = self_expires.GetValueOrDefault(), + self_expires = self_expires ?? default, }); /// Stop getting notifications about discussion replies of a certain user in @replies See Possible codes: 400 (details) @@ -1717,7 +1717,7 @@ namespace TL => client.Invoke(new Messages_GetDialogs { flags = (Messages_GetDialogs.Flags)((folder_id != null ? 0x2 : 0) | (exclude_pinned ? 0x1 : 0)), - folder_id = folder_id.GetValueOrDefault(), + folder_id = folder_id ?? default, offset_date = offset_date, offset_id = offset_id, offset_peer = offset_peer, @@ -1772,7 +1772,7 @@ namespace TL from_id = from_id, saved_peer_id = saved_peer_id, saved_reaction = saved_reaction, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, filter = filter, min_date = min_date, max_date = max_date, @@ -1807,8 +1807,8 @@ namespace TL flags = (Messages_DeleteHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0) | (just_clear ? 0x1 : 0) | (revoke ? 0x2 : 0)), peer = peer, max_id = max_id, - min_date = min_date.GetValueOrDefault(), - max_date = max_date.GetValueOrDefault(), + min_date = min_date ?? default, + max_date = max_date ?? default, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// 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
Deletes messages by their identifiers. See [bots: ✓] Possible codes: 400,403 (details)
@@ -1838,7 +1838,7 @@ namespace TL { flags = (Messages_SetTyping.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, action = action, }); @@ -1870,10 +1870,10 @@ namespace TL random_id = random_id, reply_markup = reply_markup, entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), + schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, - effect = effect.GetValueOrDefault(), + effect = effect ?? default, }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1905,10 +1905,10 @@ namespace TL random_id = random_id, reply_markup = reply_markup, entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), + schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, - effect = effect.GetValueOrDefault(), + effect = effect ?? default, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1934,8 +1934,8 @@ namespace TL id = id, random_id = random_id, to_peer = to_peer, - top_msg_id = top_msg_id.GetValueOrDefault(), - schedule_date = schedule_date.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, + schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, }); @@ -2039,7 +2039,7 @@ namespace TL flags = (Messages_CreateChat.Flags)(ttl_period != null ? 0x1 : 0), users = users, title = title, - ttl_period = ttl_period.GetValueOrDefault(), + ttl_period = ttl_period ?? default, }); /// Returns configuration parameters for Diffie-Hellman key generation. Can also return a random sequence of bytes of required length. See Possible codes: 400 (details) @@ -2216,8 +2216,8 @@ namespace TL { flags = (Messages_ExportChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (title != null ? 0x10 : 0) | (subscription_pricing != null ? 0x20 : 0) | (legacy_revoke_permanent ? 0x4 : 0) | (request_needed ? 0x8 : 0)), peer = peer, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), + expire_date = expire_date ?? default, + usage_limit = usage_limit ?? default, title = title, subscription_pricing = subscription_pricing, }); @@ -2328,7 +2328,7 @@ namespace TL => client.Invoke(new Messages_SearchGlobal { flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0)), - folder_id = folder_id.GetValueOrDefault(), + folder_id = folder_id ?? default, q = q, filter = filter, min_date = min_date, @@ -2441,7 +2441,7 @@ namespace TL random_id = random_id, query_id = query_id, id = id, - schedule_date = schedule_date.GetValueOrDefault(), + schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, }); @@ -2477,8 +2477,8 @@ namespace TL media = media, reply_markup = reply_markup, entities = entities, - schedule_date = schedule_date.GetValueOrDefault(), - quick_reply_shortcut_id = quick_reply_shortcut_id.GetValueOrDefault(), + schedule_date = schedule_date ?? default, + quick_reply_shortcut_id = quick_reply_shortcut_id ?? default, }); /// Edit an inline bot message See [bots: ✓] Possible codes: 400 (details) @@ -2558,7 +2558,7 @@ namespace TL message = message, entities = entities, media = media, - effect = effect.GetValueOrDefault(), + effect = effect ?? default, }); /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
@@ -2833,7 +2833,7 @@ namespace TL { flags = (Messages_GetUnreadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -2849,7 +2849,7 @@ namespace TL { flags = (Messages_ReadMentions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// Get live location history of a certain user See @@ -2885,10 +2885,10 @@ namespace TL peer = peer, reply_to = reply_to, multi_media = multi_media, - schedule_date = schedule_date.GetValueOrDefault(), + schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, - effect = effect.GetValueOrDefault(), + effect = effect ?? default, }); /// Upload encrypted file and associate it to a secret chat See Possible codes: 400 (details) @@ -3052,7 +3052,7 @@ namespace TL flags = (Messages_GetSearchCounters.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x4 : 0)), peer = peer, saved_peer_id = saved_peer_id, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, filters = filters, }); @@ -3067,8 +3067,8 @@ namespace TL { flags = (Messages_RequestUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), peer = peer, - msg_id = msg_id.GetValueOrDefault(), - button_id = button_id.GetValueOrDefault(), + msg_id = msg_id ?? default, + button_id = button_id ?? default, url = url, }); @@ -3084,8 +3084,8 @@ namespace TL { flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), peer = peer, - msg_id = msg_id.GetValueOrDefault(), - button_id = button_id.GetValueOrDefault(), + msg_id = msg_id ?? default, + button_id = button_id ?? default, url = url, }); @@ -3263,7 +3263,7 @@ namespace TL { flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// 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
Delete a chat See Possible codes: 400 (details)
@@ -3340,7 +3340,7 @@ namespace TL flags = (Messages_GetExportedChatInvites.Flags)((offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0) | (revoked ? 0x8 : 0)), peer = peer, admin_id = admin_id, - offset_date = offset_date.GetValueOrDefault(), + offset_date = offset_date ?? default, offset_link = offset_link, limit = limit, }); @@ -3369,9 +3369,9 @@ namespace TL flags = (Messages_EditExportedChatInvite.Flags)((expire_date != null ? 0x1 : 0) | (usage_limit != null ? 0x2 : 0) | (request_needed != default ? 0x8 : 0) | (title != null ? 0x10 : 0) | (revoked ? 0x4 : 0)), peer = peer, link = link, - expire_date = expire_date.GetValueOrDefault(), - usage_limit = usage_limit.GetValueOrDefault(), - request_needed = request_needed.GetValueOrDefault(), + expire_date = expire_date ?? default, + usage_limit = usage_limit ?? default, + request_needed = request_needed ?? default, title = title, }); @@ -3591,8 +3591,8 @@ namespace TL flags = (Messages_SetChatAvailableReactions.Flags)((reactions_limit != null ? 0x1 : 0) | (paid_enabled != default ? 0x2 : 0)), peer = peer, available_reactions = available_reactions, - reactions_limit = reactions_limit.GetValueOrDefault(), - paid_enabled = paid_enabled.GetValueOrDefault(), + reactions_limit = reactions_limit ?? default, + paid_enabled = paid_enabled ?? default, }); /// Obtain available message reactions » See @@ -3640,7 +3640,7 @@ namespace TL { flags = (Messages_GetUnreadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -3656,7 +3656,7 @@ namespace TL { flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), peer = peer, - top_msg_id = top_msg_id.GetValueOrDefault(), + top_msg_id = top_msg_id ?? default, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// View and search recently sent media.
This method does not support pagination. See
Possible codes: 400 (details)
@@ -4006,7 +4006,7 @@ namespace TL peer = peer, wallpaper = wallpaper, settings = settings, - id = id.GetValueOrDefault(), + id = id ?? default, }); /// Search for custom emoji stickersets » See @@ -4073,8 +4073,8 @@ namespace TL flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), peer = peer, max_id = max_id, - min_date = min_date.GetValueOrDefault(), - max_date = max_date.GetValueOrDefault(), + min_date = min_date ?? default, + max_date = max_date ?? default, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// Get pinned saved dialogs, see here » for more info. See @@ -4320,7 +4320,7 @@ namespace TL msg_id = msg_id, count = count, random_id = random_id, - private_ = private_.GetValueOrDefault(), + private_ = private_ ?? default, }); /// See @@ -4390,11 +4390,11 @@ namespace TL { flags = (Updates_GetDifference.Flags)((pts_total_limit != null ? 0x1 : 0) | (pts_limit != null ? 0x2 : 0) | (qts_limit != null ? 0x4 : 0)), pts = pts, - pts_limit = pts_limit.GetValueOrDefault(), - pts_total_limit = pts_total_limit.GetValueOrDefault(), + pts_limit = pts_limit ?? default, + pts_total_limit = pts_total_limit ?? default, date = date, qts = qts, - qts_limit = qts_limit.GetValueOrDefault(), + qts_limit = qts_limit ?? default, }); /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) @@ -4439,7 +4439,7 @@ namespace TL bot = bot, file = file, video = video, - video_start_ts = video_start_ts.GetValueOrDefault(), + video_start_ts = video_start_ts ?? default, video_emoji_markup = video_emoji_markup, }); @@ -4480,7 +4480,7 @@ namespace TL user_id = user_id, file = file, video = video, - video_start_ts = video_start_ts.GetValueOrDefault(), + video_start_ts = video_start_ts ?? default, video_emoji_markup = video_emoji_markup, }); @@ -4884,7 +4884,7 @@ namespace TL about = about, geo_point = geo_point, address = address, - ttl_period = ttl_period.GetValueOrDefault(), + ttl_period = ttl_period ?? default, }); /// Modify the admin rights of a user in a supergroup/channel. See [bots: ✓] Possible codes: 400,403,406 (details) @@ -5245,8 +5245,8 @@ namespace TL flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0)), channel = channel, title = title, - icon_color = icon_color.GetValueOrDefault(), - icon_emoji_id = icon_emoji_id.GetValueOrDefault(), + icon_color = icon_color ?? default, + icon_emoji_id = icon_emoji_id ?? default, random_id = random_id, send_as = send_as, }); @@ -5294,9 +5294,9 @@ namespace TL channel = channel, topic_id = topic_id, title = title, - icon_emoji_id = icon_emoji_id.GetValueOrDefault(), - closed = closed.GetValueOrDefault(), - hidden = hidden.GetValueOrDefault(), + icon_emoji_id = icon_emoji_id ?? default, + closed = closed ?? default, + hidden = hidden ?? default, }); /// Pin or unpin forum topics See Possible codes: 400 (details) @@ -5373,8 +5373,8 @@ namespace TL { flags = (Channels_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), channel = channel, - color = color.GetValueOrDefault(), - background_emoji_id = background_emoji_id.GetValueOrDefault(), + color = color ?? default, + background_emoji_id = background_emoji_id ?? default, }); /// Users may also choose to display messages from all topics of a forum as if they were sent to a normal group, using a "View as messages" setting in the local client: this setting only affects the current account, and is synced to other logged in sessions using this method. See Possible codes: 400 (details) @@ -5744,7 +5744,7 @@ namespace TL requested_info_id = requested_info_id, shipping_option_id = shipping_option_id, credentials = credentials, - tip_amount = tip_amount.GetValueOrDefault(), + tip_amount = tip_amount ?? default, }); /// Get saved payment information See @@ -5969,7 +5969,7 @@ namespace TL flags = (Payments_ChangeStarsSubscription.Flags)(canceled != default ? 0x1 : 0), peer = peer, subscription_id = subscription_id, - canceled = canceled.GetValueOrDefault(), + canceled = canceled ?? default, }); /// See @@ -6085,7 +6085,7 @@ namespace TL flags = (Stickers_SetStickerSetThumb.Flags)((thumb != null ? 0x1 : 0) | (thumb_document_id != null ? 0x2 : 0)), stickerset = stickerset, thumb = thumb, - thumb_document_id = thumb_document_id.GetValueOrDefault(), + thumb_document_id = thumb_document_id ?? default, }); /// Check whether the given short name is available See Possible codes: 400 (details) @@ -6269,7 +6269,7 @@ namespace TL peer = peer, random_id = random_id, title = title, - schedule_date = schedule_date.GetValueOrDefault(), + schedule_date = schedule_date ?? default, }); /// Join a group call See Possible codes: 400,403 (details) @@ -6326,7 +6326,7 @@ namespace TL { flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, - join_muted = join_muted.GetValueOrDefault(), + join_muted = join_muted ?? default, }); /// Get info about a group call See Possible codes: 400,403 (details) @@ -6377,7 +6377,7 @@ namespace TL flags = (Phone_ToggleGroupCallRecord.Flags)((title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0) | (start ? 0x1 : 0) | (video ? 0x4 : 0)), call = call, title = title, - video_portrait = video_portrait.GetValueOrDefault(), + video_portrait = video_portrait ?? default, }); /// Edit information about a given group call participant See Possible codes: 400,403 (details) @@ -6395,12 +6395,12 @@ namespace TL flags = (Phone_EditGroupCallParticipant.Flags)((muted != default ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != default ? 0x4 : 0) | (video_stopped != default ? 0x8 : 0) | (video_paused != default ? 0x10 : 0) | (presentation_paused != default ? 0x20 : 0)), call = call, participant = participant, - muted = muted.GetValueOrDefault(), - volume = volume.GetValueOrDefault(), - raise_hand = raise_hand.GetValueOrDefault(), - video_stopped = video_stopped.GetValueOrDefault(), - video_paused = video_paused.GetValueOrDefault(), - presentation_paused = presentation_paused.GetValueOrDefault(), + muted = muted ?? default, + volume = volume ?? default, + raise_hand = raise_hand ?? default, + video_stopped = video_stopped ?? default, + video_paused = video_paused ?? default, + presentation_paused = presentation_paused ?? default, }); /// Edit the title of a group call or livestream See Possible codes: 400,403 (details) @@ -6583,7 +6583,7 @@ namespace TL { flags = (Stats_LoadAsyncGraph.Flags)(x != null ? 0x1 : 0), token = token, - x = x.GetValueOrDefault(), + x = x ?? default, }); /// Get supergroup statistics See Possible codes: 400,403 (details) @@ -6817,9 +6817,9 @@ namespace TL entities = entities, privacy_rules = privacy_rules, random_id = random_id, - period = period.GetValueOrDefault(), + period = period ?? default, fwd_from_id = fwd_from_id, - fwd_from_story = fwd_from_story.GetValueOrDefault(), + fwd_from_story = fwd_from_story ?? default, }); /// Edit an uploaded story See Possible codes: 400 (details) From f1c1d0a6a293419e3ac7787167db01d6519d60fc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 2 Nov 2024 22:54:20 +0100 Subject: [PATCH 253/336] Added helpers Message.ReplyHeader .TopicID. Fix duplicate pinned in Channels_GetAllForumTopics --- src/Client.Helpers.cs | 2 +- src/TL.Xtended.cs | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 33e5987..e1c03af 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -626,7 +626,7 @@ namespace WTelegram /// Search query public async Task Channels_GetAllForumTopics(InputChannelBase channel, string q = null) { - var result = await this.Channels_GetForumTopics(channel, limit: 20, q: q); + var result = await this.Channels_GetForumTopics(channel, offset_date: DateTime.MaxValue, q: q); if (result.topics.Length < result.count) { var topics = result.topics.ToList(); diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 334ecc4..ef2701f 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -308,6 +308,7 @@ namespace TL partial class ChatParticipantsForbidden { public override ChatParticipantBase[] Participants => []; } partial class ChatParticipants { public override ChatParticipantBase[] Participants => participants; } + partial class MessageBase { public MessageReplyHeader ReplyHeader => ReplyTo as MessageReplyHeader; } partial class MessageEmpty { public override string ToString() => "(no message)"; } partial class Message { public override string ToString() => $"{(from_id ?? peer_id)?.ID}> {message} {media}"; } partial class MessageService { public override string ToString() => $"{(from_id ?? peer_id)?.ID} [{action.GetType().Name[13..]}]"; } @@ -756,8 +757,9 @@ namespace TL } } - partial class Theme { public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; } - partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class Theme { public static implicit operator InputTheme(Theme theme) => new() { id = theme.id, access_hash = theme.access_hash }; } + partial class MessageReplyHeader { public int TopicID => flags.HasFlag(Flags.forum_topic) ? flags.HasFlag(Flags.has_reply_to_top_id) ? reply_to_top_id : reply_to_msg_id : 0; } + partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } partial class RequestedPeer { public abstract long ID { get; } } partial class RequestedPeerUser { public override long ID => user_id; } From 18fc1b32af349bada914d887c43f5fab63479878 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 14 Nov 2024 00:49:45 +0100 Subject: [PATCH 254/336] Program_DownloadSavedMedia: demo how to abort a transfer --- Examples/Program_DownloadSavedMedia.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/Examples/Program_DownloadSavedMedia.cs b/Examples/Program_DownloadSavedMedia.cs index e431d36..00022aa 100644 --- a/Examples/Program_DownloadSavedMedia.cs +++ b/Examples/Program_DownloadSavedMedia.cs @@ -1,5 +1,6 @@ using System; using System.IO; +using System.Threading; using System.Threading.Tasks; using TL; @@ -11,10 +12,12 @@ namespace WTelegramClientTest static async Task Main(string[] _) { Console.WriteLine("The program will download photos/medias from messages you send/forward to yourself (Saved Messages)"); + var cts = new CancellationTokenSource(); await using var client = new WTelegram.Client(Environment.GetEnvironmentVariable); var user = await client.LoginUserIfNeeded(); client.OnUpdates += Client_OnUpdates; Console.ReadKey(); + cts.Cancel(); async Task Client_OnUpdates(UpdatesBase updates) { @@ -31,7 +34,7 @@ namespace WTelegramClientTest filename ??= $"{document.id}.{document.mime_type[(document.mime_type.IndexOf('/') + 1)..]}"; Console.WriteLine("Downloading " + filename); using var fileStream = File.Create(filename); - await client.DownloadFileAsync(document, fileStream); + await client.DownloadFileAsync(document, fileStream, progress: (p, t) => cts.Token.ThrowIfCancellationRequested()); Console.WriteLine("Download finished"); } else if (message.media is MessageMediaPhoto { photo: Photo photo }) From 60dab9e6f352c017fa7c5a71677893ff80abdb74 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:16:44 +0100 Subject: [PATCH 255/336] api doc --- src/TL.Schema.cs | 56 ++++++++++++++++++++++++++++++++++--------- src/TL.SchemaFuncs.cs | 45 ++++++++++++++++++++++------------ 2 files changed, 75 insertions(+), 26 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index a20162a..97a5fdd 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -474,6 +474,7 @@ namespace TL [TLDef(0xC4103386)] public sealed partial class InputMediaPaidMedia : InputMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The price of the media in Telegram Stars. public long stars_amount; @@ -2237,7 +2238,7 @@ namespace TL public MessageExtendedMediaBase[] extended_media; } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2686,11 +2687,13 @@ namespace TL [TLDef(0xA80F51E4)] public sealed partial class MessageActionGiveawayLaunch : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public long stars; [Flags] public enum Flags : uint { + /// Field has a value has_stars = 0x1, } } @@ -2698,6 +2701,7 @@ namespace TL [TLDef(0x87E2F155)] public sealed partial class MessageActionGiveawayResults : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Number of winners in the giveaway public int winners_count; @@ -2779,6 +2783,7 @@ namespace TL [TLDef(0xB00C47A2)] public sealed partial class MessageActionPrizeStars : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; public string transaction_id; @@ -2794,6 +2799,7 @@ namespace TL [TLDef(0x9BB3EF44)] public sealed partial class MessageActionStarGift : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGift gift; [IfFlag(1)] public TextWithEntities message; @@ -2802,6 +2808,7 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_message = 0x2, saved = 0x4, converted = 0x8, @@ -3554,6 +3561,7 @@ namespace TL sponsored_enabled = 0x80, /// Field has a value has_stargifts_count = 0x100, + /// If set, this user can view ad revenue statistics » for this bot. can_view_revenue = 0x200, } } @@ -3873,7 +3881,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4712,6 +4720,7 @@ namespace TL [TLDef(0xF2A71983)] public sealed partial class UpdateDeleteScheduledMessages : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Peer public Peer peer; @@ -7682,7 +7691,7 @@ namespace TL } } - /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , , + /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class KeyboardButtonBase : IObject { /// Button text @@ -8253,6 +8262,7 @@ namespace TL [TLDef(0xCB397619)] public sealed partial class ChannelParticipant : ChannelParticipantBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Participant user ID public long user_id; @@ -10550,7 +10560,7 @@ namespace TL public byte[] bytes; } - /// Payment form See Derived classes: , + /// Payment form See Derived classes: , , public abstract partial class Payments_PaymentFormBase : IObject { /// Form ID @@ -11448,7 +11458,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -15540,7 +15550,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , + /// An invoice See Derived classes: , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -15584,6 +15594,7 @@ namespace TL [TLDef(0x25D8C1D8)] public sealed partial class InputInvoiceStarGift : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputUserBase user_id; public long gift_id; @@ -15592,6 +15603,7 @@ namespace TL [Flags] public enum Flags : uint { hide_name = 0x1, + /// Field has a value has_message = 0x2, } } @@ -15646,7 +15658,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , , , , , + /// Info about a Telegram Premium purchase See Derived classes: , , , , , , public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -15763,6 +15775,7 @@ namespace TL [TLDef(0x751F08FA)] public sealed partial class InputStorePaymentStarsGiveaway : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; public InputPeer boost_peer; @@ -15778,9 +15791,12 @@ namespace TL [Flags] public enum Flags : uint { only_new_subscribers = 0x1, + /// Field has a value has_additional_peers = 0x2, + /// Field has a value has_countries_iso2 = 0x4, winners_are_visible = 0x8, + /// Field has a value has_prize_description = 0x10, } } @@ -15846,7 +15862,7 @@ namespace TL public EmojiStatus[] statuses; } - /// Message reaction See Derived classes: , + /// Message reaction See Derived classes: , , /// a value means reactionEmpty public abstract partial class Reaction : IObject { } /// Normal emoji message reaction See @@ -17422,7 +17438,7 @@ namespace TL public override DateTime StartDate => start_date; } - /// Contains info about a prepaid giveaway ». See Derived classes: + /// Contains info about a prepaid giveaway ». See Derived classes: , public abstract partial class PrepaidGiveawayBase : IObject { /// Prepaid giveaway ID. @@ -18863,6 +18879,7 @@ namespace TL [TLDef(0xC3FF71E7)] public sealed partial class BroadcastRevenueBalances : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of not-yet-withdrawn cryptocurrency. public long current_balance; @@ -18940,7 +18957,7 @@ namespace TL } } - /// Source of an incoming Telegram Star transaction, or its recipient for outgoing Telegram Star transactions. See Derived classes: , , , , , , + /// Source of an incoming Telegram Star transaction, or its recipient for outgoing Telegram Star transactions. See Derived classes: , , , , , , , public abstract partial class StarsTransactionPeerBase : IObject { } /// Describes a Telegram Star transaction that cannot be described using the current layer. See [TLDef(0x95F2BFE4)] @@ -19307,6 +19324,7 @@ namespace TL [TLDef(0x538ECF18)] public sealed partial class StarsSubscription : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string id; public Peer peer; @@ -19319,6 +19337,7 @@ namespace TL canceled = 0x1, can_refulfill = 0x2, missing_balance = 0x4, + /// Field has a value has_chat_invite_hash = 0x8, } } @@ -19327,6 +19346,7 @@ namespace TL [TLDef(0x4BA3A95A)] public sealed partial class MessageReactor : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public Peer peer_id; public int count; @@ -19336,6 +19356,7 @@ namespace TL top = 0x1, my = 0x2, anonymous = 0x4, + /// Field has a value has_peer_id = 0x8, } } @@ -19344,6 +19365,7 @@ namespace TL [TLDef(0x94CE852A)] public sealed partial class StarsGiveawayOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; public int yearly_boosts; @@ -19356,6 +19378,7 @@ namespace TL { extended = 0x1, default_ = 0x2, + /// Field has a value has_store_product = 0x4, } } @@ -19364,6 +19387,7 @@ namespace TL [TLDef(0x54236209)] public sealed partial class StarsGiveawayWinnersOption : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int users; public long per_user_stars; @@ -19378,6 +19402,7 @@ namespace TL [TLDef(0x49C577CD)] public sealed partial class StarGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long id; public DocumentBase sticker; @@ -19400,6 +19425,7 @@ namespace TL [TLDef(0x901689EA)] public sealed partial class Payments_StarGifts : IObject { + /// Hash used for caching, for more info click here public int hash; public StarGift[] gifts; } @@ -19408,6 +19434,7 @@ namespace TL [TLDef(0xEEA49A6E)] public sealed partial class UserStarGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public long from_id; public DateTime date; @@ -19419,9 +19446,13 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_from_id = 0x2, + /// Field has a value has_message = 0x4, + /// Field has a value has_msg_id = 0x8, + /// Field has a value has_convert_stars = 0x10, unsaved = 0x20, } @@ -19431,6 +19462,7 @@ namespace TL [TLDef(0x6B65B517)] public sealed partial class Payments_UserStarGifts : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public UserStarGift[] gifts; @@ -19439,6 +19471,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } @@ -19451,7 +19484,7 @@ namespace TL public byte[] option; } - /// See + /// See Derived classes: , , public abstract partial class ReportResult : IObject { } /// See [TLDef(0xF0E4E0B6)] @@ -19464,6 +19497,7 @@ namespace TL [TLDef(0x6F09AC31)] public sealed partial class ReportResultAddComment : ReportResult { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public byte[] option; diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 69df50d..e1f5dc2 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1850,6 +1850,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. + /// Bots only: if set, allows sending up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance. /// The destination where the message will be sent /// If set, indicates that the message should be sent in reply to the specified message or story.
Also used to quote other messages. /// The message @@ -1883,6 +1884,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. + /// Bots only: if set, allows sending up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance. /// Destination /// If set, indicates that the message should be sent in reply to the specified message or story. /// Attached media @@ -1918,6 +1920,7 @@ namespace TL /// Whether to forward messages without quoting the original author /// Whether to strip captions from media /// Only for bots, disallows further re-forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled + /// Bots only: if set, allows sending up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance. /// Source of messages /// IDs of messages /// Random ID to prevent resending of messages You can use @@ -2871,6 +2874,7 @@ namespace TL /// Only for bots, disallows forwarding and saving of the messages, even if the destination chat doesn't have content protection enabled /// Whether to move used stickersets to top, see here for more info on this flag » /// If set, any eventual webpage preview will be shown on top of the message instead of at the bottom. + /// Bots only: if set, allows sending up to 1000 messages per second, ignoring broadcasting limits for a fee of 0.1 Telegram Stars per message. The relevant Stars will be withdrawn from the bot's balance. /// The destination chat /// If set, indicates that the message should be sent in reply to the specified message or story. /// The medias to send: note that they must be separately uploaded using Messages_UploadMedia first, using raw inputMediaUploaded* constructors is not supported. @@ -4311,7 +4315,8 @@ namespace TL platform = platform, }); - /// See + /// See [bots: ✓] + /// You can use public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool? private_ = default) => client.Invoke(new Messages_SendPaidReaction { @@ -4323,7 +4328,7 @@ namespace TL private_ = private_ ?? default, }); - /// See + /// See [bots: ✓] public static Task Messages_TogglePaidReactionPrivacy(this Client client, InputPeer peer, int msg_id, bool private_) => client.Invoke(new Messages_TogglePaidReactionPrivacy { @@ -4332,13 +4337,15 @@ namespace TL private_ = private_, }); - /// See + /// See [bots: ✓] public static Task Messages_GetPaidReactionPrivacy(this Client client) => client.Invoke(new Messages_GetPaidReactionPrivacy { }); - /// See + /// Mark a specific sponsored message » as read See [bots: ✓] + /// 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) => client.Invoke(new Messages_ViewSponsoredMessage { @@ -4346,7 +4353,9 @@ namespace TL random_id = random_id, }); - /// See + /// Informs the server that the user has either: See [bots: ✓] + /// 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) => client.Invoke(new Messages_ClickSponsoredMessage { @@ -4355,7 +4364,10 @@ namespace TL random_id = random_id, }); - /// See + /// Report a sponsored message », see here » for more info on the full flow. See [bots: ✓] + /// 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) => client.Invoke(new Messages_ReportSponsoredMessage { @@ -4364,7 +4376,8 @@ namespace TL option = option, }); - /// See + /// Get a list of sponsored messages for a peer, see here » for more info. See [bots: ✓] + /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer) => client.Invoke(new Messages_GetSponsoredMessages @@ -5953,7 +5966,7 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] public static Task Payments_GetStarsSubscriptions(this Client client, InputPeer peer, string offset, bool missing_balance = false) => client.Invoke(new Payments_GetStarsSubscriptions { @@ -5962,7 +5975,7 @@ namespace TL offset = offset, }); - /// See + /// See [bots: ✓] public static Task Payments_ChangeStarsSubscription(this Client client, InputPeer peer, string subscription_id, bool? canceled = default) => client.Invoke(new Payments_ChangeStarsSubscription { @@ -5972,7 +5985,7 @@ namespace TL canceled = canceled ?? default, }); - /// See + /// See [bots: ✓] public static Task Payments_FulfillStarsSubscription(this Client client, InputPeer peer, string subscription_id) => client.Invoke(new Payments_FulfillStarsSubscription { @@ -5980,13 +5993,14 @@ namespace TL subscription_id = subscription_id, }); - /// See + /// See [bots: ✓] public static Task Payments_GetStarsGiveawayOptions(this Client client) => client.Invoke(new Payments_GetStarsGiveawayOptions { }); - /// See + /// See [bots: ✓] + /// Hash used for caching, for more info click here. /// a null value means payments.starGiftsNotModified public static Task Payments_GetStarGifts(this Client client, int hash = default) => client.Invoke(new Payments_GetStarGifts @@ -5994,7 +6008,8 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Payments_GetUserStarGifts(this Client client, InputUserBase user_id, string offset, int limit = int.MaxValue) => client.Invoke(new Payments_GetUserStarGifts { @@ -6003,7 +6018,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Payments_SaveStarGift(this Client client, InputUserBase user_id, int msg_id, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { @@ -6012,7 +6027,7 @@ namespace TL msg_id = msg_id, }); - /// See + /// See [bots: ✓] public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) => client.Invoke(new Payments_ConvertStarGift { From 9ad6220527b7c083f51e7c18d06cd5eca56c4aca Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 14 Nov 2024 13:18:05 +0100 Subject: [PATCH 256/336] Fix potential deadlock in HTTP mode --- src/Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index 97602c7..8330dfc 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1518,7 +1518,7 @@ namespace WTelegram var data = await response.Content.ReadAsByteArrayAsync(); var obj = ReadFrame(data, data.Length); if (obj != null) - await HandleMessageAsync(obj); + _ = HandleMessageAsync(obj); } } From fc441121a32c3e4ce90595a2346d412c1f83a786 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Nov 2024 13:44:32 +0100 Subject: [PATCH 257/336] Improved HTTP mode reliability --- src/Client.cs | 55 +++++++++++++++++++++++++-------------------------- 1 file changed, 27 insertions(+), 28 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 8330dfc..28207cf 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -223,7 +223,7 @@ namespace WTelegram { try { - if (CheckMsgsToAck() is MsgsAck msgsAck) + if (_httpClient == null && CheckMsgsToAck() is MsgsAck msgsAck) await SendAsync(msgsAck, false).WaitAsync(1000).ConfigureAwait(false); } catch { } @@ -885,7 +885,10 @@ namespace WTelegram #endif } else if (_httpClient != null) + { + Helpers.Log(2, $"Using HTTP Mode"); _reactorTask = Task.CompletedTask; + } else { endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out int defaultDc); @@ -1434,7 +1437,9 @@ namespace WTelegram return; } } - await _sendSemaphore.WaitAsync(_cts.Token); + Task receiveTask = null; + var sem = _sendSemaphore; + await sem.WaitAsync(_cts.Token); try { using var memStream = new MemoryStream(1024); @@ -1494,32 +1499,30 @@ namespace WTelegram #if OBFUSCATION _sendCtr?.EncryptDecrypt(buffer, frameLength); #endif - var sending = SendFrame(buffer, frameLength); + if (_networkStream != null) + await _networkStream.WriteAsync(buffer, 0, frameLength); + else + receiveTask = SendReceiveHttp(buffer, frameLength); _lastSentMsg = msg; - await sending; } finally { - _sendSemaphore.Release(); + sem.Release(); } + if (receiveTask != null) await receiveTask; } - private async Task SendFrame(byte[] buffer, int frameLength) + private async Task SendReceiveHttp(byte[] buffer, int frameLength) { - if (_networkStream != null) - await _networkStream.WriteAsync(buffer, 0, frameLength); - else - { - var endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out _); - var content = new ByteArrayContent(buffer, 4, frameLength - 4); - var response = await _httpClient.PostAsync($"http://{endpoint}/api", content); - if (response.StatusCode != HttpStatusCode.OK) - throw new RpcException((int)response.StatusCode, TransportError((int)response.StatusCode)); - var data = await response.Content.ReadAsByteArrayAsync(); - var obj = ReadFrame(data, data.Length); - if (obj != null) - _ = HandleMessageAsync(obj); - } + var endpoint = _dcSession?.EndPoint ?? GetDefaultEndpoint(out _); + var content = new ByteArrayContent(buffer, 4, frameLength - 4); + var response = await _httpClient.PostAsync($"http://{endpoint}/api", content, _cts.Token); + if (response.StatusCode != HttpStatusCode.OK) + throw new RpcException((int)response.StatusCode, TransportError((int)response.StatusCode)); + var data = await response.Content.ReadAsByteArrayAsync(); + var obj = ReadFrame(data, data.Length); + if (obj != null) + await HandleMessageAsync(obj); } /// Long poll on HTTP connections @@ -1540,9 +1543,9 @@ namespace WTelegram { if (_bareRpc != null) throw new WTException("A bare request is already undergoing"); retry: - _bareRpc = new Rpc { type = typeof(T) }; + var bareRpc = _bareRpc = new Rpc { type = typeof(T) }; await SendAsync(request, false, _bareRpc); - var result = await _bareRpc.Task; + var result = await bareRpc.Task; if (result is ReactorError) goto retry; return (T)result; } @@ -1559,12 +1562,8 @@ namespace WTelegram retry: var rpc = new Rpc { type = typeof(T) }; await SendAsync(query, true, rpc); - if (_httpClient != null && !rpc.Task.IsCompleted) - { - // usually happens when a batch of unrelated messages were serialized before in the previous MsgContainer reply - await HttpWait(_httpWait); // wait a bit more - if (!rpc.Task.IsCompleted) rpc.tcs.TrySetException(new RpcException(417, "Missing RPC response via HTTP")); - } + while (_httpClient != null && !rpc.Task.IsCompleted) + await HttpWait(_httpWait); // need to wait a bit more in some case var result = await rpc.Task; switch (result) From 9208d0b92c09da36b235a67517ed27a29adfe4df Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:17:28 +0100 Subject: [PATCH 258/336] API Layer 193: fullscreen mini-apps, Bot API 8.0 --- README.md | 2 +- src/TL.Schema.cs | 219 ++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 170 +++++++++++++++++++++++++--- src/TL.Table.cs | 18 ++- src/WTelegramClient.csproj | 2 +- 5 files changed, 363 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 2783d1e..85dd472 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-192-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-193-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 97a5fdd..643ed25 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1090,6 +1090,7 @@ namespace TL [IfFlag(41)] public EmojiStatus emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
[IfFlag(42)] public int level; + /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -1170,6 +1171,7 @@ namespace TL has_level = 0x400, /// Field has a value has_subscription_until_date = 0x800, + /// If set, messages sent by admins to this channel will link to the admin's profile (just like with groups). signature_profiles = 0x1000, } @@ -1544,6 +1546,7 @@ namespace TL paid_media_allowed = 0x4000, /// If set, this user can view Telegram Star revenue statistics » for this channel. can_view_stars_revenue = 0x8000, + /// If set, users may send paid Telegram Star reactions » to messages of this channel. paid_reactions_available = 0x10000, } @@ -2166,6 +2169,7 @@ namespace TL public int quantity; /// Duration in months of each Telegram Premium subscription in the giveaway. [IfFlag(4)] public int months; + /// For Telegram Star giveaways, the total number of Telegram Stars being given away. [IfFlag(5)] public long stars; /// The end date of the giveaway. public DateTime until_date; @@ -2206,6 +2210,7 @@ namespace TL public long[] winners; /// Duration in months of each Telegram Premium subscription in the giveaway. [IfFlag(4)] public int months; + /// For Telegram Star giveaways, the total number of Telegram Stars being given away. [IfFlag(5)] public long stars; /// Can contain a textual description of additional giveaway prizes. [IfFlag(1)] public string prize_description; @@ -2689,6 +2694,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// For Telegram Star giveaways, the total number of Telegram Stars being given away. [IfFlag(0)] public long stars; [Flags] public enum Flags : uint @@ -2710,6 +2716,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, this is a Telegram Star giveaway stars = 0x1, } } @@ -2779,15 +2786,17 @@ namespace TL has_transaction_id = 0x2, } } - /// See + /// You won some Telegram Stars in a Telegram Star giveaway ». See [TLDef(0xB00C47A2)] public sealed partial class MessageActionPrizeStars : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The number of Telegram Stars you won public long stars; public string transaction_id; public Peer boost_peer; + /// ID of the message containing the public int giveaway_msg_id; [Flags] public enum Flags : uint @@ -2796,14 +2805,14 @@ namespace TL } } /// See - [TLDef(0x9BB3EF44)] + [TLDef(0x08557637)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGift gift; [IfFlag(1)] public TextWithEntities message; - public long convert_stars; + [IfFlag(4)] public long convert_stars; [Flags] public enum Flags : uint { @@ -2812,6 +2821,8 @@ namespace TL has_message = 0x2, saved = 0x4, converted = 0x8, + /// Field has a value + has_convert_stars = 0x10, } } @@ -3563,6 +3574,7 @@ namespace TL has_stargifts_count = 0x100, /// If set, this user can view ad revenue statistics » for this bot. can_view_revenue = 0x200, + bot_can_manage_emoji_status = 0x400, } } @@ -5614,12 +5626,25 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// See + /// Contains the current default paid reaction privacy, see here &raquo: for more info. See [TLDef(0x51CA7AEC)] public sealed partial class UpdatePaidReactionPrivacy : Update { + /// Whether paid reaction privacy is enabled or disabled. public bool private_; } + /// See + [TLDef(0x2D13C6EE)] + public sealed partial class UpdateBotSubscriptionExpire : Update + { + public long user_id; + public string payload; + public string invoice_slug; + public DateTime until_date; + public int qts; + + public override (long, int, int) GetMBox() => (-1, qts, 1); + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -6760,6 +6785,8 @@ namespace TL About = 0x3823CC40, ///Whether the user can see our birthday. Birthday = 0xD65A11CC, + ///See + StarGiftsAutoSave = 0xE1732341, } /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See @@ -6787,6 +6814,8 @@ namespace TL About = 0xA486B761, ///Whether the user can see our birthday. Birthday = 0x2000A518, + ///See + StarGiftsAutoSave = 0x2CA4FDF8, } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , @@ -6837,6 +6866,12 @@ namespace TL /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0x77CDC9F1)] public sealed partial class InputPrivacyValueAllowPremium : InputPrivacyRule { } + /// See + [TLDef(0x5A4FCCE5)] + public sealed partial class InputPrivacyValueAllowBots : InputPrivacyRule { } + /// See + [TLDef(0xC4E57915)] + public sealed partial class InputPrivacyValueDisallowBots : InputPrivacyRule { } /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , , public abstract partial class PrivacyRule : IObject { } @@ -6886,6 +6921,12 @@ namespace TL /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0xECE9814B)] public sealed partial class PrivacyValueAllowPremium : PrivacyRule { } + /// See + [TLDef(0x21461B5D)] + public sealed partial class PrivacyValueAllowBots : PrivacyRule { } + /// See + [TLDef(0xF6A5F82F)] + public sealed partial class PrivacyValueDisallowBots : PrivacyRule { } /// Privacy rules See [TLDef(0x50A04E45)] @@ -7419,9 +7460,11 @@ namespace TL [IfFlag(3)] public int usage; /// Number of users that have already used this link to join [IfFlag(7)] public int requested; + /// For Telegram Star subscriptions », contains the number of chat members which have already joined the chat using the link, but have already left due to expiration of their subscription. [IfFlag(10)] public int subscription_expired; /// Custom description for the invite link, visible only to admins [IfFlag(8)] public string title; + /// For Telegram Star subscriptions », contains the pricing of the subscription the user must activate to join the private channel. [IfFlag(9)] public StarsSubscriptionPricing subscription_pricing; [Flags] public enum Flags : uint @@ -7481,7 +7524,9 @@ namespace TL [IfFlag(4)] public UserBase[] participants; /// Profile color palette ID public int color; + /// For Telegram Star subscriptions », contains the pricing of the subscription the user must activate to join the private channel. [IfFlag(10)] public StarsSubscriptionPricing subscription_pricing; + /// For Telegram Star subscriptions », the ID of the payment form for the subscription. [IfFlag(12)] public long subscription_form_id; [Flags] public enum Flags : uint @@ -7508,6 +7553,7 @@ namespace TL fake = 0x200, /// Field has a value has_subscription_pricing = 0x400, + /// If set, indicates that the user has already paid for the associated Telegram Star subscriptions » and it hasn't expired yet, so they may re-join the channel using Messages_ImportChatInvite without repeating the payment. can_refulfill_subscription = 0x800, /// Field has a value has_subscription_form_id = 0x1000, @@ -7651,7 +7697,7 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0x82437E74)] + [TLDef(0x36607333)] public sealed partial class BotInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7668,7 +7714,9 @@ namespace TL [IfFlag(2)] public BotCommand[] commands; /// Indicates the action to execute when pressing the in-UI menu button for bots [IfFlag(3)] public BotMenuButtonBase menu_button; + /// The HTTP link to the privacy policy of the bot. If not set, then the /privacy command must be used, if supported by the bot (i.e. if it's present in the commands vector). If it isn't supported, then https://telegram.org/privacy-tpa must be opened, instead. [IfFlag(7)] public string privacy_policy_url; + [IfFlag(8)] public BotAppSettings app_settings; [Flags] public enum Flags : uint { @@ -7688,6 +7736,8 @@ namespace TL has_preview_medias = 0x40, /// Field has a value has_privacy_policy_url = 0x80, + /// Field has a value + has_app_settings = 0x100, } } @@ -8268,6 +8318,7 @@ namespace TL public long user_id; /// Date joined public DateTime date; + /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(0)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -8288,6 +8339,7 @@ namespace TL public long inviter_id; /// When did I join the channel/supergroup public DateTime date; + /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(1)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -10308,7 +10360,7 @@ namespace TL } /// Invoice See - [TLDef(0x5DB95A15)] + [TLDef(0x049EE584)] public sealed partial class Invoice : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -10323,6 +10375,7 @@ namespace TL [IfFlag(8)] public long[] suggested_tip_amounts; /// Terms of service URL [IfFlag(10)] public string terms_url; + [IfFlag(11)] public int subscription_period; [Flags] public enum Flags : uint { @@ -10348,6 +10401,8 @@ namespace TL recurring = 0x200, /// Field has a value has_terms_url = 0x400, + /// Field has a value + has_subscription_period = 0x800, } } @@ -11842,10 +11897,10 @@ namespace TL /// The supergroup's custom emoji stickerset was changed. See [TLDef(0x46D840AB)] public sealed partial class ChannelAdminLogEventActionChangeEmojiStickerSet : ChannelAdminLogEventActionChangeStickerSet { } - /// See + /// Channel signature profiles were enabled/disabled. See [TLDef(0x60A79C79)] public sealed partial class ChannelAdminLogEventActionToggleSignatureProfiles : ChannelAdminLogEventActionToggleSignatures { } - /// See + /// A paid subscriber has extended their Telegram Star subscription ». See [TLDef(0x64642DB3)] public sealed partial class ChannelAdminLogEventActionParticipantSubExtend : ChannelAdminLogEventAction { @@ -11926,6 +11981,7 @@ namespace TL send = 0x10000, /// Forum-related events forums = 0x20000, + /// Telegram Star subscription extension events » sub_extend = 0x40000, } } @@ -15207,6 +15263,7 @@ namespace TL public ReactionCount[] results; /// List of recent peers and their reactions [IfFlag(1)] public MessagePeerReaction[] recent_reactions; + /// Paid Telegram Star reactions leaderboard » for this message. [IfFlag(4)] public MessageReactor[] top_reactors; [Flags] public enum Flags : uint @@ -15455,6 +15512,7 @@ namespace TL has_query_id = 0x1, /// If set, the app must be opened in fullsize mode instead of compact mode. fullsize = 0x2, + fullscreen = 0x4, } } @@ -15577,17 +15635,18 @@ namespace TL /// Should be populated with one of the giveaway options returned by Payments_GetPremiumGiftCodeOptions, see the giveaways » documentation for more info. public PremiumGiftCodeOption option; } - /// Used to top up the Telegram Stars balance of the current account or someone else's account. See + /// Used to top up the Telegram Stars balance of the current account or someone else's account, or to start a Telegram Star giveaway ». See [TLDef(0x65F00CE3)] public sealed partial class InputInvoiceStars : InputInvoice { - /// Either an or an . + /// An , or . public InputStorePaymentPurpose purpose; } - /// See + /// Used to pay for a Telegram Star subscription ». See [TLDef(0x34E793F1)] public sealed partial class InputInvoiceChatInviteSubscription : InputInvoice { + /// The invitation link of the Telegram Star subscription » public string hash; } /// See @@ -15771,30 +15830,42 @@ namespace TL /// Total price 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 amount; } - /// See + /// Used to pay for a star giveaway, see here » for more info. See [TLDef(0x751F08FA)] public sealed partial class InputStorePaymentStarsGiveaway : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of Telegram Stars being given away (each user will receive stars/users stars). public long stars; + /// The channel/supergroup starting the giveaway, that the user must join to participate, that will receive the giveaway boosts; see here » for more info on giveaways. public InputPeer boost_peer; + /// Additional channels that the user must join to participate to the giveaway can be specified here. [IfFlag(1)] public InputPeer[] additional_peers; + /// The set of users that can participate to the giveaway can be restricted by passing here an explicit whitelist of up to giveaway_countries_max countries, specified as two-letter ISO 3166-1 alpha-2 country codes. [IfFlag(2)] public string[] countries_iso2; + /// Can contain a textual description of additional giveaway prizes. [IfFlag(4)] public string prize_description; + /// Random ID to avoid resending the giveaway public long random_id; + /// The end date of the giveaway, must be at most giveaway_period_max seconds in the future; see here » for more info on giveaways. public DateTime until_date; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; + /// Number of winners. public int users; [Flags] public enum Flags : uint { + /// If set, only new subscribers starting from the giveaway creation date will be able to participate to the giveaway. only_new_subscribers = 0x1, /// Field has a value has_additional_peers = 0x2, /// Field has a value has_countries_iso2 = 0x4, + /// If set, giveaway winners are public and will be listed in a message that will be automatically sent to the channel once the giveaway ends. winners_are_visible = 0x8, /// Field has a value has_prize_description = 0x10, @@ -15879,7 +15950,7 @@ namespace TL /// Custom emoji document ID public long document_id; } - /// See + /// Represents a paid Telegram Star reaction ». See [TLDef(0x523DA4EB)] public sealed partial class ReactionPaid : Reaction { } @@ -17468,18 +17539,26 @@ namespace TL /// Payment date. public override DateTime Date => date; } - /// See + /// Contains info about a prepaid Telegram Star giveaway ». See [TLDef(0x9A9D77E0)] public sealed partial class PrepaidStarsGiveaway : PrepaidGiveawayBase { + /// Prepaid giveaway ID. public long id; + /// Number of given away Telegram Stars » public long stars; + /// Number of giveaway winners public int quantity; + /// Number of boosts the channel will gain by launching the giveaway. public int boosts; + /// When was the giveaway paid for public DateTime date; + /// Prepaid giveaway ID. public override long ID => id; + /// Number of giveaway winners public override int Quantity => quantity; + /// When was the giveaway paid for public override DateTime Date => date; } @@ -18890,6 +18969,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the available balance can be withdrawn ». withdrawal_enabled = 0x1, } } @@ -18984,7 +19064,7 @@ namespace TL /// Describes a Telegram Star transaction used to pay for Telegram ads as specified here ». See [TLDef(0x60682812)] public sealed partial class StarsTransactionPeerAds : StarsTransactionPeerBase { } - /// See + /// Describes a Telegram Star transaction used to pay for paid API usage, such as paid bot broadcasts. See [TLDef(0xF9677AAD)] public sealed partial class StarsTransactionPeerAPI : StarsTransactionPeerBase { } @@ -19042,9 +19122,11 @@ namespace TL [IfFlag(8)] public int msg_id; /// The purchased paid media ». [IfFlag(9)] public MessageMedia[] extended_media; + /// The number of seconds between consecutive Telegram Star debiting for Telegram Star subscriptions ». [IfFlag(12)] public int subscription_period; [IfFlag(13)] public int giveaway_post_id; [IfFlag(14)] public StarGift stargift; + /// This transaction is payment for paid bot broadcasts.
Paid broadcasts are only allowed if the allow_paid_floodskip parameter of Messages_SendMessage and other message sending methods is set while trying to broadcast more than 30 messages per second to bot users.
The integer value returned by this flag indicates the number of billed API calls.
[IfFlag(15)] public int floodskip_number; [Flags] public enum Flags : uint @@ -19071,6 +19153,7 @@ namespace TL has_extended_media = 0x200, /// This transaction was a gift from the user in peer.peer. gift = 0x400, + /// This transaction is a paid reaction ». reaction = 0x800, /// Field has a value has_subscription_period = 0x1000, @@ -19083,7 +19166,7 @@ namespace TL } } - /// Info about the current Telegram Star balance and transaction history ». See + /// Info about the current Telegram Star subscriptions, balance and transaction history ». See [TLDef(0xBBFA316C)] public sealed partial class Payments_StarsStatus : IObject, IPeerResolver { @@ -19091,8 +19174,11 @@ namespace TL public Flags flags; /// Current Telegram Star balance. public long balance; + /// Info about current Telegram Star subscriptions, only returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(1)] public StarsSubscription[] subscriptions; + /// Offset for pagination of subscriptions: only usable with Payments_GetStarsSubscriptions, returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(2)] public string subscriptions_next_offset; + /// The number of Telegram Stars the user should buy to be able to extend expired subscriptions soon (i.e. the current balance is not enough to extend all expired subscriptions). [IfFlag(4)] public long subscriptions_missing_balance; /// List of Telegram Star transactions (partial if next_offset is set). [IfFlag(3)] public StarsTransaction[] history; @@ -19312,71 +19398,104 @@ namespace TL public string[] lang_codes; } - /// See + /// Pricing of a Telegram Star subscription ». See [TLDef(0x05416D58)] public sealed partial class StarsSubscriptionPricing : IObject { + /// The user should pay amount stars every period seconds to gain and maintain access to the channel.
Currently the only allowed subscription period is 30*24*60*60, i.e. the user will be debited amount stars every month.
public int period; + /// Price of the subscription in Telegram Stars. public long amount; } - ///
See - [TLDef(0x538ECF18)] + /// Represents a Telegram Star subscription ». See + [TLDef(0x2E6EAB1A)] public sealed partial class StarsSubscription : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Subscription ID. public string id; + /// Identifier of the associated private chat. public Peer peer; + /// Expiration date of the current subscription period. public DateTime until_date; + /// Pricing of the subscription in Telegram Stars. public StarsSubscriptionPricing pricing; + /// Invitation link, used to renew the subscription after cancellation or expiration. [IfFlag(3)] public string chat_invite_hash; + [IfFlag(4)] public string title; + [IfFlag(5)] public WebDocumentBase photo; + [IfFlag(6)] public string invoice_slug; [Flags] public enum Flags : uint { + /// Whether this subscription was cancelled. canceled = 0x1, + /// Whether we left the associated private channel, but we can still rejoin it using Payments_FulfillStarsSubscription because the current subscription period hasn't expired yet. can_refulfill = 0x2, + /// Whether this subscription has expired because there are not enough stars on the user's balance to extend it. missing_balance = 0x4, /// Field has a value has_chat_invite_hash = 0x8, + /// Field has a value + has_title = 0x10, + /// Field has a value + has_photo = 0x20, + /// Field has a value + has_invoice_slug = 0x40, + bot_canceled = 0x80, } } - /// See + /// Info about a user in the paid Star reactions leaderboard for a message. See [TLDef(0x4BA3A95A)] public sealed partial class MessageReactor : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the peer that reacted: may be unset for anonymous reactors different from the current user (i.e. if the current user sent an anonymous reaction anonymous will be set but this field will also be set). [IfFlag(3)] public Peer peer_id; + /// The number of sent Telegram Stars. public int count; [Flags] public enum Flags : uint { + /// If set, the reactor is one of the most active reactors; may be unset if the reactor is the current user. top = 0x1, + /// If set, this reactor is the current user. my = 0x2, + /// If set, the reactor is anonymous. anonymous = 0x4, /// Field has a value has_peer_id = 0x8, } } - /// See + /// Contains info about a Telegram Star giveaway option. See [TLDef(0x94CE852A)] public sealed partial class StarsGiveawayOption : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The number of Telegram Stars that will be distributed among winners public long stars; + /// Number of times the chat will be boosted for one year if the .boost_peer flag is populated public int yearly_boosts; + /// Identifier of the store product associated with the option, official apps only. [IfFlag(2)] public string store_product; + /// Three-letter ISO 4217 currency code public string currency; + /// Total price 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 amount; + /// Allowed options for the number of giveaway winners. public StarsGiveawayWinnersOption[] winners; [Flags] public enum Flags : uint { + /// If set, this option must only be shown in the full list of giveaway options (i.e. they must be added to the list only when the user clicks on the expand button). extended = 0x1, + /// If set, this option must be pre-selected by default in the option list. default_ = 0x2, /// Field has a value has_store_product = 0x4, @@ -19389,11 +19508,14 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The number of users that will be randomly chosen as winners. public int users; + /// The number of Telegram Stars each winner will receive. public long per_user_stars; [Flags] public enum Flags : uint { + /// If set, this option must be pre-selected by default in the option list. default_ = 0x1, } } @@ -19417,6 +19539,7 @@ namespace TL { limited = 0x1, sold_out = 0x2, + birthday = 0x4, } } @@ -19476,37 +19599,83 @@ namespace TL } } - /// See + /// Report menu option See [TLDef(0x7903E3D9)] public sealed partial class MessageReportOption : IObject { + /// Option title public string text; + /// Option identifier: if the user selects this option, re-invoke Messages_Report, passing this option to option public byte[] option; } /// See Derived classes: , , public abstract partial class ReportResult : IObject { } - /// See + /// The user must choose one of the following options, and then Messages_Report must be re-invoked, passing the option's option identifier to Messages_Report.option. See [TLDef(0xF0E4E0B6)] public sealed partial class ReportResultChooseOption : ReportResult { + /// Title of the option popup public string title; + /// Available options, rendered as menu entries. public MessageReportOption[] options; } - /// See + /// The user should enter an additional comment for the moderators, and then Messages_Report must be re-invoked, passing the comment to Messages_Report.message. See [TLDef(0x6F09AC31)] public sealed partial class ReportResultAddComment : ReportResult { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The Messages_Report method must be re-invoked, passing this option to option public byte[] option; [Flags] public enum Flags : uint { + /// Whether this step can be skipped by the user, passing an empty message to Messages_Report, or if a non-empty message is mandatory. optional = 0x1, } } - /// See + /// The report was sent successfully, no further actions are required. See [TLDef(0x8DB33C4B)] public sealed partial class ReportResultReported : ReportResult { } + + /// See + [TLDef(0x8ECF0511)] + public sealed partial class Messages_BotPreparedInlineMessage : IObject + { + public string id; + public DateTime expire_date; + } + + /// See + [TLDef(0xFF57708D)] + public sealed partial class Messages_PreparedInlineMessage : IObject + { + public long query_id; + public BotInlineResultBase result; + public InlineQueryPeerType[] peer_types; + public int cache_time; + public Dictionary users; + } + + /// See + [TLDef(0xC99B1950)] + public sealed partial class BotAppSettings : IObject + { + public Flags flags; + [IfFlag(0)] public byte[] placeholder_path; + [IfFlag(1)] public int background_color; + [IfFlag(2)] public int background_dark_color; + [IfFlag(3)] public int header_color; + [IfFlag(4)] public int header_dark_color; + + [Flags] public enum Flags : uint + { + has_placeholder_path = 0x1, + has_background_color = 0x2, + has_background_dark_color = 0x4, + has_header_color = 0x8, + has_header_dark_color = 0x10, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e1f5dc2..ecb1986 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2214,6 +2214,7 @@ namespace TL /// Expiration date /// Maximum number of users that can join using this link /// Description of the invite link, visible only to administrators + /// For Telegram Star subscriptions », contains the pricing of the subscription the user must activate to join the private channel. public static Task Messages_ExportChatInvite(this Client client, InputPeer peer, DateTime? expire_date = null, int? usage_limit = null, string title = null, StarsSubscriptionPricing subscription_pricing = null, bool legacy_revoke_permanent = false, bool request_needed = false) => client.Invoke(new Messages_ExportChatInvite { @@ -3409,6 +3410,7 @@ namespace TL /// Get info about the users that joined the chat using a specific chat invite See Possible codes: 400,403 (details) /// If set, only returns info about users with pending join requests » + /// Set this flag if the link is a Telegram Star subscription link » and only members with already expired subscription must be returned. /// Chat /// Invite link /// Search for a user in the pending join requests » list: only available when the requested flag is set, cannot be used together with a specific link. @@ -3588,7 +3590,8 @@ namespace TL /// Change the set of message reactions » that can be used in a certain group, supergroup or channel See Possible codes: 400 (details) /// Group where to apply changes /// Allowed reaction emojis - /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max); this field and the other info set by the method will then be available to users in and . + /// This flag may be used to impose a custom limit of unique reactions (i.e. a customizable version of appConfig.reactions_uniq_max); this field and the other info set by the method will then be available to users in and .
If this flag is not set, the previously configured reactions_limit will not be altered. + /// If this flag is set and a is passed, the method will enable or disable paid message reactions ». If this flag is not set, the previously stored setting will not be changed. public static Task Messages_SetChatAvailableReactions(this Client client, InputPeer peer, ChatReactions available_reactions, int? reactions_limit = null, bool? paid_enabled = default) => client.Invoke(new Messages_SetChatAvailableReactions { @@ -3716,10 +3719,10 @@ namespace TL /// Short name of the application; 0-64 English letters, digits, and underscores /// If set, indicates that the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent in reply to the specified message or story. /// Open the web app as the specified peer, sending the resulting the message as the specified peer. - public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false, bool compact = false) + public static Task Messages_RequestWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, InputReplyTo reply_to = null, string url = null, DataJSON theme_params = null, string start_param = null, InputPeer send_as = null, bool from_bot_menu = false, bool silent = false, bool compact = false, bool fullscreen = false) => client.Invoke(new Messages_RequestWebView { - flags = (Messages_RequestWebView.Flags)((reply_to != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (compact ? 0x80 : 0)), + flags = (Messages_RequestWebView.Flags)((reply_to != null ? 0x1 : 0) | (url != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (start_param != null ? 0x8 : 0) | (send_as != null ? 0x2000 : 0) | (from_bot_menu ? 0x10 : 0) | (silent ? 0x20 : 0) | (compact ? 0x80 : 0) | (fullscreen ? 0x100 : 0)), peer = peer, bot = bot, url = url, @@ -3757,10 +3760,10 @@ namespace TL /// Deprecated. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false, bool compact = false) + public static Task Messages_RequestSimpleWebView(this Client client, InputUserBase bot, string platform, DataJSON theme_params = null, string url = null, string start_param = null, bool from_switch_webview = false, bool from_side_menu = false, bool compact = false, bool fullscreen = false) => client.Invoke(new Messages_RequestSimpleWebView { - flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0) | (compact ? 0x80 : 0)), + flags = (Messages_RequestSimpleWebView.Flags)((theme_params != null ? 0x1 : 0) | (url != null ? 0x8 : 0) | (start_param != null ? 0x10 : 0) | (from_switch_webview ? 0x2 : 0) | (from_side_menu ? 0x4 : 0) | (compact ? 0x80 : 0) | (fullscreen ? 0x100 : 0)), bot = bot, url = url, start_param = start_param, @@ -3985,10 +3988,10 @@ namespace TL /// If the startapp query string parameter is present in the direct Mini App deep link, pass it to start_param. /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false, bool compact = false) + public static Task Messages_RequestAppWebView(this Client client, InputPeer peer, InputBotApp app, string platform, string start_param = null, DataJSON theme_params = null, bool write_allowed = false, bool compact = false, bool fullscreen = false) => client.Invoke(new Messages_RequestAppWebView { - flags = (Messages_RequestAppWebView.Flags)((start_param != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (compact ? 0x80 : 0)), + flags = (Messages_RequestAppWebView.Flags)((start_param != null ? 0x2 : 0) | (theme_params != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (compact ? 0x80 : 0) | (fullscreen ? 0x100 : 0)), peer = peer, app = app, start_param = start_param, @@ -4304,10 +4307,10 @@ namespace TL /// Start parameter, if opening from a Main Mini App link ». /// Theme parameters » /// Short name of the application; 0-64 English letters, digits, and underscores - public static Task Messages_RequestMainWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, DataJSON theme_params = null, string start_param = null, bool compact = false) + public static Task Messages_RequestMainWebView(this Client client, InputPeer peer, InputUserBase bot, string platform, DataJSON theme_params = null, string start_param = null, bool compact = false, bool fullscreen = false) => client.Invoke(new Messages_RequestMainWebView { - flags = (Messages_RequestMainWebView.Flags)((theme_params != null ? 0x1 : 0) | (start_param != null ? 0x2 : 0) | (compact ? 0x80 : 0)), + flags = (Messages_RequestMainWebView.Flags)((theme_params != null ? 0x1 : 0) | (start_param != null ? 0x2 : 0) | (compact ? 0x80 : 0) | (fullscreen ? 0x100 : 0)), peer = peer, bot = bot, start_param = start_param, @@ -4315,8 +4318,12 @@ namespace TL platform = platform, }); - /// See [bots: ✓] - /// You can use + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See [bots: ✓] + /// The channel + /// The message to react to + /// The number of stars to send (each will increment the reaction counter by one). + /// Unique client message ID required to prevent message resending You can use + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool? private_ = default) => client.Invoke(new Messages_SendPaidReaction { @@ -4328,7 +4335,10 @@ namespace TL private_ = private_ ?? default, }); - /// See [bots: ✓] + /// Changes the privacy of already sent paid reactions on a specific message. See [bots: ✓] + /// The channel + /// The ID of the message to which we sent the paid reactions + /// If true, makes the current anonymous in the top sender leaderboard for this message; otherwise, does the opposite. public static Task Messages_TogglePaidReactionPrivacy(this Client client, InputPeer peer, int msg_id, bool private_) => client.Invoke(new Messages_TogglePaidReactionPrivacy { @@ -4337,7 +4347,7 @@ namespace TL private_ = private_, }); - /// See [bots: ✓] + /// Fetches an update with the current default paid reaction privacy, see here &raquo: for more info. See [bots: ✓] public static Task Messages_GetPaidReactionPrivacy(this Client client) => client.Invoke(new Messages_GetPaidReactionPrivacy { @@ -4385,6 +4395,24 @@ namespace TL peer = peer, }); + /// See + public static Task Messages_SavePreparedInlineMessage(this Client client, InputBotInlineResultBase result, InputUserBase user_id, InlineQueryPeerType[] peer_types = null) + => client.Invoke(new Messages_SavePreparedInlineMessage + { + flags = (Messages_SavePreparedInlineMessage.Flags)(peer_types != null ? 0x1 : 0), + result = result, + user_id = user_id, + peer_types = peer_types, + }); + + /// See + public static Task Messages_GetPreparedInlineMessage(this Client client, InputUserBase bot, string id) + => client.Invoke(new Messages_GetPreparedInlineMessage + { + bot = bot, + id = id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5002,6 +5030,8 @@ namespace TL }); /// Enable/disable message signatures in channels See Possible codes: 400 (details) + /// If set, enables message signatures. + /// If set, messages from channel admins will link to their profiles, just like for group messages: can only be set if the signatures_enabled flag is set. /// Channel public static Task Channels_ToggleSignatures(this Client client, InputChannelBase channel, bool signatures_enabled = false, bool profiles_enabled = false) => client.Invoke(new Channels_ToggleSignatures @@ -5708,6 +5738,31 @@ namespace TL bot = bot, }); + /// See + public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatus emoji_status) + => client.Invoke(new Bots_UpdateUserEmojiStatus + { + user_id = user_id, + emoji_status = emoji_status, + }); + + /// See + public static Task Bots_ToggleUserEmojiStatusPermission(this Client client, InputUserBase bot, bool enabled) + => client.Invoke(new Bots_ToggleUserEmojiStatusPermission + { + bot = bot, + enabled = enabled, + }); + + /// See + public static Task Bots_CheckDownloadFileParams(this Client client, InputUserBase bot, string file_name, string url) + => client.Invoke(new Bots_CheckDownloadFileParams + { + bot = bot, + file_name = file_name, + url = url, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -5884,6 +5939,7 @@ namespace TL /// If set, fetches only incoming transactions. /// If set, fetches only outgoing transactions. /// Return transactions in ascending order by date (instead of descending order by date). + /// If set, fetches only transactions for the specified Telegram Star subscription ». /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». /// Maximum number of results to return, see pagination @@ -5966,7 +6022,10 @@ namespace TL user_id = user_id, }); - /// See [bots: ✓] + /// Obtain a list of active, expired or cancelled Telegram Star subscriptions ». See [bots: ✓] + /// Whether to return only expired subscriptions due to an excessively low Telegram Star balance. + /// Always pass . + /// Offset for pagination, taken from payments.starsStatus. public static Task Payments_GetStarsSubscriptions(this Client client, InputPeer peer, string offset, bool missing_balance = false) => client.Invoke(new Payments_GetStarsSubscriptions { @@ -5975,7 +6034,10 @@ namespace TL offset = offset, }); - /// See [bots: ✓] + /// Activate or deactivate a Telegram Star subscription ». See [bots: ✓] + /// Always pass . + /// ID of the subscription. + /// Whether to cancel or reactivate the subscription. public static Task Payments_ChangeStarsSubscription(this Client client, InputPeer peer, string subscription_id, bool? canceled = default) => client.Invoke(new Payments_ChangeStarsSubscription { @@ -5985,7 +6047,9 @@ namespace TL canceled = canceled ?? default, }); - /// See [bots: ✓] + /// Re-join a private channel associated to an active Telegram Star subscription ». See [bots: ✓] + /// Always pass . + /// ID of the subscription. public static Task Payments_FulfillStarsSubscription(this Client client, InputPeer peer, string subscription_id) => client.Invoke(new Payments_FulfillStarsSubscription { @@ -6035,6 +6099,16 @@ namespace TL msg_id = msg_id, }); + /// See + public static Task Payments_BotCancelStarsSubscription(this Client client, InputUserBase user_id, string invoice_slug = null, string charge_id = null, bool restore = false) + => client.Invoke(new Payments_BotCancelStarsSubscription + { + flags = (Payments_BotCancelStarsSubscription.Flags)((invoice_slug != null ? 0x2 : 0) | (charge_id != null ? 0x4 : 0) | (restore ? 0x1 : 0)), + user_id = user_id, + invoice_slug = invoice_slug, + charge_id = charge_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -7098,6 +7172,7 @@ namespace TL /// Globally search for stories using a hashtag or a location media area, see here » for more info on the full flow. See Possible codes: 400 (details) /// Hashtag (without the #) /// A or a .
Note areas may be searched only if they have an associated address. + /// If set, returns only stories posted by this peer. /// Offset for pagination: initially an empty string, then the next_offset from the previously returned . /// Maximum number of results to return, see pagination public static Task Stories_SearchPosts(this Client client, string offset, int limit = int.MaxValue, string hashtag = null, MediaArea area = null, InputPeer peer = null) @@ -10334,6 +10409,7 @@ namespace TL.Methods from_bot_menu = 0x10, silent = 0x20, compact = 0x80, + fullscreen = 0x100, has_send_as = 0x2000, } } @@ -10374,6 +10450,7 @@ namespace TL.Methods has_url = 0x8, has_start_param = 0x10, compact = 0x80, + fullscreen = 0x100, } } @@ -10537,6 +10614,7 @@ namespace TL.Methods has_start_param = 0x2, has_theme_params = 0x4, compact = 0x80, + fullscreen = 0x100, } } @@ -10806,6 +10884,7 @@ namespace TL.Methods has_theme_params = 0x1, has_start_param = 0x2, compact = 0x80, + fullscreen = 0x100, } } @@ -10871,6 +10950,27 @@ namespace TL.Methods public InputPeer peer; } + [TLDef(0xF21F7F2F)] + public sealed partial class Messages_SavePreparedInlineMessage : IMethod + { + public Flags flags; + public InputBotInlineResultBase result; + public InputUserBase user_id; + [IfFlag(0)] public InlineQueryPeerType[] peer_types; + + [Flags] public enum Flags : uint + { + has_peer_types = 0x1, + } + } + + [TLDef(0x857EBDB8)] + public sealed partial class Messages_GetPreparedInlineMessage : IMethod + { + public InputUserBase bot; + public string id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -11887,6 +11987,28 @@ namespace TL.Methods public InputUserBase bot; } + [TLDef(0xED9F30C5)] + public sealed partial class Bots_UpdateUserEmojiStatus : IMethod + { + public InputUserBase user_id; + public EmojiStatus emoji_status; + } + + [TLDef(0x06DE6392)] + public sealed partial class Bots_ToggleUserEmojiStatusPermission : IMethod + { + public InputUserBase bot; + public bool enabled; + } + + [TLDef(0x50077589)] + public sealed partial class Bots_CheckDownloadFileParams : IMethod + { + public InputUserBase bot; + public string file_name; + public string url; + } + [TLDef(0x37148DBB)] public sealed partial class Payments_GetPaymentForm : IMethod { @@ -12182,6 +12304,22 @@ namespace TL.Methods public int msg_id; } + [TLDef(0x57F9ECE6)] + public sealed partial class Payments_BotCancelStarsSubscription : IMethod + { + public Flags flags; + public InputUserBase user_id; + [IfFlag(1)] public string invoice_slug; + [IfFlag(2)] public string charge_id; + + [Flags] public enum Flags : uint + { + restore = 0x1, + has_invoice_slug = 0x2, + has_charge_id = 0x4, + } + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9d070a3..ec40b3f 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 = 192; // fetched 31/10/2024 17:10:55 + public const int Version = 193; // fetched 18/11/2024 12:45:10 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -213,7 +213,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0x9BB3EF44] = typeof(MessageActionStarGift), + [0x08557637] = typeof(MessageActionStarGift), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -419,6 +419,7 @@ namespace TL [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x51CA7AEC] = typeof(UpdatePaidReactionPrivacy), + [0x2D13C6EE] = typeof(UpdateBotSubscriptionExpire), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -499,6 +500,8 @@ namespace TL [0xE94F0F86] = typeof(InputPrivacyValueDisallowChatParticipants), [0x2F453E49] = typeof(InputPrivacyValueAllowCloseFriends), [0x77CDC9F1] = typeof(InputPrivacyValueAllowPremium), + [0x5A4FCCE5] = typeof(InputPrivacyValueAllowBots), + [0xC4E57915] = typeof(InputPrivacyValueDisallowBots), [0xFFFE1BAC] = typeof(PrivacyValueAllowContacts), [0x65427B82] = typeof(PrivacyValueAllowAll), [0xB8905FB2] = typeof(PrivacyValueAllowUsers), @@ -509,6 +512,8 @@ namespace TL [0x41C87565] = typeof(PrivacyValueDisallowChatParticipants), [0xF7E8D89B] = typeof(PrivacyValueAllowCloseFriends), [0xECE9814B] = typeof(PrivacyValueAllowPremium), + [0x21461B5D] = typeof(PrivacyValueAllowBots), + [0xF6A5F82F] = typeof(PrivacyValueDisallowBots), [0x50A04E45] = typeof(Account_PrivacyRules), [0xB8D0AFDF] = typeof(AccountDaysTTL), [0x6C37C15C] = typeof(DocumentAttributeImageSize), @@ -556,7 +561,7 @@ namespace TL [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0x82437E74] = typeof(BotInfo), + [0x36607333] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -745,7 +750,7 @@ namespace TL [0xA44F3EF6] = typeof(PageBlockMap), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), - [0x5DB95A15] = typeof(Invoice), + [0x049EE584] = typeof(Invoice), [0xEA02C27E] = typeof(PaymentCharge), [0x1E8CAAEB] = typeof(PostAddress), [0x909C3F94] = typeof(PaymentRequestedInfo), @@ -1324,7 +1329,7 @@ namespace TL [0x23E91BA3] = typeof(BotPreviewMedia), [0x0CA71D64] = typeof(Bots_PreviewInfo), [0x05416D58] = typeof(StarsSubscriptionPricing), - [0x538ECF18] = typeof(StarsSubscription), + [0x2E6EAB1A] = typeof(StarsSubscription), [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), @@ -1337,6 +1342,9 @@ namespace TL [0xF0E4E0B6] = typeof(ReportResultChooseOption), [0x6F09AC31] = typeof(ReportResultAddComment), [0x8DB33C4B] = typeof(ReportResultReported), + [0x8ECF0511] = typeof(Messages_BotPreparedInlineMessage), + [0xFF57708D] = typeof(Messages_PreparedInlineMessage), + [0xC99B1950] = typeof(BotAppSettings), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ea47934..1d0caa1 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: 192 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 193 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From b40557f78c85a21c57135f3c2213225e7e2263ed Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 18 Nov 2024 14:40:01 +0100 Subject: [PATCH 259/336] API Layer 194: bot star subscriptions feedback --- .github/dev.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 10 ++++++++-- src/TL.SchemaFuncs.cs | 2 +- src/TL.Table.cs | 6 +++--- src/WTelegramClient.csproj | 2 +- 6 files changed, 15 insertions(+), 9 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 6a17968..37c0a0d 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.3-dev.$(Rev:r) +name: 4.2.4-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index 85dd472..e58f284 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-193-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-194-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 643ed25..45c704f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2332,7 +2332,7 @@ namespace TL public int score; } /// A user just sent a payment to me (a bot) See - [TLDef(0x8F31B327)] + [TLDef(0xFFA00CCC)] public sealed partial class MessageActionPaymentSentMe : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2349,6 +2349,7 @@ namespace TL [IfFlag(1)] public string shipping_option_id; /// Provider payment identifier public PaymentCharge charge; + [IfFlag(4)] public DateTime subscription_until_date; [Flags] public enum Flags : uint { @@ -2360,10 +2361,12 @@ namespace TL recurring_init = 0x4, /// Whether this payment is part of a recurring payment recurring_used = 0x8, + /// Field has a value + has_subscription_until_date = 0x10, } } /// A payment was sent See - [TLDef(0x96163F56)] + [TLDef(0xC624B16E)] public sealed partial class MessageActionPaymentSent : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2374,6 +2377,7 @@ namespace TL public long total_amount; /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » [IfFlag(0)] public string invoice_slug; + [IfFlag(4)] public DateTime subscription_until_date; [Flags] public enum Flags : uint { @@ -2383,6 +2387,8 @@ namespace TL recurring_init = 0x4, /// Whether this payment is part of a recurring payment recurring_used = 0x8, + /// Field has a value + has_subscription_until_date = 0x10, } } /// A phone call See diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ecb1986..662abf6 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -6025,7 +6025,7 @@ namespace TL /// Obtain a list of active, expired or cancelled Telegram Star subscriptions ». See [bots: ✓] /// Whether to return only expired subscriptions due to an excessively low Telegram Star balance. /// Always pass . - /// Offset for pagination, taken from payments.starsStatus. + /// Offset for pagination, taken from payments.starsStatus. public static Task Payments_GetStarsSubscriptions(this Client client, InputPeer peer, string offset, bool missing_balance = false) => client.Invoke(new Payments_GetStarsSubscriptions { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index ec40b3f..25ddcce 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 = 193; // fetched 18/11/2024 12:45:10 + public const int Version = 194; // fetched 18/11/2024 12:59:06 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -181,8 +181,8 @@ namespace TL [0x94BD38ED] = typeof(MessageActionPinMessage), [0x9FBAB604] = typeof(MessageActionHistoryClear), [0x92A72876] = typeof(MessageActionGameScore), - [0x8F31B327] = typeof(MessageActionPaymentSentMe), - [0x96163F56] = typeof(MessageActionPaymentSent), + [0xFFA00CCC] = typeof(MessageActionPaymentSentMe), + [0xC624B16E] = typeof(MessageActionPaymentSent), [0x80E11A7F] = typeof(MessageActionPhoneCall), [0x4792929B] = typeof(MessageActionScreenshotTaken), [0xFAE69F56] = typeof(MessageActionCustomAction), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1d0caa1..19eee24 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: 193 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 194 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From ddc0a3caef4747b40e292eb355766ec6497450c5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 20 Nov 2024 22:59:06 +0100 Subject: [PATCH 260/336] HtmlText/Markdown: support for collapsed Blockquote --- src/Services.cs | 39 +++++++++++++++++++++++++++------------ 1 file changed, 27 insertions(+), 12 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 9c9730b..4ef4379 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -126,9 +126,9 @@ namespace TL { var entities = new List(); MessageEntityBlockquote lastBlockQuote = null; - int inCode = 0; + int offset, inCode = 0; var sb = new StringBuilder(text); - for (int offset = 0; offset < sb.Length;) + for (offset = 0; offset < sb.Length;) { switch (sb[offset]) { @@ -176,13 +176,12 @@ namespace TL break; case '>' when inCode == 0 && offset == 0 || sb[offset - 1] == '\n': sb.Remove(offset, 1); - if (lastBlockQuote is null || lastBlockQuote.length < offset - lastBlockQuote.offset) + if (lastBlockQuote == null) entities.Add(lastBlockQuote = new MessageEntityBlockquote { offset = offset, length = -1 }); - else - lastBlockQuote.length = -1; break; - case '\n' when lastBlockQuote is { length: -1 }: - lastBlockQuote.length = ++offset - lastBlockQuote.offset; + case '\n' when lastBlockQuote != null: + if (offset + 1 >= sb.Length || sb[offset + 1] != '>') CloseBlockQuote(); + offset++; break; case '!' when inCode == 0 && offset + 1 < sb.Length && sb[offset + 1] == '[': sb.Remove(offset, 1); @@ -232,11 +231,21 @@ namespace TL entities.Add(new T { offset = offset, length = -1 }); } } - if (lastBlockQuote is { length: -1 }) - lastBlockQuote.length = sb.Length - lastBlockQuote.offset; + if (lastBlockQuote != null) CloseBlockQuote(); HtmlText.FixUps(sb, entities); text = sb.ToString(); return entities.Count == 0 ? null : [.. entities]; + + void CloseBlockQuote() + { + if (entities[^1] is MessageEntitySpoiler { length: -1 } mes && mes.offset == offset) + { + entities.RemoveAt(entities.Count - 1); + lastBlockQuote.flags = MessageEntityBlockquote.Flags.collapsed; + } + lastBlockQuote.length = offset - lastBlockQuote.offset; + lastBlockQuote = null; + } } /// Converts the (plain text + entities) format used by Telegram messages into a Markdown text @@ -261,7 +270,7 @@ namespace TL var md = closings[0].md; closings.RemoveAt(0); if (i > 0 && md[0] == '_' && sb[i - 1] == '_') md = '\r' + md; - if (md[0] == '>') { inBlockQuote = false; if (lastCh != '\n' && i < sb.Length && sb[i] != '\n') md = "\n"; else continue; } + if (md[0] == '>') { inBlockQuote = false; md = md[1..]; if (lastCh != '\n' && i < sb.Length && sb[i] != '\n') md += '\n'; } sb.Insert(i, md); i += md.Length; } if (i == sb.Length) break; @@ -283,8 +292,9 @@ namespace TL if (premium) closing.md = $"](tg://emoji?id={mecu.document_id})"; else continue; } - else if (md[0] == '>') - { inBlockQuote = true; if (lastCh is not '\n' and not '\0') md = "\n>"; } + else if (nextEntity is MessageEntityBlockquote mebq) + { inBlockQuote = true; if (lastCh is not '\n' and not '\0') md = "\n>"; + if (mebq.flags == MessageEntityBlockquote.Flags.collapsed) closing.md = ">||"; } else if (nextEntity is MessageEntityPre mep) md = $"```{mep.language}\n"; int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1)); @@ -396,6 +406,9 @@ namespace TL case "pre": ProcessEntity(); break; case "tg-emoji" when closing: ProcessEntity(); break; case "blockquote": ProcessEntity(); break; + case "blockquote expandable": + entities.Add(new MessageEntityBlockquote { offset = offset, length = -1, flags = MessageEntityBlockquote.Flags.collapsed }); + break; default: if (closing) { @@ -495,6 +508,8 @@ namespace TL closing.Item2 = ""; tag = $"
";
 						}
+						else if (nextEntity is MessageEntityBlockquote { flags: MessageEntityBlockquote.Flags.collapsed })
+							tag = "
"; else tag = $"<{tag}>"; int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1)); From ccad6f9f310ae05746daadea0e535bb74f7820dd Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 21 Nov 2024 17:08:08 +0100 Subject: [PATCH 261/336] Limit parallel transfers to 1 in HTTP mode --- src/Client.cs | 1 + 1 file changed, 1 insertion(+) diff --git a/src/Client.cs b/src/Client.cs index 28207cf..7c383ce 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -209,6 +209,7 @@ namespace WTelegram if (_tcpClient != null) throw new InvalidOperationException("Cannot switch to HTTP after TCP connection"); _httpClient = httpClient ?? new(); _httpWait = defaultHttpWait; + while (_parallelTransfers.CurrentCount > 1) _parallelTransfers.Wait(); } /// Disconnect from Telegram (shouldn't be needed in normal usage) From 48a1406acc6a69f8d70bd7596deec623aeff1eed Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Nov 2024 16:27:21 +0100 Subject: [PATCH 262/336] Raise OwnUpdates for Messages_InvitedUsers & Payments_PaymentResult --- src/Client.cs | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 7c383ce..08ed96b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -629,8 +629,7 @@ namespace WTelegram else { Helpers.Log(1, $" → {result?.GetType().Name,-37} #{(short)msgId.GetHashCode():X4}"); - if (OnOwnUpdates != null && result is UpdatesBase updates) - RaiseOwnUpdates(updates); + CheckRaiseOwnUpdates(result); } rpc.tcs.SetResult(result); @@ -654,8 +653,7 @@ namespace WTelegram else { result = reader.ReadTLObject(ctorNb); - if (OnOwnUpdates != null && result is UpdatesBase updates) - RaiseOwnUpdates(updates); + CheckRaiseOwnUpdates(result); } var typeName = result?.GetType().Name; @@ -806,6 +804,17 @@ namespace WTelegram } } + private void CheckRaiseOwnUpdates(object result) + { + if (OnOwnUpdates == null) return; + if (result is UpdatesBase updates) + RaiseOwnUpdates(updates); + else if (result is Payments_PaymentResult ppr) + RaiseOwnUpdates(ppr.updates); + else if (result is Messages_InvitedUsers miu) + RaiseOwnUpdates(miu.updates); + } + private async void RaiseOwnUpdates(UpdatesBase updates) { try From d42c211f30c8081e77e7ab4a2025a2d5744e864f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 22 Nov 2024 19:40:15 +0100 Subject: [PATCH 263/336] api doc --- src/TL.Schema.cs | 81 ++++++++++++++++++++++++++++++++++++------- src/TL.SchemaFuncs.cs | 24 +++++++++---- 2 files changed, 86 insertions(+), 19 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 45c704f..da2a3c6 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -480,6 +480,7 @@ namespace TL public long stars_amount; /// Photos or videos. public InputMedia[] extended_media; + /// Bots only, specifies a custom payload that will then be passed in when a payment is made (this field will not be visible to the user) [IfFlag(0)] public string payload; [Flags] public enum Flags : uint @@ -1090,7 +1091,7 @@ namespace TL [IfFlag(41)] public EmojiStatus emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
[IfFlag(42)] public int level; - /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. + /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -1855,6 +1856,7 @@ namespace TL has_effect = 0x4, /// Field has a value has_factcheck = 0x8, + /// The video contained in the message is currently being processed by the server (i.e. to generate alternative qualities, that will be contained in the final .alt_document), and will be sent once the video is processed, which will happen approximately at the specified date (i.e. messages with this flag set should be treated similarly to scheduled messages, but instead of the scheduled date, date contains the estimated conversion date). video_processing_pending = 0x10, } @@ -1985,6 +1987,7 @@ namespace TL public Flags flags; /// Attached document [IfFlag(0)] public DocumentBase document; + /// Videos only, contains alternative qualities of the video. [IfFlag(5)] public DocumentBase[] alt_documents; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2569,6 +2572,7 @@ namespace TL [IfFlag(0)] public string crypto_currency; /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. [IfFlag(0)] public long crypto_amount; + /// Message attached with the gift [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -2678,6 +2682,7 @@ namespace TL [IfFlag(3)] public string crypto_currency; /// If crypto_currency is set, contains the paid amount, in the smallest units of the cryptocurrency. [IfFlag(3)] public long crypto_amount; + /// Message attached with the gift [IfFlag(4)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -2800,7 +2805,9 @@ namespace TL public Flags flags; /// The number of Telegram Stars you won public long stars; + /// ID of the telegram star transaction. public string transaction_id; + /// Identifier of the peer that was automatically boosted by the winners of the giveaway. public Peer boost_peer; /// ID of the message containing the public int giveaway_msg_id; @@ -2810,22 +2817,28 @@ namespace TL unclaimed = 0x1, } } - /// See + /// You received a gift, see here » for more info. See [TLDef(0x08557637)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Info about the gift public StarGift gift; + /// Additional message from the sender of the gift [IfFlag(1)] public TextWithEntities message; + /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; [Flags] public enum Flags : uint { + /// If set, the name of the sender of the gift will be hidden if the destination user decides to display the gift on their profile name_hidden = 0x1, /// Field has a value has_message = 0x2, + /// Whether this gift was added to the destination user's profile (may be toggled using Payments_SaveStarGift and fetched using Payments_GetUserStarGifts) saved = 0x4, + ///
Whether this gift was converted to Telegram Stars and cannot be displayed on the profile anymore. converted = 0x8, /// Field has a value has_convert_stars = 0x10, @@ -3496,6 +3509,7 @@ namespace TL [IfFlag(38)] public long personal_channel_id; /// ID of the latest message of the associated personal channel », that should be previewed in the profile page. [IfFlag(38)] public int personal_channel_message; + /// Number of gifts the user has chosen to display on their profile [IfFlag(40)] public int stargifts_count; [Flags] public enum Flags : uint @@ -5622,17 +5636,20 @@ namespace TL /// New Telegram Star balance. public StarsRevenueStatus status; } - /// See + /// Bots only: a user has purchased a paid media. See [TLDef(0x283BD312)] public sealed partial class UpdateBotPurchasedPaidMedia : Update { + /// The user that bought the media public long user_id; + /// Payload passed by the bot in .payload public string payload; + /// New qts value, see updates » for more info. public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// Contains the current default paid reaction privacy, see here &raquo: for more info. See + /// Contains the current default paid reaction privacy, see here » for more info. See [TLDef(0x51CA7AEC)] public sealed partial class UpdatePaidReactionPrivacy : Update { @@ -7007,6 +7024,7 @@ namespace TL [IfFlag(2)] public int preload_prefix_size; /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; + /// Codec used for the video, i.e. "h264", "h265", or "av1" [IfFlag(5)] public string video_codec; [Flags] public enum Flags : uint @@ -7969,10 +7987,11 @@ namespace TL /// Button text public override string Text => text; } - /// See + /// Clipboard button: when clicked, the attached text must be copied to the clipboard. See [TLDef(0x75D2698E, inheritBefore = true)] public sealed partial class KeyboardButtonCopy : KeyboardButton { + /// The text that will be copied to the clipboard public string copy_text; } @@ -10719,14 +10738,18 @@ namespace TL /// Invoice public override Invoice Invoice => invoice; } - /// See + /// Represents a payment form for a gift, see here » for more info. See [TLDef(0xB425CFE1)] public sealed partial class Payments_PaymentFormStarGift : Payments_PaymentFormBase { + /// Form ID. public long form_id; + /// Invoice public Invoice invoice; + /// Form ID. public override long FormId => form_id; + /// Invoice public override Invoice Invoice => invoice; } @@ -15053,6 +15076,7 @@ namespace TL [IfFlag(1)] public MessageEntity[] entities; /// If set, contains a custom profile photo bubble that should be displayed for the sponsored message, like for messages sent in groups. [IfFlag(6)] public PhotoBase photo; + /// If set, contains some media. [IfFlag(14)] public MessageMedia media; /// If set, the sponsored message should use the message accent color » specified in color. [IfFlag(13)] public PeerColor color; @@ -15655,18 +15679,22 @@ namespace TL /// The invitation link of the Telegram Star subscription » public string hash; } - /// See + /// Used to buy a Telegram Star Gift, see here » for more info. See [TLDef(0x25D8C1D8)] public sealed partial class InputInvoiceStarGift : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the user that will receive the gift public InputUserBase user_id; + /// Identifier of the gift, from .id public long gift_id; + /// Optional message, attached with the gift [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint { + /// If set, your name will be hidden if the destination user decides to display the gift on their profile (they will still see that you sent the gift) hide_name = 0x1, /// Field has a value has_message = 0x2, @@ -15765,6 +15793,7 @@ namespace TL public string currency; /// Total price 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 amount; + /// Message attached with the gift [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -17489,6 +17518,7 @@ namespace TL public DateTime start_date; /// If we're one of the winners of this giveaway, contains the Premium gift code, see here » for more info on the full giveaway flow. [IfFlag(3)] public string gift_code_slug; + /// If we're one of the winners of this Telegram Star giveaway, the number Telegram Stars we won. [IfFlag(4)] public long stars_prize; /// End date of the giveaway. May be bigger than the end date specified in parameters of the giveaway. public DateTime finish_date; @@ -19130,7 +19160,9 @@ namespace TL [IfFlag(9)] public MessageMedia[] extended_media; /// The number of seconds between consecutive Telegram Star debiting for Telegram Star subscriptions ». [IfFlag(12)] public int subscription_period; + /// ID of the message containing the , for incoming star giveaway prizes. [IfFlag(13)] public int giveaway_post_id; + /// This transaction indicates a purchase or a sale (conversion back to Stars) of a gift ». [IfFlag(14)] public StarGift stargift; /// This transaction is payment for paid bot broadcasts.
Paid broadcasts are only allowed if the allow_paid_floodskip parameter of Messages_SendMessage and other message sending methods is set while trying to broadcast more than 30 messages per second to bot users.
The integer value returned by this flag indicates the number of billed API calls.
[IfFlag(15)] public int floodskip_number; @@ -19508,7 +19540,7 @@ namespace TL } } - /// See + /// Allowed options for the number of giveaway winners. See [TLDef(0x54236209)] public sealed partial class StarsGiveawayWinnersOption : IObject { @@ -19526,54 +19558,72 @@ namespace TL } } - /// See + /// Represents a star gift, see here » for more info. See [TLDef(0x49C577CD)] public sealed partial class StarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the gift public long id; + /// Sticker that represents the gift. public DocumentBase sticker; + /// Price of the gift in Telegram Stars. public long stars; + /// For limited-supply gifts: the remaining number of gifts that may be bought. [IfFlag(0)] public int availability_remains; + /// For limited-supply gifts: the total number of gifts that was available in the initial supply. [IfFlag(0)] public int availability_total; + /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
public long convert_stars; + /// For sold out gifts only: when was the gift first bought. [IfFlag(1)] public DateTime first_sale_date; + /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; [Flags] public enum Flags : uint { + /// Whether this is a limited-supply gift. limited = 0x1, + /// Whether this gift sold out and cannot be bought anymore. sold_out = 0x2, birthday = 0x4, } } - /// See + /// Available gifts ». See /// a value means payments.starGiftsNotModified [TLDef(0x901689EA)] public sealed partial class Payments_StarGifts : IObject { /// Hash used for caching, for more info click here public int hash; + /// List of available gifts. public StarGift[] gifts; } - /// See + /// Represents a gift, displayed on a user's profile page. See [TLDef(0xEEA49A6E)] public sealed partial class UserStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Sender of the gift (may be empty for anonymous senders; will always be set if this gift was sent to us). [IfFlag(1)] public long from_id; + /// When was this gift sent. public DateTime date; + /// The gift. public StarGift gift; + /// Message attached to the gift by the sender. [IfFlag(2)] public TextWithEntities message; + /// Only visible to the receiver of the gift, contains the ID of the with the in the chat with from_id. [IfFlag(3)] public int msg_id; + /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to the buying price of the gift only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; [Flags] public enum Flags : uint { + /// If set, from_id will not be visible to users (it will still be visible to the receiver of the gift). name_hidden = 0x1, /// Field has a value has_from_id = 0x2, @@ -19583,19 +19633,24 @@ namespace TL has_msg_id = 0x8, /// Field has a value has_convert_stars = 0x10, + /// If set, indicates this is a gift sent by from_id, received by the current user and currently hidden from our profile page. unsaved = 0x20, } } - ///
See + /// Gifts displayed on a user's profile. See [TLDef(0x6B65B517)] public sealed partial class Payments_UserStarGifts : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of gifts displayed on the profile. public int count; + /// The gifts. public UserStarGift[] gifts; + /// Offset for pagination. [IfFlag(0)] public string next_offset; + /// Users mentioned in the gifts vector. public Dictionary users; [Flags] public enum Flags : uint @@ -19615,7 +19670,7 @@ namespace TL public byte[] option; } - /// See Derived classes: , , + /// Represents a report menu or result See Derived classes: , , public abstract partial class ReportResult : IObject { } /// The user must choose one of the following options, and then Messages_Report must be re-invoked, passing the option's option identifier to Messages_Report.option. See [TLDef(0xF0E4E0B6)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 662abf6..d8a7e54 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1962,6 +1962,7 @@ namespace TL /// Report a message in a chat for violation of telegram's Terms of Service See Possible codes: 400 (details) /// Peer /// IDs of messages to report + /// Menu option, intially empty /// Comment for report moderation public static Task Messages_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Messages_Report @@ -4347,7 +4348,7 @@ namespace TL private_ = private_, }); - /// Fetches an update with the current default paid reaction privacy, see here &raquo: for more info. See [bots: ✓] + /// Fetches an update with the current default paid reaction privacy, see here » for more info. See [bots: ✓] public static Task Messages_GetPaidReactionPrivacy(this Client client) => client.Invoke(new Messages_GetPaidReactionPrivacy { @@ -6057,13 +6058,13 @@ namespace TL subscription_id = subscription_id, }); - /// See [bots: ✓] + /// Fetch a list of star giveaway options ». See [bots: ✓] public static Task Payments_GetStarsGiveawayOptions(this Client client) => client.Invoke(new Payments_GetStarsGiveawayOptions { }); - /// See [bots: ✓] + /// Get a list of available gifts, see here » for more info. See [bots: ✓] /// Hash used for caching, for more info click here. /// a null value means payments.starGiftsNotModified public static Task Payments_GetStarGifts(this Client client, int hash = default) @@ -6072,7 +6073,9 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Get the gifts » pinned on a specific user's profile. See [bots: ✓] + /// Identifier of the user (can be the current user to fetch all gifts received by the current user). + /// Offset for pagination, taken from (initially empty). /// Maximum number of results to return, see pagination public static Task Payments_GetUserStarGifts(this Client client, InputUserBase user_id, string offset, int limit = int.MaxValue) => client.Invoke(new Payments_GetUserStarGifts @@ -6082,7 +6085,10 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// Display or remove a received gift » from our profile. See [bots: ✓] + /// If set, hides the gift from our profile. + /// ID of the user that sent us the gift. + /// The ID of the with the . public static Task Payments_SaveStarGift(this Client client, InputUserBase user_id, int msg_id, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { @@ -6091,7 +6097,9 @@ namespace TL msg_id = msg_id, }); - /// See [bots: ✓] + /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See [bots: ✓] + /// ID of the user that sent us the gift. + /// The ID of the with the . public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) => client.Invoke(new Payments_ConvertStarGift { @@ -6739,6 +6747,7 @@ namespace TL /// Get channel ad revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors + /// Get ad revenue stats for the specified channel or bot public static Task Stats_GetBroadcastRevenueStats(this Client client, InputPeer peer, bool dark = false) => client.Invoke(new Stats_GetBroadcastRevenueStats { @@ -6747,6 +6756,7 @@ namespace TL }); /// Withdraw funds from a channel's ad revenue balance ». See Possible codes: 400 (details) + /// Get ad revenue withdrawal URL for the specified channel or bot /// 2FA password, see here » for more info. public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password) => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl @@ -6756,6 +6766,7 @@ namespace TL }); /// Fetch channel ad revenue transaction history ». See Possible codes: 400 (details) + /// Get ad revenue transactions for the specified channel or bot /// Offset for pagination /// Maximum number of results to return, see pagination public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputPeer peer, int offset = default, int limit = int.MaxValue) @@ -7070,6 +7081,7 @@ namespace TL /// Report a story. See Possible codes: 400 (details) /// The peer that uploaded the story. /// IDs of the stories to report. + /// Menu option, intially empty /// Comment for report moderation public static Task Stories_Report(this Client client, InputPeer peer, int[] id, byte[] option, string message) => client.Invoke(new Stories_Report From 2451068a71444997fb98171e99a9cdd4f7007c7c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 4 Dec 2024 20:10:05 +0100 Subject: [PATCH 264/336] API Layer 195: searchStickers, Bot API 8.1 (star referral program) --- .github/dev.yml | 2 +- README.md | 2 +- src/Client.cs | 1 + src/TL.Schema.cs | 145 ++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 195 ++++++++++++++++++++++++++++++++++--- src/TL.Table.cs | 20 ++-- src/WTelegramClient.csproj | 2 +- 7 files changed, 323 insertions(+), 44 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 37c0a0d..7df51bd 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.4-dev.$(Rev:r) +name: 4.2.5-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index e58f284..bc6ba13 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-194-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-195-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/Client.cs b/src/Client.cs index 08ed96b..fead981 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1642,6 +1642,7 @@ namespace WTelegram await ConnectAsync(); } + [EditorBrowsable(EditorBrowsableState.Never)] public async Task InvokeAffected(IMethod query, long peerId) where T : Messages_AffectedMessages { var result = await Invoke(query); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index da2a3c6..cb0d452 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -3448,7 +3448,7 @@ namespace TL } /// Extended user info See - [TLDef(0x1F58E369)] + [TLDef(0x979D2376)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3511,6 +3511,7 @@ namespace TL [IfFlag(38)] public int personal_channel_message; /// Number of gifts the user has chosen to display on their profile [IfFlag(40)] public int stargifts_count; + [IfFlag(43)] public StarRefProgram starref_program; [Flags] public enum Flags : uint { @@ -3595,6 +3596,8 @@ namespace TL /// If set, this user can view ad revenue statistics » for this bot. can_view_revenue = 0x200, bot_can_manage_emoji_status = 0x400, + /// Field has a value + has_starref_program = 0x800, } } @@ -5592,11 +5595,11 @@ namespace TL public BroadcastRevenueBalances balances; } /// The current account's Telegram Stars balance » has changed. See - [TLDef(0x0FB85198)] + [TLDef(0x4E80A379)] public sealed partial class UpdateStarsBalance : Update { /// New balance. - public long balance; + public StarsAmount balance; } /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] @@ -5656,18 +5659,6 @@ namespace TL /// Whether paid reaction privacy is enabled or disabled. public bool private_; } - /// See - [TLDef(0x2D13C6EE)] - public sealed partial class UpdateBotSubscriptionExpire : Update - { - public long user_id; - public string payload; - public string invoice_slug; - public DateTime until_date; - public int qts; - - public override (long, int, int) GetMBox() => (-1, qts, 1); - } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -19129,7 +19120,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0x35D4F276)] + [TLDef(0x64DFC926)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19137,7 +19128,7 @@ namespace TL /// Transaction ID. public string id; /// Amount of Stars (negative for outgoing transactions). - public long stars; + public StarsAmount stars; /// Date of the transaction (unixtime). public DateTime date; /// Source of the incoming transaction, or its recipient for outgoing transactions. @@ -19166,6 +19157,9 @@ namespace TL [IfFlag(14)] public StarGift stargift; /// This transaction is payment for paid bot broadcasts.
Paid broadcasts are only allowed if the allow_paid_floodskip parameter of Messages_SendMessage and other message sending methods is set while trying to broadcast more than 30 messages per second to bot users.
The integer value returned by this flag indicates the number of billed API calls.
[IfFlag(15)] public int floodskip_number; + [IfFlag(16)] public int starref_commission_permille; + [IfFlag(17)] public Peer starref_peer; + [IfFlag(17)] public StarsAmount starref_amount; [Flags] public enum Flags : uint { @@ -19201,17 +19195,21 @@ namespace TL has_stargift = 0x4000, /// Field has a value has_floodskip_number = 0x8000, + /// Field has a value + has_starref_commission_permille = 0x10000, + /// Fields and have a value + has_starref_peer = 0x20000, } } /// Info about the current Telegram Star subscriptions, balance and transaction history ». See - [TLDef(0xBBFA316C)] + [TLDef(0x6C9CE8ED)] public sealed partial class Payments_StarsStatus : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current Telegram Star balance. - public long balance; + public StarsAmount balance; /// Info about current Telegram Star subscriptions, only returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(1)] public StarsSubscription[] subscriptions; /// Offset for pagination of subscriptions: only usable with Payments_GetStarsSubscriptions, returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. @@ -19307,17 +19305,17 @@ namespace TL } /// Describes Telegram Star revenue balances ». See - [TLDef(0x79342946)] + [TLDef(0xFEBE5491)] public sealed partial class StarsRevenueStatus : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of not-yet-withdrawn Telegram Stars. - public long current_balance; + public StarsAmount current_balance; /// Amount of withdrawable Telegram Stars. - public long available_balance; + public StarsAmount available_balance; /// Total amount of earned Telegram Stars. - public long overall_revenue; + public StarsAmount overall_revenue; /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. [IfFlag(1)] public int next_withdrawal_at; @@ -19739,4 +19737,105 @@ namespace TL has_header_dark_color = 0x10, } } + + /// See + [TLDef(0xDD0C66F2)] + public sealed partial class StarRefProgram : IObject + { + public Flags flags; + public long bot_id; + public int commission_permille; + [IfFlag(0)] public int duration_months; + [IfFlag(1)] public DateTime end_date; + [IfFlag(2)] public StarsAmount daily_revenue_per_user; + + [Flags] public enum Flags : uint + { + has_duration_months = 0x1, + has_end_date = 0x2, + has_daily_revenue_per_user = 0x4, + } + } + + /// See + [TLDef(0x19A13F71)] + public sealed partial class ConnectedBotStarRef : IObject + { + public Flags flags; + public string url; + public DateTime date; + public long bot_id; + public int commission_permille; + [IfFlag(0)] public int duration_months; + public long participants; + public long revenue; + + [Flags] public enum Flags : uint + { + has_duration_months = 0x1, + revoked = 0x2, + } + } + + /// See + [TLDef(0x98D5EA1D)] + public sealed partial class Payments_ConnectedStarRefBots : IObject + { + public int count; + public ConnectedBotStarRef[] connected_bots; + public Dictionary users; + } + + /// See + [TLDef(0xB4D5D859)] + public sealed partial class Payments_SuggestedStarRefBots : IObject + { + public Flags flags; + public int count; + public StarRefProgram[] suggested_bots; + public Dictionary users; + [IfFlag(0)] public string next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + + /// See + [TLDef(0xBBB6B4A3)] + public sealed partial class StarsAmount : IObject + { + public long amount; + public int nanos; + } + + /// See + public abstract partial class Messages_FoundStickersBase : IObject { } + /// See + [TLDef(0x6010C534)] + public sealed partial class Messages_FoundStickersNotModified : Messages_FoundStickersBase + { + public Flags flags; + [IfFlag(0)] public int next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } + /// See + [TLDef(0x82C9E290)] + public sealed partial class Messages_FoundStickers : Messages_FoundStickersBase + { + public Flags flags; + [IfFlag(0)] public int next_offset; + public long hash; + public DocumentBase[] stickers; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index d8a7e54..403a62a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1542,10 +1542,12 @@ namespace TL /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) /// @username to resolve - public static Task Contacts_ResolveUsername(this Client client, string username) + public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) => client.Invoke(new Contacts_ResolveUsername { + flags = (Contacts_ResolveUsername.Flags)(referer != null ? 0x1 : 0), username = username, + referer = referer, }); /// Get most used peers See Possible codes: 400 (details) @@ -4364,7 +4366,9 @@ namespace TL random_id = random_id, }); - /// Informs the server that the user has either: See [bots: ✓] + /// Informs the server that the user has interacted with a sponsored message in one of the ways listed here ». See [bots: ✓] + /// 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) @@ -4414,6 +4418,19 @@ namespace TL id = id, }); + /// See + public static Task Messages_SearchStickers(this Client client, string q, string emoticon, string[] lang_code, int offset = default, int limit = int.MaxValue, long hash = default, bool emojis = false) + => client.Invoke(new Messages_SearchStickers + { + flags = (Messages_SearchStickers.Flags)(emojis ? 0x1 : 0), + q = q, + emoticon = emoticon, + lang_code = lang_code, + offset = offset, + limit = limit, + hash = hash, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5764,6 +5781,22 @@ namespace TL url = url, }); + /// See + public static Task Bots_GetAdminedBots(this Client client) + => client.Invoke(new Bots_GetAdminedBots + { + }); + + /// See + public static Task Bots_UpdateStarRefProgram(this Client client, InputUserBase bot, int commission_permille, int? duration_months = null) + => client.Invoke(new Bots_UpdateStarRefProgram + { + flags = (Bots_UpdateStarRefProgram.Flags)(duration_months != null ? 0x1 : 0), + bot = bot, + commission_permille = commission_permille, + duration_months = duration_months ?? default, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// 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 @@ -6108,15 +6141,60 @@ namespace TL }); /// See - public static Task Payments_BotCancelStarsSubscription(this Client client, InputUserBase user_id, string invoice_slug = null, string charge_id = null, bool restore = false) + public static Task Payments_BotCancelStarsSubscription(this Client client, InputUserBase user_id, string charge_id, bool restore = false) => client.Invoke(new Payments_BotCancelStarsSubscription { - flags = (Payments_BotCancelStarsSubscription.Flags)((invoice_slug != null ? 0x2 : 0) | (charge_id != null ? 0x4 : 0) | (restore ? 0x1 : 0)), + flags = (Payments_BotCancelStarsSubscription.Flags)(restore ? 0x1 : 0), user_id = user_id, - invoice_slug = invoice_slug, charge_id = charge_id, }); + /// See + public static Task Payments_GetConnectedStarRefBots(this Client client, InputPeer peer, int limit = int.MaxValue, DateTime? offset_date = null, string offset_link = null) + => client.Invoke(new Payments_GetConnectedStarRefBots + { + flags = (Payments_GetConnectedStarRefBots.Flags)((offset_date != null ? 0x4 : 0) | (offset_link != null ? 0x4 : 0)), + peer = peer, + offset_date = offset_date ?? default, + offset_link = offset_link, + limit = limit, + }); + + /// See + public static Task Payments_GetConnectedStarRefBot(this Client client, InputPeer peer, InputUserBase bot) + => client.Invoke(new Payments_GetConnectedStarRefBot + { + peer = peer, + bot = bot, + }); + + /// See + public static Task Payments_GetSuggestedStarRefBots(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool order_by_revenue = false, bool order_by_date = false) + => client.Invoke(new Payments_GetSuggestedStarRefBots + { + flags = (Payments_GetSuggestedStarRefBots.Flags)((order_by_revenue ? 0x1 : 0) | (order_by_date ? 0x2 : 0)), + peer = peer, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_ConnectStarRefBot(this Client client, InputPeer peer, InputUserBase bot) + => client.Invoke(new Payments_ConnectStarRefBot + { + peer = peer, + bot = bot, + }); + + /// See + public static Task Payments_EditConnectedStarRefBot(this Client client, InputPeer peer, string link, bool revoked = false) + => client.Invoke(new Payments_EditConnectedStarRefBot + { + flags = (Payments_EditConnectedStarRefBot.Flags)(revoked ? 0x1 : 0), + peer = peer, + link = link, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8528,10 +8606,17 @@ namespace TL.Methods public int limit; } - [TLDef(0xF93CCBA3)] + [TLDef(0x725AFBBC)] public sealed partial class Contacts_ResolveUsername : IMethod { + public Flags flags; public string username; + [IfFlag(0)] public string referer; + + [Flags] public enum Flags : uint + { + has_referer = 0x1, + } } [TLDef(0x973478B6)] @@ -10983,6 +11068,23 @@ namespace TL.Methods public string id; } + [TLDef(0x29B1C66A)] + public sealed partial class Messages_SearchStickers : IMethod + { + public Flags flags; + public string q; + public string emoticon; + public string[] lang_code; + public int offset; + public int limit; + public long hash; + + [Flags] public enum Flags : uint + { + emojis = 0x1, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12021,6 +12123,23 @@ namespace TL.Methods public string url; } + [TLDef(0xB0711D83)] + public sealed partial class Bots_GetAdminedBots : IMethod { } + + [TLDef(0x778B5AB3)] + public sealed partial class Bots_UpdateStarRefProgram : IMethod + { + public Flags flags; + public InputUserBase bot; + public int commission_permille; + [IfFlag(0)] public int duration_months; + + [Flags] public enum Flags : uint + { + has_duration_months = 0x1, + } + } + [TLDef(0x37148DBB)] public sealed partial class Payments_GetPaymentForm : IMethod { @@ -12316,19 +12435,73 @@ namespace TL.Methods public int msg_id; } - [TLDef(0x57F9ECE6)] + [TLDef(0x6DFA0622)] public sealed partial class Payments_BotCancelStarsSubscription : IMethod { public Flags flags; public InputUserBase user_id; - [IfFlag(1)] public string invoice_slug; - [IfFlag(2)] public string charge_id; + public string charge_id; [Flags] public enum Flags : uint { restore = 0x1, - has_invoice_slug = 0x2, - has_charge_id = 0x4, + } + } + + [TLDef(0x5869A553)] + public sealed partial class Payments_GetConnectedStarRefBots : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(2)] public DateTime offset_date; + [IfFlag(2)] public string offset_link; + public int limit; + + [Flags] public enum Flags : uint + { + has_offset_date = 0x4, + } + } + + [TLDef(0xB7D998F0)] + public sealed partial class Payments_GetConnectedStarRefBot : IMethod + { + public InputPeer peer; + public InputUserBase bot; + } + + [TLDef(0x0D6B48F7)] + public sealed partial class Payments_GetSuggestedStarRefBots : IMethod + { + public Flags flags; + public InputPeer peer; + public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + order_by_revenue = 0x1, + order_by_date = 0x2, + } + } + + [TLDef(0x7ED5348A)] + public sealed partial class Payments_ConnectStarRefBot : IMethod + { + public InputPeer peer; + public InputUserBase bot; + } + + [TLDef(0xE4FCA4A3)] + public sealed partial class Payments_EditConnectedStarRefBot : IMethod + { + public Flags flags; + public InputPeer peer; + public string link; + + [Flags] public enum Flags : uint + { + revoked = 0x1, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 25ddcce..1d9e4b9 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 = 194; // fetched 18/11/2024 12:59:06 + public const int Version = 195; // fetched 04/12/2024 17:50:39 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -241,7 +241,7 @@ namespace TL [0xACD66C5E] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x1F58E369] = typeof(UserFull), + [0x979D2376] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -414,12 +414,11 @@ namespace TL [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), - [0x0FB85198] = typeof(UpdateStarsBalance), + [0x4E80A379] = typeof(UpdateStarsBalance), [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x51CA7AEC] = typeof(UpdatePaidReactionPrivacy), - [0x2D13C6EE] = typeof(UpdateBotSubscriptionExpire), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1314,12 +1313,12 @@ namespace TL [0x60682812] = typeof(StarsTransactionPeerAds), [0xF9677AAD] = typeof(StarsTransactionPeerAPI), [0x0BD915C0] = typeof(StarsTopupOption), - [0x35D4F276] = typeof(StarsTransaction), - [0xBBFA316C] = typeof(Payments_StarsStatus), + [0x64DFC926] = typeof(StarsTransaction), + [0x6C9CE8ED] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), [0xDE4C5D93] = typeof(GeoPointAddress), - [0x79342946] = typeof(StarsRevenueStatus), + [0xFEBE5491] = typeof(StarsRevenueStatus), [0xC92BB73B] = typeof(Payments_StarsRevenueStats), [0x1DAB80B7] = typeof(Payments_StarsRevenueWithdrawalUrl), [0x394E7F21] = typeof(Payments_StarsRevenueAdsAccountUrl), @@ -1345,6 +1344,13 @@ namespace TL [0x8ECF0511] = typeof(Messages_BotPreparedInlineMessage), [0xFF57708D] = typeof(Messages_PreparedInlineMessage), [0xC99B1950] = typeof(BotAppSettings), + [0xDD0C66F2] = typeof(StarRefProgram), + [0x19A13F71] = typeof(ConnectedBotStarRef), + [0x98D5EA1D] = typeof(Payments_ConnectedStarRefBots), + [0xB4D5D859] = typeof(Payments_SuggestedStarRefBots), + [0xBBB6B4A3] = typeof(StarsAmount), + [0x6010C534] = typeof(Messages_FoundStickersNotModified), + [0x82C9E290] = typeof(Messages_FoundStickers), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 19eee24..9ddd748 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: 194 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 195 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From d8f7304067505e6d55099ca5fd1de1b5911ab3e3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:20:16 +0100 Subject: [PATCH 265/336] Fix broken SendAlbumAsync+InputMediaDocumentExternal --- .github/dev.yml | 2 +- src/Client.Helpers.cs | 1 - 2 files changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index 7df51bd..ef0d405 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.5-dev.$(Rev:r) +name: 4.2.6-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index e1c03af..69d3b22 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -237,7 +237,6 @@ namespace WTelegram } catch (RpcException) { } string mimeType = null; - ism.media = (await this.Messages_UploadMedia(peer, ism.media)).ToInputMedia(); inputFile = await UploadFromUrl(imde.url); if (videoUrlAsFile || mimeType?.StartsWith("video/") != true) ism.media = new InputMediaUploadedDocument(inputFile, mimeType); From b5aea68f6604b8e6ec0f73e1fba70ec1215792a5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:27:45 +0100 Subject: [PATCH 266/336] api doc --- src/TL.Schema.cs | 132 +++++++++++++++++++++++++++++++--------- src/TL.SchemaFuncs.cs | 138 ++++++++++++++++++++++++++++-------------- src/TL.Secret.cs | 16 ----- 3 files changed, 196 insertions(+), 90 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index cb0d452..aed4861 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1856,7 +1856,7 @@ namespace TL has_effect = 0x4, /// Field has a value has_factcheck = 0x8, - /// The video contained in the message is currently being processed by the server (i.e. to generate alternative qualities, that will be contained in the final .alt_document), and will be sent once the video is processed, which will happen approximately at the specified date (i.e. messages with this flag set should be treated similarly to scheduled messages, but instead of the scheduled date, date contains the estimated conversion date). + /// The video contained in the message is currently being processed by the server (i.e. to generate alternative qualities, that will be contained in the final .alt_document), and will be sent once the video is processed, which will happen approximately at the specified date (i.e. messages with this flag set should be treated similarly to scheduled messages, but instead of the scheduled date, date contains the estimated conversion date).
See here » for more info.
video_processing_pending = 0x10, } @@ -2352,6 +2352,7 @@ namespace TL [IfFlag(1)] public string shipping_option_id; /// Provider payment identifier public PaymentCharge charge; + /// Expiration date of the Telegram Star subscription ». [IfFlag(4)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -2380,6 +2381,7 @@ namespace TL public long total_amount; /// An invoice slug taken from an invoice deep link or from the premium_invoice_slug app config parameter » [IfFlag(0)] public string invoice_slug; + /// Expiration date of the Telegram Star subscription ». [IfFlag(4)] public DateTime subscription_until_date; [Flags] public enum Flags : uint @@ -2814,6 +2816,7 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, this indicates the reverse transaction that refunds the remaining stars to the creator of a giveaway if, when the giveaway ends, the number of members in the channel is smaller than the number of winners in the giveaway. unclaimed = 0x1, } } @@ -3511,6 +3514,7 @@ namespace TL [IfFlag(38)] public int personal_channel_message; /// Number of gifts the user has chosen to display on their profile [IfFlag(40)] public int stargifts_count; + /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; [Flags] public enum Flags : uint @@ -3595,6 +3599,7 @@ namespace TL has_stargifts_count = 0x100, /// If set, this user can view ad revenue statistics » for this bot. can_view_revenue = 0x200, + /// If set, this is a bot that can change our emoji status » bot_can_manage_emoji_status = 0x400, /// Field has a value has_starref_program = 0x800, @@ -4751,7 +4756,7 @@ namespace TL /// Message public MessageBase message; } - /// Some scheduled messages were deleted from the schedule queue of a chat See + /// Some scheduled messages were deleted (or sent) from the schedule queue of a chat See [TLDef(0xF2A71983)] public sealed partial class UpdateDeleteScheduledMessages : Update { @@ -4761,6 +4766,7 @@ namespace TL public Peer peer; /// Deleted scheduled messages public int[] messages; + /// If set, this update indicates that some scheduled messages were sent (not simply deleted from the schedule queue).
In this case, the messages field will contain the scheduled message IDs for the sent messages (initially returned in ), and sent_messages will contain the real message IDs for the sent messages.
[IfFlag(0)] public int[] sent_messages; [Flags] public enum Flags : uint @@ -6799,7 +6805,7 @@ namespace TL About = 0x3823CC40, ///Whether the user can see our birthday. Birthday = 0xD65A11CC, - ///
See + ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0xE1732341, } @@ -6828,11 +6834,11 @@ namespace TL About = 0xA486B761, ///Whether the user can see our birthday. Birthday = 0x2000A518, - ///See + ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0x2CA4FDF8, } - /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , + /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , , , public abstract partial class InputPrivacyRule : IObject { } /// Allow only contacts See [TLDef(0x0D09E07B)] @@ -6880,14 +6886,14 @@ namespace TL /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0x77CDC9F1)] public sealed partial class InputPrivacyValueAllowPremium : InputPrivacyRule { } - /// See + /// Allow bots and mini apps See [TLDef(0x5A4FCCE5)] public sealed partial class InputPrivacyValueAllowBots : InputPrivacyRule { } - /// See + /// Disallow bots and mini apps See [TLDef(0xC4E57915)] public sealed partial class InputPrivacyValueDisallowBots : InputPrivacyRule { } - /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , , + /// Privacy rules together with privacy keys indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See Derived classes: , , , , , , , , , , , public abstract partial class PrivacyRule : IObject { } /// Allow all contacts See [TLDef(0xFFFE1BAC)] @@ -6935,10 +6941,10 @@ namespace TL /// Allow only users with a Premium subscription », currently only usable for . See [TLDef(0xECE9814B)] public sealed partial class PrivacyValueAllowPremium : PrivacyRule { } - /// See + /// Allow bots and mini apps See [TLDef(0x21461B5D)] public sealed partial class PrivacyValueAllowBots : PrivacyRule { } - /// See + /// Disallow bots and mini apps See [TLDef(0xF6A5F82F)] public sealed partial class PrivacyValueDisallowBots : PrivacyRule { } @@ -7201,7 +7207,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. Can be: article, photo, audio, video, document, profile, app, or something else, see here » for a full list. + /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7731,6 +7737,7 @@ namespace TL [IfFlag(3)] public BotMenuButtonBase menu_button; /// The HTTP link to the privacy policy of the bot. If not set, then the /privacy command must be used, if supported by the bot (i.e. if it's present in the commands vector). If it isn't supported, then https://telegram.org/privacy-tpa must be opened, instead. [IfFlag(7)] public string privacy_policy_url; + /// Mini app » settings
[IfFlag(8)] public BotAppSettings app_settings; [Flags] public enum Flags : uint @@ -10391,6 +10398,7 @@ namespace TL [IfFlag(8)] public long[] suggested_tip_amounts; /// Terms of service URL [IfFlag(10)] public string terms_url; + /// The number of seconds between consecutive Telegram Star debiting for bot subscription invoices [IfFlag(11)] public int subscription_period; [Flags] public enum Flags : uint @@ -11924,7 +11932,9 @@ namespace TL [TLDef(0x64642DB3)] public sealed partial class ChannelAdminLogEventActionParticipantSubExtend : ChannelAdminLogEventAction { + /// Same as new_participant. public ChannelParticipantBase prev_participant; + /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } @@ -13580,7 +13590,7 @@ namespace TL { /// Platform identifier (ios, android, wp, all, etc.), can be concatenated with a dash as separator (android-ios, ios-wp, etc) public string platform; - /// Restriction reason (porno, terms, etc.) + /// Restriction reason (porno, terms, etc.). Ignore this restriction reason if it is contained in the ignore_restriction_reasons » client configuration parameter. public string reason; /// Error message to be shown to the user public string text; @@ -15533,6 +15543,7 @@ namespace TL has_query_id = 0x1, /// If set, the app must be opened in fullsize mode instead of compact mode. fullsize = 0x2, + /// If set, the app must be opened in fullscreen fullscreen = 0x4, } } @@ -15680,7 +15691,7 @@ namespace TL public InputUserBase user_id; /// Identifier of the gift, from .id public long gift_id; - /// Optional message, attached with the gift + /// Optional message, attached with the gift.
The maximum length for this field is specified in the stargifts_message_length_max client configuration value ».
[IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -17609,6 +17620,7 @@ namespace TL [IfFlag(4)] public string used_gift_slug; /// If set, this boost counts as multiplier boosts, otherwise it counts as a single boost. [IfFlag(5)] public int multiplier; + /// Number of Telegram Stars distributed among the winners of the giveaway. [IfFlag(6)] public long stars; [Flags] public enum Flags : uint @@ -19157,8 +19169,11 @@ namespace TL [IfFlag(14)] public StarGift stargift; /// This transaction is payment for paid bot broadcasts.
Paid broadcasts are only allowed if the allow_paid_floodskip parameter of Messages_SendMessage and other message sending methods is set while trying to broadcast more than 30 messages per second to bot users.
The integer value returned by this flag indicates the number of billed API calls.
[IfFlag(15)] public int floodskip_number; + /// This transaction is the receival (or refund) of an affiliate commission (i.e. this is the transaction received by the peer that created the referral link, flag 17 is for transactions made by users that imported the referral link). [IfFlag(16)] public int starref_commission_permille; + /// For transactions made by referred users, the peer that received the affiliate commission. [IfFlag(17)] public Peer starref_peer; + /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. [IfFlag(17)] public StarsAmount starref_amount; [Flags] public enum Flags : uint @@ -19212,7 +19227,7 @@ namespace TL public StarsAmount balance; /// Info about current Telegram Star subscriptions, only returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(1)] public StarsSubscription[] subscriptions; - /// Offset for pagination of subscriptions: only usable with Payments_GetStarsSubscriptions, returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. + /// Offset for pagination of subscriptions: only usable and returned when invoking Payments_GetStarsSubscriptions. [IfFlag(2)] public string subscriptions_next_offset; /// The number of Telegram Stars the user should buy to be able to extend expired subscriptions soon (i.e. the current balance is not enough to extend all expired subscriptions). [IfFlag(4)] public long subscriptions_missing_balance; @@ -19321,7 +19336,7 @@ namespace TL [Flags] public enum Flags : uint { - /// If set, the user may withdraw up to available_balance stars. + /// If set, the user may withdraw up to available_balance stars. withdrawal_enabled = 0x1, /// Field has a value has_next_withdrawal_at = 0x2, @@ -19340,11 +19355,11 @@ namespace TL public double usd_rate; } - /// Contains the URL to use to withdraw Telegram Star revenue. See + /// Contains the URL to use to withdraw Telegram Star revenue. See [TLDef(0x1DAB80B7)] public sealed partial class Payments_StarsRevenueWithdrawalUrl : IObject { - /// Contains the URL to use to withdraw Telegram Star revenue. + /// Contains the URL to use to withdraw Telegram Star revenue. public string url; } @@ -19460,8 +19475,11 @@ namespace TL public StarsSubscriptionPricing pricing; /// Invitation link, used to renew the subscription after cancellation or expiration. [IfFlag(3)] public string chat_invite_hash; + /// For bot subscriptions, the title of the subscription invoice [IfFlag(4)] public string title; + /// For bot subscriptions, the photo from the subscription invoice [IfFlag(5)] public WebDocumentBase photo; + /// For bot subscriptions, the identifier of the subscription invoice [IfFlag(6)] public string invoice_slug; [Flags] public enum Flags : uint @@ -19480,6 +19498,7 @@ namespace TL has_photo = 0x20, /// Field has a value has_invoice_slug = 0x40, + /// Set if this bot subscription was cancelled by the bot bot_canceled = 0x80, } } @@ -19585,6 +19604,7 @@ namespace TL limited = 0x1, /// Whether this gift sold out and cannot be bought anymore. sold_out = 0x2, + /// Whether this is a birthday-themed gift birthday = 0x4, } } @@ -19698,143 +19718,199 @@ namespace TL [TLDef(0x8DB33C4B)] public sealed partial class ReportResultReported : ReportResult { } - /// See + /// Represents a prepared inline message saved by a bot, to be sent to the user via a web app » See [TLDef(0x8ECF0511)] public sealed partial class Messages_BotPreparedInlineMessage : IObject { + /// The ID of the saved message, to be passed to the id field of the web_app_send_prepared_message event » public string id; + /// Expiration date of the message public DateTime expire_date; } - /// See + /// Represents a prepared inline message received via a bot's mini app, that can be sent to some chats » See [TLDef(0xFF57708D)] public sealed partial class Messages_PreparedInlineMessage : IObject { + /// The query_id to pass to Messages_SendInlineBotResult public long query_id; + /// The contents of the message, to be shown in a preview public BotInlineResultBase result; + /// Types of chats where this message can be sent public InlineQueryPeerType[] peer_types; + /// Caching validity of the results public int cache_time; + /// Users mentioned in the results public Dictionary users; } - /// See + /// Mini app » settings See [TLDef(0xC99B1950)] public sealed partial class BotAppSettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// SVG placeholder logo, compressed using the same format used for vector thumbnails ». [IfFlag(0)] public byte[] placeholder_path; + /// Default light mode background color [IfFlag(1)] public int background_color; + /// Default dark mode background color [IfFlag(2)] public int background_dark_color; + /// Default light mode header color [IfFlag(3)] public int header_color; + /// Default dark mode header color [IfFlag(4)] public int header_dark_color; [Flags] public enum Flags : uint { + /// Field has a value has_placeholder_path = 0x1, + /// Field has a value has_background_color = 0x2, + /// Field has a value has_background_dark_color = 0x4, + /// Field has a value has_header_color = 0x8, + /// Field has a value has_header_dark_color = 0x10, } } - /// See + /// Indo about an affiliate program offered by a bot See [TLDef(0xDD0C66F2)] public sealed partial class StarRefProgram : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the bot that offers the program public long bot_id; + /// An affiliate gets a commission of .commission_permilleTelegram Stars for every mini app transaction made by users they refer public int commission_permille; + /// An affiliate gets a commission for every mini app transaction made by users they refer, for duration_months months after a referral link is imported, starting the bot for the first time [IfFlag(0)] public int duration_months; + /// Point in time (Unix timestamp) when the affiliate program will be closed (optional, if not set the affiliate program isn't scheduled to be closed) [IfFlag(1)] public DateTime end_date; + /// The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program [IfFlag(2)] public StarsAmount daily_revenue_per_user; [Flags] public enum Flags : uint { + /// Field has a value has_duration_months = 0x1, + /// Field has a value has_end_date = 0x2, + /// Field has a value has_daily_revenue_per_user = 0x4, } } - /// See + /// Info about an active affiliate program we have with a Mini App See [TLDef(0x19A13F71)] public sealed partial class ConnectedBotStarRef : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Referral link to be shared public string url; + /// When did we affiliate with bot_id public DateTime date; + /// ID of the mini app that created the affiliate program public long bot_id; + /// The number of Telegram Stars received by the affiliate for each 1000 Telegram Stars received by bot_id public int commission_permille; + /// Number of months the program will be active; if not set, there is no expiration date. [IfFlag(0)] public int duration_months; + /// The number of users that used the affiliate program public long participants; + /// The number of Telegram Stars that were earned by the affiliate program public long revenue; [Flags] public enum Flags : uint { + /// Field has a value has_duration_months = 0x1, + /// If set, this affiliation was revoked by the affiliate using Payments_EditConnectedStarRefBot, or by the affiliation program owner using Bots_UpdateStarRefProgram revoked = 0x2, } } - /// See + /// Active affiliations See [TLDef(0x98D5EA1D)] public sealed partial class Payments_ConnectedStarRefBots : IObject { + /// Total number of active affiliations public int count; + /// The affiliations public ConnectedBotStarRef[] connected_bots; + /// Peers mentioned in connected_bots public Dictionary users; } - /// See + /// A list of suggested mini apps with available affiliate programs See [TLDef(0xB4D5D859)] public sealed partial class Payments_SuggestedStarRefBots : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results (for pagination) public int count; + /// Suggested affiliate programs (full or partial list to be fetched using pagination) public StarRefProgram[] suggested_bots; + /// Peers mentioned in suggested_bots public Dictionary users; + /// Next offset for pagination [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } - /// See + /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See [TLDef(0xBBB6B4A3)] public sealed partial class StarsAmount : IObject { + /// The integer amount of Telegram Stars. public long amount; + /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
public int nanos; } - ///
See + /// Found stickers See Derived classes: , public abstract partial class Messages_FoundStickersBase : IObject { } - /// See + /// No new stickers were found for the specified query See [TLDef(0x6010C534)] public sealed partial class Messages_FoundStickersNotModified : Messages_FoundStickersBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Offset for pagination [IfFlag(0)] public int next_offset; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } - /// See + /// Found stickers See [TLDef(0x82C9E290)] public sealed partial class Messages_FoundStickers : Messages_FoundStickersBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Offset for pagination [IfFlag(0)] public int next_offset; + /// Hash used for caching, for more info click here public long hash; + /// Found stickers public DocumentBase[] stickers; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 403a62a..321e06c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -232,7 +232,7 @@ namespace TL bot_auth_token = bot_auth_token, }); - /// Try logging to an account protected by a 2FA password. See Possible codes: 400 (details) + /// Try logging to an account protected by a 2FA password. See Possible codes: 400,500 (details) /// The account's password (see SRP) public static Task Auth_CheckPassword(this Client client, InputCheckPasswordSRP password) => client.Invoke(new Auth_CheckPassword @@ -507,7 +507,7 @@ namespace TL rules = rules, }); - /// Delete the user's account from the telegram servers. See Possible codes: 420 (details) + /// Delete the user's account from the telegram servers. See Possible codes: 400,420 (details) /// Why is the account being deleted, can be empty /// 2FA password: this field can be omitted even for accounts with 2FA enabled: in this case account account deletion will be delayed by 7 days as specified in the docs » public static Task Account_DeleteAccount(this Client client, string reason, InputCheckPasswordSRP password = null) @@ -1482,7 +1482,7 @@ namespace TL contacts = contacts, }); - /// Deletes several contacts from the list. See + /// Deletes several contacts from the list. See Possible codes: 400 (details) /// User ID list public static Task Contacts_DeleteContacts(this Client client, params InputUserBase[] id) => client.Invoke(new Contacts_DeleteContacts @@ -1542,6 +1542,7 @@ namespace TL /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) /// @username to resolve + /// Referrer ID from referral links ». public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) => client.Invoke(new Contacts_ResolveUsername { @@ -1761,7 +1762,7 @@ namespace TL /// If a positive value was transferred, only messages with a sending date smaller than the transferred one will be returned /// Only return messages starting from the specified message ID /// Additional offset - /// Number of results to return + /// Number of results to return, can be 0 to only return the message counter. /// Maximum message ID to return /// Minimum message ID to return /// Hash @@ -1844,7 +1845,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,406,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,404,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -3622,7 +3623,7 @@ namespace TL reaction = reaction, }); - /// Translate a given text. See Possible codes: 400 (details) + /// Translate a given text. See Possible codes: 400,500 (details) /// If the text is a chat message, the peer ID /// A list of message IDs to translate /// A list of styled messages to translate @@ -3713,7 +3714,8 @@ namespace TL /// Open a bot mini app, sending over user information after user confirmation. See Possible codes: 400,403 (details) /// Whether the webview was opened by clicking on the bot's menu button ». /// Whether the inline message that will be sent by the bot on behalf of the user once the web app interaction is Messages_SendWebViewResultMessage should be sent silently (no notifications for the receivers). - /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the attachment menu deep link is equal to compact. + /// If set, requests to open the mini app in compact mode (as opposed to normal or fullscreen mode). Must be set if the mode parameter of the attachment menu deep link is equal to compact. + /// If set, requests to open the mini app in fullscreen mode (as opposed to normal or compact mode). Must be set if the mode parameter of the attachment menu deep link is equal to fullscreen. /// Dialog where the web app is being opened, and where the resulting message will be sent (see the docs for more info »). /// Bot that owns the web app /// Web app URL @@ -3758,6 +3760,7 @@ namespace TL /// Whether the webapp was opened by clicking on the switch_webview button shown on top of the inline results list returned by Messages_GetInlineBotResults. /// Set this flag if opening the Mini App from the installed side menu entry ». /// Deprecated. + /// Requests to open the app in fullscreen mode. /// Bot that owns the mini app /// Web app URL, if opening from a keyboard button or inline result /// Deprecated. @@ -3898,7 +3901,7 @@ namespace TL }); /// Changes the default value of the Time-To-Live setting, applied to all new chats. See Possible codes: 400 (details) - /// The new default Time-To-Live of all messages sent in new chats. + /// The new default Time-To-Live of all messages sent in new chats, in seconds. public static Task Messages_SetDefaultHistoryTTL(this Client client, int period) => client.Invoke(new Messages_SetDefaultHistoryTTL { @@ -3985,7 +3988,8 @@ namespace TL /// Open a bot mini app from a direct Mini App deep link, sending over user information after user confirmation. See Possible codes: 400 (details) /// Set this flag if the bot is asking permission to send messages to the user as specified in the direct Mini App deep link docs, and the user agreed. - /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the direct Mini App deep link is equal to compact. + /// If set, requests to open the mini app in compact mode (as opposed to normal or fullscreen mode). Must be set if the mode parameter of the direct Mini App deep link is equal to compact. + /// If set, requests to open the mini app in fullscreen mode (as opposed to compact or normal mode). Must be set if the mode parameter of the direct Mini App deep link is equal to fullscreen. /// If the client has clicked on the link in a Telegram chat, pass the chat's peer information; otherwise pass the bot's peer information, instead. /// The app obtained by invoking Messages_GetBotApp as specified in the direct Mini App deep link docs. /// If the startapp query string parameter is present in the direct Mini App deep link, pass it to start_param. @@ -4304,7 +4308,8 @@ namespace TL }); /// Open a Main Mini App. See Possible codes: 400 (details) - /// If set, requests to open the mini app in compact mode (as opposed to fullview mode). Must be set if the mode parameter of the Main Mini App link is equal to compact. + /// If set, requests to open the mini app in compact mode (as opposed to normal or fullscreen mode). Must be set if the mode parameter of the Main Mini App link is equal to compact. + /// If set, requests to open the mini app in fullscreen mode (as opposed to compact or normal mode). Must be set if the mode parameter of the Main Mini App link is equal to fullscreen. /// Currently open chat, may be if no chat is currently open. /// Bot that owns the main mini app. /// Start parameter, if opening from a Main Mini App link ». @@ -4321,7 +4326,7 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See [bots: ✓] + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). @@ -4338,7 +4343,7 @@ namespace TL private_ = private_ ?? default, }); - /// Changes the privacy of already sent paid reactions on a specific message. See [bots: ✓] + /// Changes the privacy of already sent paid reactions on a specific message. See Possible codes: 400 (details) /// The channel /// The ID of the message to which we sent the paid reactions /// If true, makes the current anonymous in the top sender leaderboard for this message; otherwise, does the opposite. @@ -4350,13 +4355,13 @@ namespace TL private_ = private_, }); - /// Fetches an update with the current default paid reaction privacy, see here » for more info. See [bots: ✓] + /// Fetches an update with the current default paid reaction privacy, see here » for more info. See public static Task Messages_GetPaidReactionPrivacy(this Client client) => client.Invoke(new Messages_GetPaidReactionPrivacy { }); - /// Mark a specific sponsored message » as read See [bots: ✓] + /// 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) @@ -4366,7 +4371,7 @@ namespace TL random_id = random_id, }); - /// Informs the server that the user has interacted with a sponsored message in one of the ways listed here ». See [bots: ✓] + /// 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 @@ -4379,7 +4384,7 @@ namespace TL random_id = random_id, }); - /// Report a sponsored message », see here » for more info on the full flow. See [bots: ✓] + /// 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. @@ -4391,7 +4396,7 @@ namespace TL option = option, }); - /// Get a list of sponsored messages for a peer, see here » for more info. See [bots: ✓] + /// Get a list of sponsored messages for a peer, see here » for more info. See /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer) @@ -4400,7 +4405,10 @@ namespace TL peer = peer, }); - /// See + /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓] Possible codes: 400 (details) + /// The message + /// The user to whom the web_app_send_prepared_message event event will be sent + /// Types of chats where this message can be sent public static Task Messages_SavePreparedInlineMessage(this Client client, InputBotInlineResultBase result, InputUserBase user_id, InlineQueryPeerType[] peer_types = null) => client.Invoke(new Messages_SavePreparedInlineMessage { @@ -4410,7 +4418,9 @@ namespace TL peer_types = peer_types, }); - /// See + /// Obtain a prepared inline message generated by a mini app: invoked when handling web_app_send_prepared_message events See Possible codes: 400 (details) + /// The bot that owns the mini app that emitted the web_app_send_prepared_message event + /// The id from the web_app_send_prepared_message event public static Task Messages_GetPreparedInlineMessage(this Client client, InputUserBase bot, string id) => client.Invoke(new Messages_GetPreparedInlineMessage { @@ -4418,7 +4428,14 @@ namespace TL id = id, }); - /// See + /// Search for stickers using AI-powered keyword search See + /// If set, returns custom emoji stickers + /// The search term + /// Space-separated list of emojis to search for + /// List of possible IETF language tags of the user's input language; may be empty if unknown + /// Offset for pagination + /// Maximum number of results to return, see pagination + /// Hash used for caching, for more info click here.
The hash may be generated locally by using the ids of the returned or stored sticker s. public static Task Messages_SearchStickers(this Client client, string q, string emoticon, string[] lang_code, int offset = default, int limit = int.MaxValue, long hash = default, bool emojis = false) => client.Invoke(new Messages_SearchStickers { @@ -5756,7 +5773,9 @@ namespace TL bot = bot, }); - /// See + /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓] Possible codes: 400 (details) + /// The user whose emoji status should be changed + /// The emoji status public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatus emoji_status) => client.Invoke(new Bots_UpdateUserEmojiStatus { @@ -5764,7 +5783,9 @@ namespace TL emoji_status = emoji_status, }); - /// See + /// Allow or prevent a bot from changing our emoji status » See Possible codes: 400 (details) + /// The bot + /// Whether to allow or prevent the bot from changing our emoji status public static Task Bots_ToggleUserEmojiStatusPermission(this Client client, InputUserBase bot, bool enabled) => client.Invoke(new Bots_ToggleUserEmojiStatusPermission { @@ -5772,7 +5793,10 @@ namespace TL enabled = enabled, }); - /// See + /// Check if a mini app can request the download of a specific file: called when handling web_app_request_file_download events » See Possible codes: 400 (details) + /// The bot that owns the mini app that requested the download + /// The filename from the web_app_request_file_download event » + /// The url from the web_app_request_file_download event » public static Task Bots_CheckDownloadFileParams(this Client client, InputUserBase bot, string file_name, string url) => client.Invoke(new Bots_CheckDownloadFileParams { @@ -5781,13 +5805,16 @@ namespace TL url = url, }); - /// See + /// Get a list of bots owned by the current user See public static Task Bots_GetAdminedBots(this Client client) => client.Invoke(new Bots_GetAdminedBots { }); - /// See + /// Create, edit or delete the affiliate program of a bot we own See Possible codes: 400 (details) + /// The bot + /// The permille commission rate: it indicates the share of Telegram Stars received by affiliates for every transaction made by users they referred inside of the bot.
The minimum and maximum values for this parameter are contained in the starref_min_commission_permille and starref_max_commission_permille client configuration parameters.
Can be 0 to terminate the affiliate program.
Both the duration and the commission may only be raised after creation of the program: to lower them, the program must first be terminated and a new one created. + /// Indicates the duration of the affiliate program; if not set, there is no expiration date. public static Task Bots_UpdateStarRefProgram(this Client client, InputUserBase bot, int commission_permille, int? duration_months = null) => client.Invoke(new Bots_UpdateStarRefProgram { @@ -5799,7 +5826,7 @@ namespace TL /// Get a payment form See Possible codes: 400 (details) /// Invoice - /// 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 + /// Theme parameters » public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) => client.Invoke(new Payments_GetPaymentForm { @@ -6017,7 +6044,7 @@ namespace TL peer = peer, }); - /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) /// Channel or bot from which to withdraw funds. /// Amount of stars to withdraw. /// 2FA password, see here » for more info. @@ -6029,7 +6056,7 @@ namespace TL password = password, }); - /// Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for channel/bot in peer, paid using the Telegram Stars owned by the specified peer, see here » for more info. See Possible codes: 400 (details) + /// Returns a URL for a Telegram Ad platform account that can be used to set up advertisements for channel/bot in peer, paid using the Telegram Stars owned by the specified peer, see here » for more info. See Possible codes: 400,403 (details) /// Channel or bot that owns the stars. public static Task Payments_GetStarsRevenueAdsAccountUrl(this Client client, InputPeer peer) => client.Invoke(new Payments_GetStarsRevenueAdsAccountUrl @@ -6047,7 +6074,7 @@ namespace TL id = id, }); - /// Obtain a list of Telegram Stars gift options » as s. See + /// Obtain a list of Telegram Stars gift options » as s. See Possible codes: 400 (details) /// Receiver of the gift (optional). public static Task Payments_GetStarsGiftOptions(this Client client, InputUserBase user_id = null) => client.Invoke(new Payments_GetStarsGiftOptions @@ -6056,10 +6083,10 @@ namespace TL user_id = user_id, }); - /// Obtain a list of active, expired or cancelled Telegram Star subscriptions ». See [bots: ✓] - /// Whether to return only expired subscriptions due to an excessively low Telegram Star balance. + /// Obtain a list of active, expired or cancelled Telegram Star subscriptions ». See Possible codes: 400 (details) + /// Whether to return only subscriptions expired due to an excessively low Telegram Star balance. /// Always pass . - /// Offset for pagination, taken from payments.starsStatus. + /// Offset for pagination, taken from .subscriptions_next_offset. public static Task Payments_GetStarsSubscriptions(this Client client, InputPeer peer, string offset, bool missing_balance = false) => client.Invoke(new Payments_GetStarsSubscriptions { @@ -6068,7 +6095,7 @@ namespace TL offset = offset, }); - /// Activate or deactivate a Telegram Star subscription ». See [bots: ✓] + /// Activate or deactivate a Telegram Star subscription ». See Possible codes: 400 (details) /// Always pass . /// ID of the subscription. /// Whether to cancel or reactivate the subscription. @@ -6081,7 +6108,7 @@ namespace TL canceled = canceled ?? default, }); - /// Re-join a private channel associated to an active Telegram Star subscription ». See [bots: ✓] + /// Re-join a private channel associated to an active Telegram Star subscription ». See Possible codes: 400 (details) /// Always pass . /// ID of the subscription. public static Task Payments_FulfillStarsSubscription(this Client client, InputPeer peer, string subscription_id) @@ -6091,14 +6118,14 @@ namespace TL subscription_id = subscription_id, }); - /// Fetch a list of star giveaway options ». See [bots: ✓] + /// Fetch a list of star giveaway options ». See public static Task Payments_GetStarsGiveawayOptions(this Client client) => client.Invoke(new Payments_GetStarsGiveawayOptions { }); - /// Get a list of available gifts, see here » for more info. See [bots: ✓] - /// Hash used for caching, for more info click here. + /// Get a list of available gifts, see here » for more info. See + /// Hash used for caching, for more info click here.
The hash may be generated locally by using the ids of the returned or stored sticker s. /// a null value means payments.starGiftsNotModified public static Task Payments_GetStarGifts(this Client client, int hash = default) => client.Invoke(new Payments_GetStarGifts @@ -6106,7 +6133,7 @@ namespace TL hash = hash, }); - /// Get the gifts » pinned on a specific user's profile. See [bots: ✓] + /// Get the gifts » pinned on a specific user's profile. See Possible codes: 400 (details) /// Identifier of the user (can be the current user to fetch all gifts received by the current user). /// Offset for pagination, taken from (initially empty). /// Maximum number of results to return, see pagination @@ -6118,7 +6145,7 @@ namespace TL limit = limit, }); - /// Display or remove a received gift » from our profile. See [bots: ✓] + /// Display or remove a received gift » from our profile. See Possible codes: 400 (details) /// If set, hides the gift from our profile. /// ID of the user that sent us the gift. /// The ID of the with the . @@ -6130,7 +6157,7 @@ namespace TL msg_id = msg_id, }); - /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See [bots: ✓] + /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See Possible codes: 400 (details) /// ID of the user that sent us the gift. /// The ID of the with the . public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) @@ -6140,7 +6167,10 @@ namespace TL msg_id = msg_id, }); - /// See + /// Cancel a bot subscription See Possible codes: 400 (details) + /// If not set, disables autorenewal of the subscriptions, and prevents the user from reactivating the subscription once the current period expires: a subscription cancelled by the bot will have the .bot_canceled flag set.
The bot can can partially undo this operation by setting this flag: this will allow the user to reactivate the subscription. + /// The ID of the user whose subscription should be (un)cancelled + /// The provider_charge_id from the service message sent to the bot for the first subscription payment. public static Task Payments_BotCancelStarsSubscription(this Client client, InputUserBase user_id, string charge_id, bool restore = false) => client.Invoke(new Payments_BotCancelStarsSubscription { @@ -6149,7 +6179,11 @@ namespace TL charge_id = charge_id, }); - /// See + /// Fetch all affiliations we have created for a certain peer See + /// The affiliated peer + /// If set, returns only results older than the specified unixtime + /// Offset for pagination, taken from the last returned .url (initially empty) + /// Maximum number of results to return, see pagination public static Task Payments_GetConnectedStarRefBots(this Client client, InputPeer peer, int limit = int.MaxValue, DateTime? offset_date = null, string offset_link = null) => client.Invoke(new Payments_GetConnectedStarRefBots { @@ -6160,7 +6194,9 @@ namespace TL limit = limit, }); - /// See + /// Fetch info about a specific bot affiliation » See Possible codes: 400 (details) + /// The affiliated peer + /// The bot that offers the affiliate program public static Task Payments_GetConnectedStarRefBot(this Client client, InputPeer peer, InputUserBase bot) => client.Invoke(new Payments_GetConnectedStarRefBot { @@ -6168,7 +6204,12 @@ namespace TL bot = bot, }); - /// See + /// Obtain a list of suggested mini apps with available affiliate programs See Possible codes: 403 (details) + /// If set, orders results by the expected revenue + /// If set, orders results by the creation date of the affiliate program + /// The peer that will become the affiliate: star commissions will be transferred to this peer's star balance. + /// Offset for pagination, taken from .next_offset, initially empty. + /// Maximum number of results to return, see pagination public static Task Payments_GetSuggestedStarRefBots(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool order_by_revenue = false, bool order_by_date = false) => client.Invoke(new Payments_GetSuggestedStarRefBots { @@ -6178,7 +6219,9 @@ namespace TL limit = limit, }); - /// See + /// Join a bot's affiliate program, becoming an affiliate » See + /// The peer that will become the affiliate: star commissions will be transferred to this peer's star balance. + /// The bot that offers the affiliate program public static Task Payments_ConnectStarRefBot(this Client client, InputPeer peer, InputUserBase bot) => client.Invoke(new Payments_ConnectStarRefBot { @@ -6186,7 +6229,10 @@ namespace TL bot = bot, }); - /// See + /// Leave a bot's affiliate program » See Possible codes: 400 (details) + /// If set, leaves the bot's affiliate program + /// The peer that was affiliated + /// The affiliate link to revoke public static Task Payments_EditConnectedStarRefBot(this Client client, InputPeer peer, string link, bool revoked = false) => client.Invoke(new Payments_EditConnectedStarRefBot { diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index c9c475b..a9a9c11 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -42,11 +42,8 @@ namespace TL /// Indicates the location of a photo, will be deprecated soon See public abstract partial class FileLocationBase : IObject { - /// Server volume public virtual long VolumeId => default; - /// File ID public virtual int LocalId => default; - /// Checksum to access the file public virtual long Secret => default; } @@ -501,38 +498,25 @@ namespace TL [TLDef(0x7C596B46)] public sealed partial class FileLocationUnavailable : FileLocationBase { - /// Server volume public long volume_id; - /// File ID public int local_id; - /// Checksum to access the file public long secret; - /// Server volume public override long VolumeId => volume_id; - /// File ID public override int LocalId => local_id; - /// Checksum to access the file public override long Secret => secret; } /// File location. See [TLDef(0x53D69076)] public sealed partial class FileLocation : FileLocationBase { - /// Number of the data center holding the file public int dc_id; - /// Server volume public long volume_id; - /// File ID public int local_id; - /// Checksum to access the file public long secret; - /// Server volume public override long VolumeId => volume_id; - /// File ID public override int LocalId => local_id; - /// Checksum to access the file public override long Secret => secret; } } From b0f336994bff885bf0ec0f2a24f1eda5caa0f9e9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 2 Jan 2025 00:35:34 +0100 Subject: [PATCH 267/336] API Layer 196: more starGifts methods, bot verification (see Bot API 8.2), conference calls, ... --- README.md | 2 +- src/TL.Schema.cs | 325 ++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 108 ++++++++++-- src/TL.Table.cs | 60 ++++--- src/WTelegramClient.csproj | 2 +- 5 files changed, 414 insertions(+), 83 deletions(-) diff --git a/README.md b/README.md index bc6ba13..929be15 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-195-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-196-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 aed4861..60b1d51 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -750,7 +750,7 @@ namespace TL public long id; } /// Indicates info about a certain user. See - [TLDef(0x83314FCA)] + [TLDef(0x4B46C37E)] public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -793,6 +793,7 @@ namespace TL [IfFlag(41)] public PeerColor profile_color; /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; + [IfFlag(46)] public long bot_verification_icon; [Flags] public enum Flags : uint { @@ -880,6 +881,8 @@ namespace TL has_bot_active_users = 0x1000, /// If set, this bot has configured a Main Mini App ». bot_has_main_app = 0x2000, + /// Field has a value + has_bot_verification_icon = 0x4000, } } @@ -1050,7 +1053,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0xFE4478BD)] + [TLDef(0xE00998B7)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1093,6 +1096,7 @@ namespace TL [IfFlag(42)] public int level; /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; + [IfFlag(45)] public long bot_verification_icon; [Flags] public enum Flags : uint { @@ -1174,6 +1178,8 @@ namespace TL has_subscription_until_date = 0x800, /// If set, messages sent by admins to this channel will link to the admin's profile (just like with groups). signature_profiles = 0x1000, + /// Field has a value + has_bot_verification_icon = 0x2000, } /// ID of the channel, see here » for more info @@ -1357,7 +1363,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xBBAB348D)] + [TLDef(0x9FF3B858)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1446,6 +1452,7 @@ namespace TL [IfFlag(41)] public int boosts_unrestrict; /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; + [IfFlag(49)] public BotVerification bot_verification; [Flags] public enum Flags : uint { @@ -1549,6 +1556,8 @@ namespace TL can_view_stars_revenue = 0x8000, /// If set, users may send paid Telegram Star reactions » to messages of this channel. paid_reactions_available = 0x10000, + /// Field has a value + has_bot_verification = 0x20000, } /// ID of the channel @@ -1698,6 +1707,8 @@ namespace TL public virtual MessageReplyHeaderBase ReplyTo => default; /// Date of the message public virtual DateTime Date => default; + /// Reactions to this message + public virtual MessageReactions Reactions => default; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. public virtual int TtlPeriod => default; } @@ -1724,7 +1735,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x94345242)] + [TLDef(0x96FDBBE9)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1783,6 +1794,7 @@ namespace TL [IfFlag(34)] public long effect; /// Represents a fact-check ». [IfFlag(35)] public FactCheck factcheck; + [IfFlag(37)] public DateTime report_delivery_until_date; [Flags] public enum Flags : uint { @@ -1858,6 +1870,8 @@ namespace TL has_factcheck = 0x8, /// The video contained in the message is currently being processed by the server (i.e. to generate alternative qualities, that will be contained in the final .alt_document), and will be sent once the video is processed, which will happen approximately at the specified date (i.e. messages with this flag set should be treated similarly to scheduled messages, but instead of the scheduled date, date contains the estimated conversion date).
See here » for more info.
video_processing_pending = 0x10, + /// Field has a value + has_report_delivery_until_date = 0x20, } /// ID of the message @@ -1870,11 +1884,13 @@ namespace TL public override MessageReplyHeaderBase ReplyTo => reply_to; /// Date of the message public override DateTime Date => date; + /// Reactions to this message + public override MessageReactions Reactions => reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. public override int TtlPeriod => ttl_period; } /// Indicates a service message See - [TLDef(0x2B085862)] + [TLDef(0xD3D28540)] public sealed partial class MessageService : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1891,6 +1907,7 @@ namespace TL public DateTime date; /// Event connected with the service message public MessageAction action; + [IfFlag(20)] public MessageReactions reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; @@ -1906,12 +1923,15 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, + reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, /// Whether it's a channel post post = 0x4000, /// This is a legacy message: it has to be refetched with the new layer legacy = 0x80000, + /// Field has a value + has_reactions = 0x100000, /// Field has a value has_ttl_period = 0x2000000, } @@ -1926,6 +1946,7 @@ namespace TL public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date public override DateTime Date => date; + public override MessageReactions Reactions => reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. public override int TtlPeriod => ttl_period; } @@ -2821,17 +2842,19 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0x08557637)] + [TLDef(0xD8F4F0A7)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Info about the gift - public StarGift gift; + public StarGiftBase gift; /// Additional message from the sender of the gift [IfFlag(1)] public TextWithEntities message; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; + [IfFlag(5)] public int upgrade_msg_id; + [IfFlag(8)] public long upgrade_stars; [Flags] public enum Flags : uint { @@ -2845,6 +2868,30 @@ namespace TL converted = 0x8, /// Field has a value has_convert_stars = 0x10, + upgraded = 0x20, + /// Field has a value + has_upgrade_stars = 0x100, + refunded = 0x200, + can_upgrade = 0x400, + } + } + ///
See + [TLDef(0x26077B99)] + public sealed partial class MessageActionStarGiftUnique : MessageAction + { + public Flags flags; + public StarGiftBase gift; + [IfFlag(3)] public int can_export_at; + [IfFlag(4)] public long transfer_stars; + + [Flags] public enum Flags : uint + { + upgrade = 0x1, + transferred = 0x2, + saved = 0x4, + has_can_export_at = 0x8, + has_transfer_stars = 0x10, + refunded = 0x20, } } @@ -3451,7 +3498,7 @@ namespace TL } /// Extended user info See - [TLDef(0x979D2376)] + [TLDef(0x4D975BBC)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3516,6 +3563,7 @@ namespace TL [IfFlag(40)] public int stargifts_count; /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; + [IfFlag(44)] public BotVerification bot_verification; [Flags] public enum Flags : uint { @@ -3603,6 +3651,8 @@ namespace TL bot_can_manage_emoji_status = 0x400, /// Field has a value has_starref_program = 0x800, + /// Field has a value + has_bot_verification = 0x1000, } } @@ -4991,13 +5041,20 @@ namespace TL public int version; } /// A new groupcall was started See - [TLDef(0x14B24500)] + [TLDef(0x97D64341)] public sealed partial class UpdateGroupCall : Update { + public Flags flags; /// The channel/supergroup where this group call or livestream takes place - public long chat_id; + [IfFlag(0)] public long chat_id; /// Info about the group call or livestream public GroupCallBase call; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_chat_id = 0x1, + } } /// The Time-To-Live for messages sent by the current user in a specific chat has changed See [TLDef(0xBB9BB9A5)] @@ -7528,7 +7585,7 @@ namespace TL public ChatBase chat; } /// Chat invite info See - [TLDef(0xFE65389D)] + [TLDef(0x5C9D3702)] public sealed partial class ChatInvite : ChatInviteBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7549,6 +7606,7 @@ namespace TL [IfFlag(10)] public StarsSubscriptionPricing subscription_pricing; /// For Telegram Star subscriptions », the ID of the payment form for the subscription. [IfFlag(12)] public long subscription_form_id; + [IfFlag(13)] public BotVerification bot_verification; [Flags] public enum Flags : uint { @@ -7578,6 +7636,8 @@ namespace TL can_refulfill_subscription = 0x800, /// Field has a value has_subscription_form_id = 0x1000, + /// Field has a value + has_bot_verification = 0x2000, } } /// A chat invitation that also allows peeking into the group to read messages without joining it. See @@ -7718,7 +7778,7 @@ namespace TL } /// Info about bots (available bot commands, etc) See - [TLDef(0x36607333)] + [TLDef(0x4D8A0299)] public sealed partial class BotInfo : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -7739,6 +7799,7 @@ namespace TL [IfFlag(7)] public string privacy_policy_url; /// Mini app » settings
[IfFlag(8)] public BotAppSettings app_settings; + [IfFlag(9)] public BotVerifierSettings verifier_settings; [Flags] public enum Flags : uint { @@ -7760,6 +7821,8 @@ namespace TL has_privacy_policy_url = 0x80, /// Field has a value has_app_settings = 0x100, + /// Field has a value + has_verifier_settings = 0x200, } } @@ -10351,17 +10414,25 @@ namespace TL public PageCaption caption; } - /// Why was the phone call discarded? See - public enum PhoneCallDiscardReason : uint + /// Why was the phone call discarded? See Derived classes: , , , + public abstract partial class PhoneCallDiscardReason : IObject { } + /// The phone call was missed See + [TLDef(0x85E42301)] + public sealed partial class PhoneCallDiscardReasonMissed : PhoneCallDiscardReason { } + /// The phone call was disconnected See + [TLDef(0xE095C1A0)] + public sealed partial class PhoneCallDiscardReasonDisconnect : PhoneCallDiscardReason { } + /// The phone call was ended normally See + [TLDef(0x57ADC690)] + public sealed partial class PhoneCallDiscardReasonHangup : PhoneCallDiscardReason { } + /// The phone call was discarded because the user is busy in another call See + [TLDef(0xFAF7E8C9)] + public sealed partial class PhoneCallDiscardReasonBusy : PhoneCallDiscardReason { } + /// See + [TLDef(0xAFE2B839)] + public sealed partial class PhoneCallDiscardReasonAllowGroupCall : PhoneCallDiscardReason { - ///The phone call was missed - Missed = 0x85E42301, - ///The phone call was disconnected - Disconnect = 0xE095C1A0, - ///The phone call was ended normally - Hangup = 0x57ADC690, - ///The phone call was discarded because the user is busy in another call - Busy = 0xFAF7E8C9, + public byte[] encrypted_key; } /// Represents a json-encoded object See @@ -11060,6 +11131,7 @@ namespace TL public virtual long ParticipantId => default; /// Phone call protocol info public virtual PhoneCallProtocol Protocol => default; + public virtual InputGroupCall ConferenceCall => default; } /// Empty constructor See [TLDef(0x5366C915)] @@ -11072,7 +11144,7 @@ namespace TL public override long ID => id; } /// Incoming phone call See - [TLDef(0xC5226F17)] + [TLDef(0xEED42858)] public sealed partial class PhoneCallWaiting : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11091,6 +11163,7 @@ namespace TL public PhoneCallProtocol protocol; /// When was the phone call received [IfFlag(0)] public DateTime receive_date; + [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11098,6 +11171,8 @@ namespace TL has_receive_date = 0x1, /// Is this a video call video = 0x40, + /// Field has a value + has_conference_call = 0x100, } /// Call ID @@ -11112,9 +11187,10 @@ namespace TL public override long ParticipantId => participant_id; /// Phone call protocol info public override PhoneCallProtocol Protocol => protocol; + public override InputGroupCall ConferenceCall => conference_call; } /// Requested phone call See - [TLDef(0x14B0ED0C)] + [TLDef(0x45361C63)] public sealed partial class PhoneCallRequested : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11133,11 +11209,14 @@ namespace TL public byte[] g_a_hash; /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; + [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, + /// Field has a value + has_conference_call = 0x100, } /// Phone call ID @@ -11152,9 +11231,10 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; + public override InputGroupCall ConferenceCall => conference_call; } /// An accepted phone call See - [TLDef(0x3660C311)] + [TLDef(0x22FD7181)] public sealed partial class PhoneCallAccepted : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11173,11 +11253,14 @@ namespace TL public byte[] g_b; /// Protocol to use for phone call public PhoneCallProtocol protocol; + [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, + /// Field has a value + has_conference_call = 0x100, } /// ID of accepted phone call @@ -11192,9 +11275,10 @@ namespace TL public override long ParticipantId => participant_id; /// Protocol to use for phone call public override PhoneCallProtocol Protocol => protocol; + public override InputGroupCall ConferenceCall => conference_call; } /// Phone call See - [TLDef(0x30535AF5)] + [TLDef(0x3BA5940C)] public sealed partial class PhoneCall : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11221,6 +11305,7 @@ namespace TL public DateTime start_date; /// Custom JSON-encoded call parameters to be passed to tgcalls. [IfFlag(7)] public DataJSON custom_parameters; + [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11230,6 +11315,8 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, + /// Field has a value + has_conference_call = 0x100, } /// Call ID @@ -11244,9 +11331,10 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; + public override InputGroupCall ConferenceCall => conference_call; } /// Indicates a discarded phone call See - [TLDef(0x50CA4DE1)] + [TLDef(0xF9D25503)] public sealed partial class PhoneCallDiscarded : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11257,6 +11345,7 @@ namespace TL [IfFlag(0)] public PhoneCallDiscardReason reason; /// Duration of the phone call in seconds [IfFlag(1)] public int duration; + [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11270,10 +11359,13 @@ namespace TL need_debug = 0x8, /// Whether the call was a video call video = 0x40, + /// Field has a value + has_conference_call = 0x100, } /// Call ID public override long ID => id; + public override InputGroupCall ConferenceCall => conference_call; } /// Phone call connection See Derived classes: , @@ -13914,7 +14006,7 @@ namespace TL /// Folder ID public virtual int ID => default; /// Folder name (max 12 UTF-8 chars) - public virtual string Title => default; + public virtual TextWithEntities Title => default; /// Emoji to use as icon for the folder. public virtual string Emoticon => default; /// A color ID for the folder tag associated to this folder, see here » for more info. @@ -13925,7 +14017,7 @@ namespace TL public virtual InputPeer[] IncludePeers => default; } /// Dialog filter AKA folder See - [TLDef(0x5FB5523B)] + [TLDef(0xAA472651)] public sealed partial class DialogFilter : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13933,7 +14025,7 @@ namespace TL /// Folder ID public int id; /// Folder name (max 12 UTF-8 chars) - public string title; + public TextWithEntities title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; /// A color ID for the folder tag associated to this folder, see here » for more info. @@ -13967,12 +14059,13 @@ namespace TL has_emoticon = 0x2000000, /// Field has a value has_color = 0x8000000, + title_noanimate = 0x10000000, } /// Folder ID public override int ID => id; /// Folder name (max 12 UTF-8 chars) - public override string Title => title; + public override TextWithEntities Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; /// A color ID for the folder tag associated to this folder, see here » for more info. @@ -13983,7 +14076,7 @@ namespace TL public override InputPeer[] IncludePeers => include_peers; } /// A folder imported using a chat folder deep link ». See - [TLDef(0x9FE28EA4)] + [TLDef(0x96537BD7)] public sealed partial class DialogFilterChatlist : DialogFilterBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -13991,7 +14084,7 @@ namespace TL /// ID of the folder public int id; /// Name of the folder (max 12 UTF-8 chars) - public string title; + public TextWithEntities title; /// Emoji to use as icon for the folder. [IfFlag(25)] public string emoticon; /// A color ID for the folder tag associated to this folder, see here » for more info. @@ -14009,12 +14102,13 @@ namespace TL has_my_invites = 0x4000000, /// Field has a value has_color = 0x8000000, + title_noanimate = 0x10000000, } /// ID of the folder public override int ID => id; /// Name of the folder (max 12 UTF-8 chars) - public override string Title => title; + public override TextWithEntities Title => title; /// Emoji to use as icon for the folder. public override string Emoticon => emoticon; /// A color ID for the folder tag associated to this folder, see here » for more info. @@ -14601,7 +14695,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0xD597650C)] + [TLDef(0xCDF8D3E3)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14626,6 +14720,7 @@ namespace TL public int unmuted_video_limit; /// Version public int version; + [IfFlag(14)] public long conference_from_call; [Flags] public enum Flags : uint { @@ -14655,6 +14750,8 @@ namespace TL rtmp_stream = 0x1000, /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, + /// Field has a value + has_conference_from_call = 0x4000, } /// Group call ID @@ -15700,8 +15797,28 @@ namespace TL hide_name = 0x1, /// Field has a value has_message = 0x2, + include_upgrade = 0x4, } } + /// See + [TLDef(0x5EBE7262)] + public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice + { + public Flags flags; + public int msg_id; + + [Flags] public enum Flags : uint + { + keep_original_details = 0x1, + } + } + /// See + [TLDef(0xAE3BA9ED)] + public sealed partial class InputInvoiceStarGiftTransfer : InputInvoice + { + public int msg_id; + public InputUserBase to_id; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -16713,13 +16830,13 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Info about a chat folder deep link ». See - [TLDef(0x1DCD839D)] + [TLDef(0xF10ECE2F)] public sealed partial class Chatlists_ChatlistInvite : Chatlists_ChatlistInviteBase, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Name of the link - public string title; + public TextWithEntities title; /// Emoji to use as icon for the folder. [IfFlag(0)] public string emoticon; /// Supergroups and channels to join @@ -16733,6 +16850,7 @@ namespace TL { /// Field has a value has_emoticon = 0x1, + title_noanimate = 0x2, } /// Related chat information @@ -19166,7 +19284,7 @@ namespace TL /// ID of the message containing the , for incoming star giveaway prizes. [IfFlag(13)] public int giveaway_post_id; /// This transaction indicates a purchase or a sale (conversion back to Stars) of a gift ». - [IfFlag(14)] public StarGift stargift; + [IfFlag(14)] public StarGiftBase stargift; /// This transaction is payment for paid bot broadcasts.
Paid broadcasts are only allowed if the allow_paid_floodskip parameter of Messages_SendMessage and other message sending methods is set while trying to broadcast more than 30 messages per second to bot users.
The integer value returned by this flag indicates the number of billed API calls.
[IfFlag(15)] public int floodskip_number; /// This transaction is the receival (or refund) of an affiliate commission (i.e. this is the transaction received by the peer that created the referral link, flag 17 is for transactions made by users that imported the referral link). @@ -19214,6 +19332,7 @@ namespace TL has_starref_commission_permille = 0x10000, /// Fields and have a value has_starref_peer = 0x20000, + stargift_upgrade = 0x40000, } } @@ -19575,9 +19694,17 @@ namespace TL } } + /// Represents a star gift, see here » for more info. See Derived classes: + public abstract partial class StarGiftBase : IObject + { + /// Identifier of the gift + public virtual long ID => default; + /// For limited-supply gifts: the total number of gifts that was available in the initial supply. + public virtual int AvailabilityTotal => default; + } /// Represents a star gift, see here » for more info. See - [TLDef(0x49C577CD)] - public sealed partial class StarGift : IObject + [TLDef(0x02CC73C8)] + public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -19597,6 +19724,7 @@ namespace TL [IfFlag(1)] public DateTime first_sale_date; /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; + [IfFlag(3)] public long upgrade_stars; [Flags] public enum Flags : uint { @@ -19606,7 +19734,29 @@ namespace TL sold_out = 0x2, /// Whether this is a birthday-themed gift birthday = 0x4, + /// Field has a value + has_upgrade_stars = 0x8, } + + /// Identifier of the gift + public override long ID => id; + /// For limited-supply gifts: the total number of gifts that was available in the initial supply. + public override int AvailabilityTotal => availability_total; + } + /// See + [TLDef(0x6A1407CD)] + public sealed partial class StarGiftUnique : StarGiftBase + { + public long id; + public string title; + public int num; + public long owner_id; + public StarGiftAttribute[] attributes; + public int availability_issued; + public int availability_total; + + public override long ID => id; + public override int AvailabilityTotal => availability_total; } /// Available gifts ». See @@ -19617,11 +19767,11 @@ namespace TL /// Hash used for caching, for more info click here public int hash; /// List of available gifts. - public StarGift[] gifts; + public StarGiftBase[] gifts; } /// Represents a gift, displayed on a user's profile page. See - [TLDef(0xEEA49A6E)] + [TLDef(0x325835E1)] public sealed partial class UserStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19631,13 +19781,16 @@ namespace TL /// When was this gift sent. public DateTime date; /// The gift. - public StarGift gift; + public StarGiftBase gift; /// Message attached to the gift by the sender. [IfFlag(2)] public TextWithEntities message; /// Only visible to the receiver of the gift, contains the ID of the with the in the chat with from_id. [IfFlag(3)] public int msg_id; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to the buying price of the gift only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; + [IfFlag(6)] public long upgrade_stars; + [IfFlag(7)] public int can_export_at; + [IfFlag(8)] public long transfer_stars; [Flags] public enum Flags : uint { @@ -19653,6 +19806,14 @@ namespace TL has_convert_stars = 0x10, /// If set, indicates this is a gift sent by from_id, received by the current user and currently hidden from our profile page. unsaved = 0x20, + /// Field has a value + has_upgrade_stars = 0x40, + /// Field has a value + has_can_export_at = 0x80, + /// Field has a value + has_transfer_stars = 0x100, + refunded = 0x200, + can_upgrade = 0x400, } } @@ -19914,4 +20075,82 @@ namespace TL has_next_offset = 0x1, } } + + ///
See + [TLDef(0xB0CD6617)] + public sealed partial class BotVerifierSettings : IObject + { + public Flags flags; + public long icon; + public string company; + [IfFlag(0)] public string custom_description; + + [Flags] public enum Flags : uint + { + has_custom_description = 0x1, + can_modify_custom_description = 0x2, + } + } + + /// See + [TLDef(0xF93CD45C)] + public sealed partial class BotVerification : IObject + { + public long bot_id; + public long icon; + public string description; + } + + /// See + public abstract partial class StarGiftAttribute : IObject { } + /// See + [TLDef(0x39D99013)] + public sealed partial class StarGiftAttributeModel : StarGiftAttribute + { + public string name; + public DocumentBase document; + public int rarity_permille; + } + /// See + [TLDef(0x13ACFF19)] + public sealed partial class StarGiftAttributePattern : StarGiftAttribute + { + public string name; + public DocumentBase document; + public int rarity_permille; + } + /// See + [TLDef(0x94271762)] + public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute + { + public string name; + public int center_color; + public int edge_color; + public int pattern_color; + public int text_color; + public int rarity_permille; + } + /// See + [TLDef(0xC02C4F4B)] + public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute + { + public Flags flags; + [IfFlag(0)] public long sender_id; + public long recipient_id; + public DateTime date; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + has_sender_id = 0x1, + has_message = 0x2, + } + } + + /// See + [TLDef(0x167BD90B)] + public sealed partial class Payments_StarGiftUpgradePreview : IObject + { + public StarGiftAttribute[] sample_attributes; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 321e06c..ad52cc5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -6147,23 +6147,19 @@ namespace TL /// Display or remove a received gift » from our profile. See Possible codes: 400 (details) /// If set, hides the gift from our profile. - /// ID of the user that sent us the gift. /// The ID of the with the . - public static Task Payments_SaveStarGift(this Client client, InputUserBase user_id, int msg_id, bool unsave = false) + public static Task Payments_SaveStarGift(this Client client, int msg_id, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { flags = (Payments_SaveStarGift.Flags)(unsave ? 0x1 : 0), - user_id = user_id, msg_id = msg_id, }); /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See Possible codes: 400 (details) - /// ID of the user that sent us the gift. /// The ID of the with the . - public static Task Payments_ConvertStarGift(this Client client, InputUserBase user_id, int msg_id) + public static Task Payments_ConvertStarGift(this Client client, int msg_id) => client.Invoke(new Payments_ConvertStarGift { - user_id = user_id, msg_id = msg_id, }); @@ -6241,6 +6237,36 @@ namespace TL link = link, }); + /// See + public static Task Payments_GetStarGiftUpgradePreview(this Client client, long gift_id) + => client.Invoke(new Payments_GetStarGiftUpgradePreview + { + gift_id = gift_id, + }); + + /// See + public static Task Payments_UpgradeStarGift(this Client client, int msg_id, bool keep_original_details = false) + => client.Invoke(new Payments_UpgradeStarGift + { + flags = (Payments_UpgradeStarGift.Flags)(keep_original_details ? 0x1 : 0), + msg_id = msg_id, + }); + + /// See + public static Task Payments_TransferStarGift(this Client client, int msg_id, InputUserBase to_id) + => client.Invoke(new Payments_TransferStarGift + { + msg_id = msg_id, + to_id = to_id, + }); + + /// See + public static Task Payments_GetUserStarGift(this Client client, params int[] msg_id) + => client.Invoke(new Payments_GetUserStarGift + { + msg_id = msg_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -6383,11 +6409,12 @@ namespace TL /// Random ID to avoid resending the same object /// Parameter for E2E encryption key exchange » /// Phone call settings - public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) + public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, InputGroupCall conference_call = null, bool video = false) => client.Invoke(new Phone_RequestCall { - flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), + flags = (Phone_RequestCall.Flags)((conference_call != null ? 0x2 : 0) | (video ? 0x1 : 0)), user_id = user_id, + conference_call = conference_call, random_id = random_id, g_a_hash = g_a_hash, protocol = protocol, @@ -6500,13 +6527,14 @@ namespace TL /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. /// WebRTC parameters - public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, bool muted = false, bool video_stopped = false) + public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, long? key_fingerprint = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall { - flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), + flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (key_fingerprint != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), call = call, join_as = join_as, invite_hash = invite_hash, + key_fingerprint = key_fingerprint ?? default, params_ = params_, }); @@ -6726,6 +6754,14 @@ namespace TL file = file, }); + /// See + public static Task Phone_CreateConferenceCall(this Client client, InputPhoneCall peer, long key_fingerprint) + => client.Invoke(new Phone_CreateConferenceCall + { + peer = peer, + key_fingerprint = key_fingerprint, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Platform identifier (i.e. android, tdesktop, etc). /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. @@ -12461,11 +12497,10 @@ namespace TL.Methods public int limit; } - [TLDef(0x87ACF08E)] + [TLDef(0x92FD2AAE)] public sealed partial class Payments_SaveStarGift : IMethod { public Flags flags; - public InputUserBase user_id; public int msg_id; [Flags] public enum Flags : uint @@ -12474,10 +12509,9 @@ namespace TL.Methods } } - [TLDef(0x0421E027)] + [TLDef(0x72770C83)] public sealed partial class Payments_ConvertStarGift : IMethod { - public InputUserBase user_id; public int msg_id; } @@ -12551,6 +12585,37 @@ namespace TL.Methods } } + [TLDef(0x9C9ABCB1)] + public sealed partial class Payments_GetStarGiftUpgradePreview : IMethod + { + public long gift_id; + } + + [TLDef(0xCF4F0781)] + public sealed partial class Payments_UpgradeStarGift : IMethod + { + public Flags flags; + public int msg_id; + + [Flags] public enum Flags : uint + { + keep_original_details = 0x1, + } + } + + [TLDef(0x333FB526)] + public sealed partial class Payments_TransferStarGift : IMethod + { + public int msg_id; + public InputUserBase to_id; + } + + [TLDef(0xB502E4A5)] + public sealed partial class Payments_GetUserStarGift : IMethod + { + public int[] msg_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -12659,11 +12724,12 @@ namespace TL.Methods [TLDef(0x55451FA9)] public sealed partial class Phone_GetCallConfig : IMethod { } - [TLDef(0x42FF96ED)] + [TLDef(0xA6C4600C)] public sealed partial class Phone_RequestCall : IMethod { public Flags flags; public InputUserBase user_id; + [IfFlag(1)] public InputGroupCall conference_call; public int random_id; public byte[] g_a_hash; public PhoneCallProtocol protocol; @@ -12671,6 +12737,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { video = 0x1, + has_conference_call = 0x2, } } @@ -12757,13 +12824,14 @@ namespace TL.Methods } } - [TLDef(0xB132FF7B)] + [TLDef(0xD61E1DF3)] public sealed partial class Phone_JoinGroupCall : IMethod { public Flags flags; public InputGroupCall call; public InputPeer join_as; [IfFlag(1)] public string invite_hash; + [IfFlag(3)] public long key_fingerprint; public DataJSON params_; [Flags] public enum Flags : uint @@ -12771,6 +12839,7 @@ namespace TL.Methods muted = 0x1, has_invite_hash = 0x2, video_stopped = 0x4, + has_key_fingerprint = 0x8, } } @@ -12950,6 +13019,13 @@ namespace TL.Methods public InputFileBase file; } + [TLDef(0xDFC909AB)] + public sealed partial class Phone_CreateConferenceCall : IMethod + { + public InputPhoneCall peer; + public long key_fingerprint; + } + [TLDef(0xF2F2330A)] public sealed partial class Langpack_GetLangPack : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 1d9e4b9..a818019 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 = 195; // fetched 04/12/2024 17:50:39 + public const int Version = 196; // fetched 01/01/2025 23:32:39 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -124,7 +124,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x83314FCA] = typeof(User), + [0x4B46C37E] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -136,10 +136,10 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0xFE4478BD] = typeof(Channel), + [0xE00998B7] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0xBBAB348D] = typeof(ChannelFull), + [0x9FF3B858] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -148,8 +148,8 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x94345242] = typeof(Message), - [0x2B085862] = typeof(MessageService), + [0x96FDBBE9] = typeof(Message), + [0xD3D28540] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), [0x56E0D474] = typeof(MessageMediaGeo), @@ -213,7 +213,8 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0x08557637] = typeof(MessageActionStarGift), + [0xD8F4F0A7] = typeof(MessageActionStarGift), + [0x26077B99] = typeof(MessageActionStarGiftUnique), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -241,7 +242,7 @@ namespace TL [0xACD66C5E] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x979D2376] = typeof(UserFull), + [0x4D975BBC] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -364,7 +365,7 @@ namespace TL [0x5BB98608] = typeof(UpdatePinnedChannelMessages), [0xF89A6A4E] = typeof(UpdateChat), [0xF2EBDB4E] = typeof(UpdateGroupCallParticipants), - [0x14B24500] = typeof(UpdateGroupCall), + [0x97D64341] = typeof(UpdateGroupCall), [0xBB9BB9A5] = typeof(UpdatePeerHistoryTTL), [0xD087663A] = typeof(UpdateChatParticipant), [0x985D3ABB] = typeof(UpdateChannelParticipant), @@ -543,7 +544,7 @@ namespace TL [0xA22CBD96] = typeof(ChatInviteExported), [0xED107AB7] = typeof(ChatInvitePublicJoinRequests), [0x5A686D7C] = typeof(ChatInviteAlready), - [0xFE65389D] = typeof(ChatInvite), + [0x5C9D3702] = typeof(ChatInvite), [0x61695CB0] = typeof(ChatInvitePeek), [0xFFB62B95] = null,//InputStickerSetEmpty [0x9DE7A269] = typeof(InputStickerSetID), @@ -560,7 +561,7 @@ namespace TL [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), - [0x36607333] = typeof(BotInfo), + [0x4D8A0299] = typeof(BotInfo), [0xA2FA4880] = typeof(KeyboardButton), [0x258AFF05] = typeof(KeyboardButtonUrl), [0x35BBDB6B] = typeof(KeyboardButtonCallback), @@ -747,6 +748,11 @@ namespace TL [0x76768BED] = typeof(PageBlockDetails), [0x16115A96] = typeof(PageBlockRelatedArticles), [0xA44F3EF6] = typeof(PageBlockMap), + [0x85E42301] = typeof(PhoneCallDiscardReasonMissed), + [0xE095C1A0] = typeof(PhoneCallDiscardReasonDisconnect), + [0x57ADC690] = typeof(PhoneCallDiscardReasonHangup), + [0xFAF7E8C9] = typeof(PhoneCallDiscardReasonBusy), + [0xAFE2B839] = typeof(PhoneCallDiscardReasonAllowGroupCall), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), [0x049EE584] = typeof(Invoice), @@ -779,11 +785,11 @@ namespace TL [0x32DA9E9C] = typeof(InputStickerSetItem), [0x1E36FDED] = typeof(InputPhoneCall), [0x5366C915] = typeof(PhoneCallEmpty), - [0xC5226F17] = typeof(PhoneCallWaiting), - [0x14B0ED0C] = typeof(PhoneCallRequested), - [0x3660C311] = typeof(PhoneCallAccepted), - [0x30535AF5] = typeof(PhoneCall), - [0x50CA4DE1] = typeof(PhoneCallDiscarded), + [0xEED42858] = typeof(PhoneCallWaiting), + [0x45361C63] = typeof(PhoneCallRequested), + [0x22FD7181] = typeof(PhoneCallAccepted), + [0x3BA5940C] = typeof(PhoneCall), + [0xF9D25503] = typeof(PhoneCallDiscarded), [0x9CC123C7] = typeof(PhoneConnection), [0x635FE375] = typeof(PhoneConnectionWebrtc), [0xFC878FC8] = typeof(PhoneCallProtocol), @@ -986,9 +992,9 @@ namespace TL [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), - [0x5FB5523B] = typeof(DialogFilter), + [0xAA472651] = typeof(DialogFilter), [0x363293AE] = null,//DialogFilterDefault - [0x9FE28EA4] = typeof(DialogFilterChatlist), + [0x96537BD7] = typeof(DialogFilterChatlist), [0x77744D4A] = typeof(DialogFilterSuggested), [0xB637EDAF] = typeof(StatsDateRangeDays), [0xCB43ACDE] = typeof(StatsAbsValueAndPrev), @@ -1020,7 +1026,7 @@ namespace TL [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0xD597650C] = typeof(GroupCall), + [0xCDF8D3E3] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), [0xEBA636FE] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), @@ -1097,6 +1103,8 @@ namespace TL [0x65F00CE3] = typeof(InputInvoiceStars), [0x34E793F1] = typeof(InputInvoiceChatInviteSubscription), [0x25D8C1D8] = typeof(InputInvoiceStarGift), + [0x5EBE7262] = typeof(InputInvoiceStarGiftUpgrade), + [0xAE3BA9ED] = typeof(InputInvoiceStarGiftTransfer), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1171,7 +1179,7 @@ namespace TL [0x10E6E3A6] = typeof(Chatlists_ExportedChatlistInvite), [0x10AB6DC7] = typeof(Chatlists_ExportedInvites), [0xFA87F659] = typeof(Chatlists_ChatlistInviteAlready), - [0x1DCD839D] = typeof(Chatlists_ChatlistInvite), + [0xF10ECE2F] = typeof(Chatlists_ChatlistInvite), [0x93BD878D] = typeof(Chatlists_ChatlistUpdates), [0xE8A775B0] = typeof(Bots_BotInfo), [0xB6CC2D5C] = typeof(MessagePeerVote), @@ -1332,10 +1340,11 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x49C577CD] = typeof(StarGift), + [0x02CC73C8] = typeof(StarGift), + [0x6A1407CD] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), - [0xEEA49A6E] = typeof(UserStarGift), + [0x325835E1] = typeof(UserStarGift), [0x6B65B517] = typeof(Payments_UserStarGifts), [0x7903E3D9] = typeof(MessageReportOption), [0xF0E4E0B6] = typeof(ReportResultChooseOption), @@ -1351,6 +1360,13 @@ namespace TL [0xBBB6B4A3] = typeof(StarsAmount), [0x6010C534] = typeof(Messages_FoundStickersNotModified), [0x82C9E290] = typeof(Messages_FoundStickers), + [0xB0CD6617] = typeof(BotVerifierSettings), + [0xF93CD45C] = typeof(BotVerification), + [0x39D99013] = typeof(StarGiftAttributeModel), + [0x13ACFF19] = typeof(StarGiftAttributePattern), + [0x94271762] = typeof(StarGiftAttributeBackdrop), + [0xC02C4F4B] = typeof(StarGiftAttributeOriginalDetails), + [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 9ddd748..ff8487a 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: 195 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 196 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From cbcb11e25e8b083c66909c1d0569ad8b8e10f608 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 2 Jan 2025 14:25:35 +0100 Subject: [PATCH 268/336] API Layer 196.2: Bots_SetCustomVerification, GetBotRecommendations, Messages_ReportMessagesDelivery, ... --- .github/dev.yml | 3 +- src/TL.Schema.cs | 13 ++++++++ src/TL.SchemaFuncs.cs | 75 +++++++++++++++++++++++++++++++++++++++++-- src/TL.Table.cs | 4 ++- 4 files changed, 91 insertions(+), 4 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index ef0d405..97a9eb5 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.6-dev.$(Rev:r) +name: 4.2.7-dev.$(Rev:r) pool: vmImage: ubuntu-latest @@ -57,3 +57,4 @@ stages: "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\", \"commitMessage\": \"$(Release_Notes)\" }" } waitForCompletion: 'false' + \ No newline at end of file diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 60b1d51..8b721da 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -20153,4 +20153,17 @@ namespace TL { public StarGiftAttribute[] sample_attributes; } + + /// See + [TLDef(0x62D706B8)] + public partial class Users_Users : IObject + { + public Dictionary users; + } + /// See + [TLDef(0x315A4974)] + public sealed partial class Users_UsersSlice : Users_Users + { + public int count; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ad52cc5..1bad50b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2323,6 +2323,8 @@ namespace TL /// Search for messages and peers globally See Possible codes: 400 (details) /// If set, only returns results from channels (used in the global channel search tab »). + /// Whether to search only in groups + /// Whether to search only in private chats /// Peer folder ID, for more info click here /// Query /// Global search filter @@ -2332,10 +2334,10 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here - public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null, bool broadcasts_only = false) + public static Task Messages_SearchGlobal(this Client client, string q, MessagesFilter filter = null, DateTime min_date = default, DateTime max_date = default, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, int? folder_id = null, bool broadcasts_only = false, bool groups_only = false, bool users_only = false) => client.Invoke(new Messages_SearchGlobal { - flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0)), + flags = (Messages_SearchGlobal.Flags)((folder_id != null ? 0x1 : 0) | (broadcasts_only ? 0x2 : 0) | (groups_only ? 0x4 : 0) | (users_only ? 0x8 : 0)), folder_id = folder_id ?? default, q = q, filter = filter, @@ -4448,6 +4450,15 @@ namespace TL hash = hash, }); + /// See + public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) + => client.Invoke(new Messages_ReportMessagesDelivery + { + flags = (Messages_ReportMessagesDelivery.Flags)(push ? 0x1 : 0), + peer = peer, + id = id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5824,6 +5835,24 @@ namespace TL duration_months = duration_months ?? default, }); + /// See + public static Task Bots_SetCustomVerification(this Client client, InputPeer peer, InputUserBase bot = null, string custom_description = null, bool enabled = false) + => client.Invoke(new Bots_SetCustomVerification + { + flags = (Bots_SetCustomVerification.Flags)((bot != null ? 0x1 : 0) | (custom_description != null ? 0x4 : 0) | (enabled ? 0x2 : 0)), + bot = bot, + peer = peer, + custom_description = custom_description, + }); + + /// See + public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) + => client.Invoke(new Bots_GetBotRecommendations + { + flags = 0, + bot = bot, + }); + /// Get a payment form See Possible codes: 400 (details) /// Invoice /// Theme parameters » @@ -9364,6 +9393,8 @@ namespace TL.Methods { has_folder_id = 0x1, broadcasts_only = 0x2, + groups_only = 0x4, + users_only = 0x8, } } @@ -11167,6 +11198,19 @@ namespace TL.Methods } } + [TLDef(0x5A6D7395)] + public sealed partial class Messages_ReportMessagesDelivery : IMethod + { + public Flags flags; + public InputPeer peer; + public int[] id; + + [Flags] public enum Flags : uint + { + push = 0x1, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12222,6 +12266,33 @@ namespace TL.Methods } } + [TLDef(0x8B89DFBD)] + public sealed partial class Bots_SetCustomVerification : IMethod + { + public Flags flags; + [IfFlag(0)] public InputUserBase bot; + public InputPeer peer; + [IfFlag(2)] public string custom_description; + + [Flags] public enum Flags : uint + { + has_bot = 0x1, + enabled = 0x2, + has_custom_description = 0x4, + } + } + + [TLDef(0x2855BE61)] + public sealed partial class Bots_GetBotRecommendations : IMethod + { + public Flags flags; + public InputUserBase bot; + + [Flags] public enum Flags : uint + { + } + } + [TLDef(0x37148DBB)] public sealed partial class Payments_GetPaymentForm : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index a818019..9ff74e4 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 = 196; // fetched 01/01/2025 23:32:39 + public const int Version = 196; // fetched 02/01/2025 13:18:52 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1367,6 +1367,8 @@ namespace TL [0x94271762] = typeof(StarGiftAttributeBackdrop), [0xC02C4F4B] = typeof(StarGiftAttributeOriginalDetails), [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), + [0x62D706B8] = typeof(Users_Users), + [0x315A4974] = typeof(Users_UsersSlice), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), From fdaaeb901acc8b80fb6618efd71b05a7994c67b1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 22 Jan 2025 23:28:58 +0100 Subject: [PATCH 269/336] API Layer 198: stargifts stuff, video cover, ... --- README.md | 2 +- src/TL.Schema.cs | 343 +++++++++++++++++++++++++------------ src/TL.SchemaFuncs.cs | 197 ++++++++++++++------- src/TL.Table.cs | 43 +++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 397 insertions(+), 190 deletions(-) diff --git a/README.md b/README.md index 929be15..2279602 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-196-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-198-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 8b721da..749dd20 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -229,7 +229,7 @@ namespace TL public string vcard; } /// New document See - [TLDef(0x5B38C6C1)] + [TLDef(0x037C9330)] public sealed partial class InputMediaUploadedDocument : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -244,6 +244,8 @@ namespace TL public DocumentAttribute[] attributes; /// Attached stickers [IfFlag(0)] public InputDocument[] stickers; + [IfFlag(6)] public InputPhoto video_cover; + [IfFlag(7)] public int video_timestamp; /// Time to live in seconds of self-destructing document [IfFlag(1)] public int ttl_seconds; @@ -261,16 +263,22 @@ namespace TL force_file = 0x10, /// Whether this media should be hidden behind a spoiler warning spoiler = 0x20, + /// Field has a value + has_video_cover = 0x40, + /// Field has a value + has_video_timestamp = 0x80, } } /// Forwarded document See - [TLDef(0x33473058)] + [TLDef(0xA8763AB5)] public sealed partial class InputMediaDocument : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The document to be forwarded. public InputDocument id; + [IfFlag(3)] public InputPhoto video_cover; + [IfFlag(4)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(0)] public int ttl_seconds; /// Text query or emoji that was used by the user to find this sticker or GIF: used to improve search result relevance. @@ -284,6 +292,10 @@ namespace TL has_query = 0x2, /// Whether this media should be hidden behind a spoiler warning spoiler = 0x4, + /// Field has a value + has_video_cover = 0x8, + /// Field has a value + has_video_timestamp = 0x10, } } /// Can be used to send a venue geolocation. See @@ -323,7 +335,7 @@ namespace TL } } /// Document that will be downloaded by the telegram servers See - [TLDef(0xFB52DC99)] + [TLDef(0x779600F9)] public sealed partial class InputMediaDocumentExternal : InputMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -332,6 +344,8 @@ namespace TL public string url; /// Self-destruct time to live of document [IfFlag(0)] public int ttl_seconds; + [IfFlag(2)] public InputPhoto video_cover; + [IfFlag(3)] public int video_timestamp; [Flags] public enum Flags : uint { @@ -339,6 +353,10 @@ namespace TL has_ttl_seconds = 0x1, /// Whether this media should be hidden behind a spoiler warning spoiler = 0x2, + /// Field has a value + has_video_cover = 0x4, + /// Field has a value + has_video_timestamp = 0x8, } } /// A game See @@ -782,7 +800,7 @@ namespace TL /// Language code of the user [IfFlag(22)] public string lang_code; /// Emoji status - [IfFlag(30)] public EmojiStatus emoji_status; + [IfFlag(30)] public EmojiStatusBase emoji_status; /// Additional usernames.
When updating the local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
@@ -1091,7 +1109,7 @@ namespace TL /// The channel's profile color. [IfFlag(40)] public PeerColor profile_color; /// Emoji status - [IfFlag(41)] public EmojiStatus emoji_status; + [IfFlag(41)] public EmojiStatusBase emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
[IfFlag(42)] public int level; /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. @@ -1363,7 +1381,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x9FF3B858)] + [TLDef(0x52D6806B)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1453,6 +1471,7 @@ namespace TL /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; [IfFlag(49)] public BotVerification bot_verification; + [IfFlag(50)] public int stargifts_count; [Flags] public enum Flags : uint { @@ -1558,6 +1577,9 @@ namespace TL paid_reactions_available = 0x10000, /// Field has a value has_bot_verification = 0x20000, + /// Field has a value + has_stargifts_count = 0x40000, + stargifts_available = 0x80000, } /// ID of the channel @@ -2001,7 +2023,7 @@ namespace TL [TLDef(0x9F84F49E)] public sealed partial class MessageMediaUnsupported : MessageMedia { } /// Document (video, audio, voice, sticker, any media type except photo) See - [TLDef(0xDD570BD5)] + [TLDef(0x52D8CCD9)] public sealed partial class MessageMediaDocument : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2010,6 +2032,8 @@ namespace TL [IfFlag(0)] public DocumentBase document; /// Videos only, contains alternative qualities of the video. [IfFlag(5)] public DocumentBase[] alt_documents; + [IfFlag(9)] public PhotoBase video_cover; + [IfFlag(10)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2031,6 +2055,10 @@ namespace TL round = 0x80, /// Whether this is a voice message. voice = 0x100, + /// Field has a value + has_video_cover = 0x200, + /// Field has a value + has_video_timestamp = 0x400, } } /// Preview of webpage See @@ -2842,7 +2870,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0xD8F4F0A7)] + [TLDef(0x4717E8A4)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2855,6 +2883,9 @@ namespace TL [IfFlag(4)] public long convert_stars; [IfFlag(5)] public int upgrade_msg_id; [IfFlag(8)] public long upgrade_stars; + [IfFlag(11)] public Peer from_id; + [IfFlag(12)] public Peer peer; + [IfFlag(12)] public long saved_id; [Flags] public enum Flags : uint { @@ -2873,16 +2904,23 @@ namespace TL has_upgrade_stars = 0x100, refunded = 0x200, can_upgrade = 0x400, + /// Field has a value + has_from_id = 0x800, + /// Fields and have a value + has_peer = 0x1000, } } /// See - [TLDef(0x26077B99)] + [TLDef(0xACDFCB81)] public sealed partial class MessageActionStarGiftUnique : MessageAction { public Flags flags; public StarGiftBase gift; [IfFlag(3)] public int can_export_at; [IfFlag(4)] public long transfer_stars; + [IfFlag(6)] public Peer from_id; + [IfFlag(7)] public Peer peer; + [IfFlag(7)] public long saved_id; [Flags] public enum Flags : uint { @@ -2892,6 +2930,8 @@ namespace TL has_can_export_at = 0x8, has_transfer_stars = 0x10, refunded = 0x20, + has_from_id = 0x40, + has_peer = 0x80, } } @@ -5288,7 +5328,7 @@ namespace TL public sealed partial class UpdateUserEmojiStatus : UpdateUser { /// New emoji status - public EmojiStatus emoji_status; + public EmojiStatusBase emoji_status; } /// The list of recent emoji statuses has changed See [TLDef(0x30F443DB)] @@ -12010,9 +12050,9 @@ namespace TL public sealed partial class ChannelAdminLogEventActionChangeEmojiStatus : ChannelAdminLogEventAction { /// Previous emoji status - public EmojiStatus prev_value; + public EmojiStatusBase prev_value; /// New emoji status - public EmojiStatus new_value; + public EmojiStatusBase new_value; } /// The supergroup's custom emoji stickerset was changed. See [TLDef(0x46D840AB)] @@ -13952,6 +13992,12 @@ namespace TL text_color = 0x2, } } + /// See + [TLDef(0xCF6F6DB8)] + public sealed partial class WebPageAttributeUniqueStarGift : WebPageAttribute + { + public StarGiftBase gift; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -14423,7 +14469,7 @@ namespace TL keep_archived_folders = 0x4, /// If this flag is set, the key will also apply to the ability to use Messages_GetOutboxReadDate on messages sent to us.
Meaning, users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of a message they sent to us.
The .read_dates_private flag will be set for users that have this flag enabled.
hide_read_marks = 0x8, - ///
If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
Premium users only, non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
+ /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
This option may be enabled by both non-Premium and Premium users only if the new_noncontact_peers_require_premium_without_ownpremium client configuration flag » is equal to true, otherwise it may be enabled only by Premium users and non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
new_noncontact_peers_require_premium = 0x10, } } @@ -15779,13 +15825,12 @@ namespace TL public string hash; } /// Used to buy a Telegram Star Gift, see here » for more info. See - [TLDef(0x25D8C1D8)] + [TLDef(0xE8625E92)] public sealed partial class InputInvoiceStarGift : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Identifier of the user that will receive the gift - public InputUserBase user_id; + public InputPeer peer; /// Identifier of the gift, from .id public long gift_id; /// Optional message, attached with the gift.
The maximum length for this field is specified in the
stargifts_message_length_max client configuration value ».
@@ -15801,11 +15846,11 @@ namespace TL } } /// See - [TLDef(0x5EBE7262)] + [TLDef(0x4D818D5D)] public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice { public Flags flags; - public int msg_id; + public InputSavedStarGift stargift; [Flags] public enum Flags : uint { @@ -15813,11 +15858,11 @@ namespace TL } } /// See - [TLDef(0xAE3BA9ED)] + [TLDef(0x4A5F5BD9)] public sealed partial class InputInvoiceStarGiftTransfer : InputInvoice { - public int msg_id; - public InputUserBase to_id; + public InputSavedStarGift stargift; + public InputPeer to_id; } /// Exported invoice deep link See @@ -16060,20 +16105,66 @@ namespace TL public string title; } - /// An emoji status See + /// Emoji status See Derived classes: , /// a value means emojiStatusEmpty - [TLDef(0x929B619D)] - public partial class EmojiStatus : IObject + public abstract partial class EmojiStatusBase : IObject { + public virtual DateTime Until => default; + } + /// An emoji status See + [TLDef(0xE7FF068A)] + public sealed partial class EmojiStatus : EmojiStatusBase + { + public Flags flags; /// Custom emoji document ID public long document_id; + [IfFlag(0)] public DateTime until; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_until = 0x1, + } + + public override DateTime Until => until; } - /// An emoji status valid until the specified date See - [TLDef(0xFA30A8C7, inheritBefore = true)] - public sealed partial class EmojiStatusUntil : EmojiStatus + /// See + [TLDef(0x7184603B)] + public sealed partial class EmojiStatusCollectible : EmojiStatusBase { - /// This status is valid until this date - public DateTime until; + public Flags flags; + public long collectible_id; + public long document_id; + public string title; + public string slug; + public long pattern_document_id; + public int center_color; + public int edge_color; + public int pattern_color; + public int text_color; + [IfFlag(0)] public DateTime until; + + [Flags] public enum Flags : uint + { + has_until = 0x1, + } + + public override DateTime Until => until; + } + /// See + [TLDef(0x07141DBF)] + public sealed partial class InputEmojiStatusCollectible : EmojiStatusBase + { + public Flags flags; + public long collectible_id; + [IfFlag(0)] public DateTime until; + + [Flags] public enum Flags : uint + { + has_until = 0x1, + } + + public override DateTime Until => until; } /// A list of emoji statuses See @@ -16084,7 +16175,7 @@ namespace TL /// Hash used for caching, for more info click here public long hash; /// Emoji statuses - public EmojiStatus[] statuses; + public EmojiStatusBase[] statuses; } /// Message reaction See Derived classes: , , @@ -17473,6 +17564,13 @@ namespace TL /// ARGB background color. public int color; } + /// See + [TLDef(0x5787686D)] + public sealed partial class MediaAreaStarGift : MediaArea + { + public MediaAreaCoordinates coordinates; + public string slug; + } /// Stories associated to a peer See [TLDef(0x9A35E999)] @@ -19744,17 +19842,28 @@ namespace TL public override int AvailabilityTotal => availability_total; } /// See - [TLDef(0x6A1407CD)] + [TLDef(0xF2FE7E4A)] public sealed partial class StarGiftUnique : StarGiftBase { + public Flags flags; public long id; public string title; + public string slug; public int num; - public long owner_id; + [IfFlag(0)] public Peer owner_id; + [IfFlag(1)] public string owner_name; + [IfFlag(2)] public string owner_address; public StarGiftAttribute[] attributes; public int availability_issued; public int availability_total; + [Flags] public enum Flags : uint + { + has_owner_id = 0x1, + has_owner_name = 0x2, + has_owner_address = 0x4, + } + public override long ID => id; public override int AvailabilityTotal => availability_total; } @@ -19770,75 +19879,6 @@ namespace TL public StarGiftBase[] gifts; } - /// Represents a gift, displayed on a user's profile page. See - [TLDef(0x325835E1)] - public sealed partial class UserStarGift : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Sender of the gift (may be empty for anonymous senders; will always be set if this gift was sent to us). - [IfFlag(1)] public long from_id; - /// When was this gift sent. - public DateTime date; - /// The gift. - public StarGiftBase gift; - /// Message attached to the gift by the sender. - [IfFlag(2)] public TextWithEntities message; - /// Only visible to the receiver of the gift, contains the ID of the with the in the chat with from_id. - [IfFlag(3)] public int msg_id; - /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to the buying price of the gift only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
- [IfFlag(4)] public long convert_stars; - [IfFlag(6)] public long upgrade_stars; - [IfFlag(7)] public int can_export_at; - [IfFlag(8)] public long transfer_stars; - - [Flags] public enum Flags : uint - { - /// If set, from_id will not be visible to users (it will still be visible to the receiver of the gift). - name_hidden = 0x1, - /// Field has a value - has_from_id = 0x2, - /// Field has a value - has_message = 0x4, - /// Field has a value - has_msg_id = 0x8, - /// Field has a value - has_convert_stars = 0x10, - /// If set, indicates this is a gift sent by from_id, received by the current user and currently hidden from our profile page. - unsaved = 0x20, - /// Field has a value - has_upgrade_stars = 0x40, - /// Field has a value - has_can_export_at = 0x80, - /// Field has a value - has_transfer_stars = 0x100, - refunded = 0x200, - can_upgrade = 0x400, - } - } - - ///
Gifts displayed on a user's profile. See - [TLDef(0x6B65B517)] - public sealed partial class Payments_UserStarGifts : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Total number of gifts displayed on the profile. - public int count; - /// The gifts. - public UserStarGift[] gifts; - /// Offset for pagination. - [IfFlag(0)] public string next_offset; - /// Users mentioned in the gifts vector. - public Dictionary users; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_next_offset = 0x1, - } - } - /// Report menu option See [TLDef(0x7903E3D9)] public sealed partial class MessageReportOption : IObject @@ -19951,7 +19991,7 @@ namespace TL [IfFlag(0)] public int duration_months; /// Point in time (Unix timestamp) when the affiliate program will be closed (optional, if not set the affiliate program isn't scheduled to be closed) [IfFlag(1)] public DateTime end_date; - /// The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program + /// The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program.
To obtain the approximated revenue per referred user, multiply this value by commission_permille and divide by 1000.
[IfFlag(2)] public StarsAmount daily_revenue_per_user; [Flags] public enum Flags : uint @@ -20131,12 +20171,12 @@ namespace TL public int rarity_permille; } ///
See - [TLDef(0xC02C4F4B)] + [TLDef(0xE0BFF26C)] public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute { public Flags flags; - [IfFlag(0)] public long sender_id; - public long recipient_id; + [IfFlag(0)] public Peer sender_id; + public Peer recipient_id; public DateTime date; [IfFlag(1)] public TextWithEntities message; @@ -20166,4 +20206,97 @@ namespace TL { public int count; } + + /// See + [TLDef(0xCAA2F60B)] + public sealed partial class Payments_UniqueStarGift : IObject + { + public StarGiftBase gift; + public Dictionary users; + } + + /// See + [TLDef(0xB53E8B21)] + public sealed partial class Messages_WebPagePreview : IObject + { + public MessageMedia media; + public Dictionary users; + } + + /// See + [TLDef(0x6056DBA5)] + public sealed partial class SavedStarGift : IObject + { + public Flags flags; + [IfFlag(1)] public Peer from_id; + public DateTime date; + public StarGiftBase gift; + [IfFlag(2)] public TextWithEntities message; + [IfFlag(3)] public int msg_id; + [IfFlag(11)] public long saved_id; + [IfFlag(4)] public long convert_stars; + [IfFlag(6)] public long upgrade_stars; + [IfFlag(7)] public int can_export_at; + [IfFlag(8)] public long transfer_stars; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_from_id = 0x2, + has_message = 0x4, + has_msg_id = 0x8, + has_convert_stars = 0x10, + unsaved = 0x20, + has_upgrade_stars = 0x40, + has_can_export_at = 0x80, + has_transfer_stars = 0x100, + refunded = 0x200, + can_upgrade = 0x400, + has_saved_id = 0x800, + } + } + + /// See + [TLDef(0x95F389B1)] + public sealed partial class Payments_SavedStarGifts : IObject, IPeerResolver + { + public Flags flags; + public int count; + [IfFlag(1)] public bool chat_notifications_enabled; + public SavedStarGift[] gifts; + [IfFlag(0)] public string next_offset; + public Dictionary chats; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + has_chat_notifications_enabled = 0x2, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + public abstract partial class InputSavedStarGift : IObject { } + /// See + [TLDef(0x69279795)] + public sealed partial class InputSavedStarGiftUser : InputSavedStarGift + { + public int msg_id; + } + /// See + [TLDef(0xF101AA7F)] + public sealed partial class InputSavedStarGiftChat : InputSavedStarGift + { + public InputPeer peer; + public long saved_id; + } + + /// See + [TLDef(0x84AA3A9C)] + public sealed partial class Payments_StarGiftWithdrawalUrl : IObject + { + public string url; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 1bad50b..5f025de 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1107,7 +1107,7 @@ namespace TL /// Set an emoji status See Possible codes: 400 (details) /// Emoji status to set - public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatus emoji_status) + public static Task Account_UpdateEmojiStatus(this Client client, EmojiStatusBase emoji_status) => client.Invoke(new Account_UpdateEmojiStatus { emoji_status = emoji_status, @@ -1417,6 +1417,14 @@ namespace TL settings = settings, }); + /// See + /// a null value means account.emojiStatusesNotModified + public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) + => client.Invoke(new Account_GetCollectibleEmojiStatuses + { + hash = hash, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1932,10 +1940,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1944,6 +1952,7 @@ namespace TL schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + video_timestamp = video_timestamp ?? default, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) @@ -2202,8 +2211,7 @@ namespace TL /// Get preview of webpage See Possible codes: 400 (details) /// Message from which to extract the preview /// Message entities for styled text - /// a null value means messageMediaEmpty - public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) + public static Task Messages_GetWebPagePreview(this Client client, string message, MessageEntity[] entities = null) => client.Invoke(new Messages_GetWebPagePreview { flags = (Messages_GetWebPagePreview.Flags)(entities != null ? 0x8 : 0), @@ -5488,7 +5496,7 @@ namespace TL /// Set an emoji status for a channel or supergroup. See Possible codes: 400 (details) /// The channel/supergroup, must have at least channel_emoji_status_level_min/group_emoji_status_level_min boosts. /// Emoji status to set - public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatus emoji_status) + public static Task Channels_UpdateEmojiStatus(this Client client, InputChannelBase channel, EmojiStatusBase emoji_status) => client.Invoke(new Channels_UpdateEmojiStatus { channel = channel, @@ -5787,7 +5795,7 @@ namespace TL /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓] Possible codes: 400 (details) /// The user whose emoji status should be changed /// The emoji status - public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatus emoji_status) + public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatusBase emoji_status) => client.Invoke(new Bots_UpdateUserEmojiStatus { user_id = user_id, @@ -5849,7 +5857,6 @@ namespace TL public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetBotRecommendations { - flags = 0, bot = bot, }); @@ -6162,34 +6169,20 @@ namespace TL hash = hash, }); - /// Get the gifts » pinned on a specific user's profile. See Possible codes: 400 (details) - /// Identifier of the user (can be the current user to fetch all gifts received by the current user). - /// Offset for pagination, taken from (initially empty). - /// Maximum number of results to return, see pagination - public static Task Payments_GetUserStarGifts(this Client client, InputUserBase user_id, string offset, int limit = int.MaxValue) - => client.Invoke(new Payments_GetUserStarGifts - { - user_id = user_id, - offset = offset, - limit = limit, - }); - /// Display or remove a received gift » from our profile. See Possible codes: 400 (details) /// If set, hides the gift from our profile. - /// The ID of the with the . - public static Task Payments_SaveStarGift(this Client client, int msg_id, bool unsave = false) + public static Task Payments_SaveStarGift(this Client client, InputSavedStarGift stargift, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { flags = (Payments_SaveStarGift.Flags)(unsave ? 0x1 : 0), - msg_id = msg_id, + stargift = stargift, }); /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See Possible codes: 400 (details) - /// The ID of the with the . - public static Task Payments_ConvertStarGift(this Client client, int msg_id) + public static Task Payments_ConvertStarGift(this Client client, InputSavedStarGift stargift) => client.Invoke(new Payments_ConvertStarGift { - msg_id = msg_id, + stargift = stargift, }); /// Cancel a bot subscription See Possible codes: 400 (details) @@ -6274,26 +6267,59 @@ namespace TL }); /// See - public static Task Payments_UpgradeStarGift(this Client client, int msg_id, bool keep_original_details = false) + public static Task Payments_UpgradeStarGift(this Client client, InputSavedStarGift stargift, bool keep_original_details = false) => client.Invoke(new Payments_UpgradeStarGift { flags = (Payments_UpgradeStarGift.Flags)(keep_original_details ? 0x1 : 0), - msg_id = msg_id, + stargift = stargift, }); /// See - public static Task Payments_TransferStarGift(this Client client, int msg_id, InputUserBase to_id) + public static Task Payments_TransferStarGift(this Client client, InputSavedStarGift stargift, InputPeer to_id) => client.Invoke(new Payments_TransferStarGift { - msg_id = msg_id, + stargift = stargift, to_id = to_id, }); - /// See - public static Task Payments_GetUserStarGift(this Client client, params int[] msg_id) - => client.Invoke(new Payments_GetUserStarGift + /// See + public static Task Payments_GetUniqueStarGift(this Client client, string slug) + => client.Invoke(new Payments_GetUniqueStarGift { - msg_id = msg_id, + slug = slug, + }); + + /// See + public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) + => client.Invoke(new Payments_GetSavedStarGifts + { + flags = (Payments_GetSavedStarGifts.Flags)((exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)), + peer = peer, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) + => client.Invoke(new Payments_GetSavedStarGift + { + stargift = stargift, + }); + + /// See + public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) + => client.Invoke(new Payments_GetStarGiftWithdrawalUrl + { + stargift = stargift, + password = password, + }); + + /// See + public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) + => client.Invoke(new Payments_ToggleChatStarGiftNotifications + { + flags = (Payments_ToggleChatStarGiftNotifications.Flags)(enabled ? 0x1 : 0), + peer = peer, }); /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) @@ -8352,7 +8378,7 @@ namespace TL.Methods [TLDef(0xFBD3DE6B)] public sealed partial class Account_UpdateEmojiStatus : IMethod { - public EmojiStatus emoji_status; + public EmojiStatusBase emoji_status; } [TLDef(0xD6753386)] @@ -8615,6 +8641,12 @@ namespace TL.Methods public ReactionsNotifySettings settings; } + [TLDef(0x2E7B4543)] + public sealed partial class Account_GetCollectibleEmojiStatuses : IMethod + { + public long hash; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9050,7 +9082,7 @@ namespace TL.Methods } } - [TLDef(0xD5039208)] + [TLDef(0x6D74DA08)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9062,6 +9094,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(20)] public int video_timestamp; [Flags] public enum Flags : uint { @@ -9076,6 +9109,7 @@ namespace TL.Methods noforwards = 0x4000, has_quick_reply_shortcut = 0x20000, allow_paid_floodskip = 0x80000, + has_video_timestamp = 0x100000, } } @@ -9278,8 +9312,8 @@ namespace TL.Methods public long hash; } - [TLDef(0x8B68B0CC)] - public sealed partial class Messages_GetWebPagePreview : IMethod + [TLDef(0x570D6F6F)] + public sealed partial class Messages_GetWebPagePreview : IMethod { public Flags flags; public string message; @@ -12012,7 +12046,7 @@ namespace TL.Methods public sealed partial class Channels_UpdateEmojiStatus : IMethod { public InputChannelBase channel; - public EmojiStatus emoji_status; + public EmojiStatusBase emoji_status; } [TLDef(0xAD399CEE)] @@ -12231,7 +12265,7 @@ namespace TL.Methods public sealed partial class Bots_UpdateUserEmojiStatus : IMethod { public InputUserBase user_id; - public EmojiStatus emoji_status; + public EmojiStatusBase emoji_status; } [TLDef(0x06DE6392)] @@ -12282,15 +12316,10 @@ namespace TL.Methods } } - [TLDef(0x2855BE61)] + [TLDef(0xA1B70815)] public sealed partial class Bots_GetBotRecommendations : IMethod { - public Flags flags; public InputUserBase bot; - - [Flags] public enum Flags : uint - { - } } [TLDef(0x37148DBB)] @@ -12560,19 +12589,11 @@ namespace TL.Methods public int hash; } - [TLDef(0x5E72C7E1)] - public sealed partial class Payments_GetUserStarGifts : IMethod - { - public InputUserBase user_id; - public string offset; - public int limit; - } - - [TLDef(0x92FD2AAE)] + [TLDef(0x2A2A697C)] public sealed partial class Payments_SaveStarGift : IMethod { public Flags flags; - public int msg_id; + public InputSavedStarGift stargift; [Flags] public enum Flags : uint { @@ -12580,10 +12601,10 @@ namespace TL.Methods } } - [TLDef(0x72770C83)] + [TLDef(0x74BF076B)] public sealed partial class Payments_ConvertStarGift : IMethod { - public int msg_id; + public InputSavedStarGift stargift; } [TLDef(0x6DFA0622)] @@ -12662,11 +12683,11 @@ namespace TL.Methods public long gift_id; } - [TLDef(0xCF4F0781)] + [TLDef(0xAED6E4F5)] public sealed partial class Payments_UpgradeStarGift : IMethod { public Flags flags; - public int msg_id; + public InputSavedStarGift stargift; [Flags] public enum Flags : uint { @@ -12674,17 +12695,61 @@ namespace TL.Methods } } - [TLDef(0x333FB526)] + [TLDef(0x7F18176A)] public sealed partial class Payments_TransferStarGift : IMethod { - public int msg_id; - public InputUserBase to_id; + public InputSavedStarGift stargift; + public InputPeer to_id; } - [TLDef(0xB502E4A5)] - public sealed partial class Payments_GetUserStarGift : IMethod + [TLDef(0xA1974D72)] + public sealed partial class Payments_GetUniqueStarGift : IMethod { - public int[] msg_id; + public string slug; + } + + [TLDef(0x23830DE9)] + public sealed partial class Payments_GetSavedStarGifts : IMethod + { + public Flags flags; + public InputPeer peer; + public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + exclude_unsaved = 0x1, + exclude_saved = 0x2, + exclude_unlimited = 0x4, + exclude_limited = 0x8, + exclude_unique = 0x10, + sort_by_value = 0x20, + } + } + + [TLDef(0xB455A106)] + public sealed partial class Payments_GetSavedStarGift : IMethod + { + public InputSavedStarGift[] stargift; + } + + [TLDef(0xD06E93A8)] + public sealed partial class Payments_GetStarGiftWithdrawalUrl : IMethod + { + public InputSavedStarGift stargift; + public InputCheckPasswordSRP password; + } + + [TLDef(0x60EAEFA1)] + public sealed partial class Payments_ToggleChatStarGiftNotifications : IMethod + { + public Flags flags; + public InputPeer peer; + + [Flags] public enum Flags : uint + { + enabled = 0x1, + } } [TLDef(0x9021AB67)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9ff74e4..b3f254a 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 = 196; // fetched 02/01/2025 13:18:52 + public const int Version = 198; // fetched 22/01/2025 22:22:20 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -90,11 +90,11 @@ namespace TL [0xB3BA0635] = typeof(InputMediaPhoto), [0xF9C44144] = typeof(InputMediaGeoPoint), [0xF8AB7DFB] = typeof(InputMediaContact), - [0x5B38C6C1] = typeof(InputMediaUploadedDocument), - [0x33473058] = typeof(InputMediaDocument), + [0x037C9330] = typeof(InputMediaUploadedDocument), + [0xA8763AB5] = typeof(InputMediaDocument), [0xC13D1C11] = typeof(InputMediaVenue), [0xE5BBFE1A] = typeof(InputMediaPhotoExternal), - [0xFB52DC99] = typeof(InputMediaDocumentExternal), + [0x779600F9] = typeof(InputMediaDocumentExternal), [0xD33F43F3] = typeof(InputMediaGame), [0x405FEF0D] = typeof(InputMediaInvoice), [0x971FA843] = typeof(InputMediaGeoLive), @@ -139,7 +139,7 @@ namespace TL [0xE00998B7] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0x9FF3B858] = typeof(ChannelFull), + [0x52D6806B] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -155,7 +155,7 @@ namespace TL [0x56E0D474] = typeof(MessageMediaGeo), [0x70322949] = typeof(MessageMediaContact), [0x9F84F49E] = typeof(MessageMediaUnsupported), - [0xDD570BD5] = typeof(MessageMediaDocument), + [0x52D8CCD9] = typeof(MessageMediaDocument), [0xDDF10C3B] = typeof(MessageMediaWebPage), [0x2EC0533F] = typeof(MessageMediaVenue), [0xFDB19008] = typeof(MessageMediaGame), @@ -213,8 +213,8 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0xD8F4F0A7] = typeof(MessageActionStarGift), - [0x26077B99] = typeof(MessageActionStarGiftUnique), + [0x4717E8A4] = typeof(MessageActionStarGift), + [0xACDFCB81] = typeof(MessageActionStarGiftUnique), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -989,6 +989,7 @@ namespace TL [0x54B56617] = typeof(WebPageAttributeTheme), [0x2E94C3E7] = typeof(WebPageAttributeStory), [0x50CC03D3] = typeof(WebPageAttributeStickerSet), + [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1102,9 +1103,9 @@ namespace TL [0x98986C0D] = typeof(InputInvoicePremiumGiftCode), [0x65F00CE3] = typeof(InputInvoiceStars), [0x34E793F1] = typeof(InputInvoiceChatInviteSubscription), - [0x25D8C1D8] = typeof(InputInvoiceStarGift), - [0x5EBE7262] = typeof(InputInvoiceStarGiftUpgrade), - [0xAE3BA9ED] = typeof(InputInvoiceStarGiftTransfer), + [0xE8625E92] = typeof(InputInvoiceStarGift), + [0x4D818D5D] = typeof(InputInvoiceStarGiftUpgrade), + [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1118,8 +1119,9 @@ namespace TL [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty - [0x929B619D] = typeof(EmojiStatus), - [0xFA30A8C7] = typeof(EmojiStatusUntil), + [0xE7FF068A] = typeof(EmojiStatus), + [0x7184603B] = typeof(EmojiStatusCollectible), + [0x07141DBF] = typeof(InputEmojiStatusCollectible), [0xD08CE645] = null,//Account_EmojiStatusesNotModified [0x90C467D1] = typeof(Account_EmojiStatuses), [0x79F5D419] = null,//ReactionEmpty @@ -1210,6 +1212,7 @@ namespace TL [0x2271F2BF] = typeof(InputMediaAreaChannelPost), [0x37381085] = typeof(MediaAreaUrl), [0x49A6549C] = typeof(MediaAreaWeather), + [0x5787686D] = typeof(MediaAreaStarGift), [0x9A35E999] = typeof(PeerStories), [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), @@ -1341,11 +1344,9 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x02CC73C8] = typeof(StarGift), - [0x6A1407CD] = typeof(StarGiftUnique), + [0xF2FE7E4A] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), - [0x325835E1] = typeof(UserStarGift), - [0x6B65B517] = typeof(Payments_UserStarGifts), [0x7903E3D9] = typeof(MessageReportOption), [0xF0E4E0B6] = typeof(ReportResultChooseOption), [0x6F09AC31] = typeof(ReportResultAddComment), @@ -1365,10 +1366,17 @@ namespace TL [0x39D99013] = typeof(StarGiftAttributeModel), [0x13ACFF19] = typeof(StarGiftAttributePattern), [0x94271762] = typeof(StarGiftAttributeBackdrop), - [0xC02C4F4B] = typeof(StarGiftAttributeOriginalDetails), + [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), + [0xCAA2F60B] = typeof(Payments_UniqueStarGift), + [0xB53E8B21] = typeof(Messages_WebPagePreview), + [0x6056DBA5] = typeof(SavedStarGift), + [0x95F389B1] = typeof(Payments_SavedStarGifts), + [0x69279795] = typeof(InputSavedStarGiftUser), + [0xF101AA7F] = typeof(InputSavedStarGiftChat), + [0x84AA3A9C] = typeof(Payments_StarGiftWithdrawalUrl), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1488,6 +1496,7 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: + [typeof(EmojiStatusBase)] = 0x2DE11AAE, //emojiStatusEmpty [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified [typeof(Help_AppConfig)] = 0x7CDE641D, //help.appConfigNotModified diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ff8487a..819a3c0 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: 196 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 198 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From e5953994a76748109c85e25db79021a891304fb2 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 24 Jan 2025 00:41:48 +0100 Subject: [PATCH 270/336] property Title on ForumTopicBase --- .github/dev.yml | 2 +- src/TL.Xtended.cs | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/dev.yml b/.github/dev.yml index 97a9eb5..fefd177 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.7-dev.$(Rev:r) +name: 4.2.9-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index ef2701f..d06b07b 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -761,6 +761,9 @@ namespace TL partial class MessageReplyHeader { public int TopicID => flags.HasFlag(Flags.forum_topic) ? flags.HasFlag(Flags.has_reply_to_top_id) ? reply_to_top_id : reply_to_msg_id : 0; } partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class ForumTopicBase { public virtual string Title => null; } + partial class ForumTopic { public override string Title => title; } + partial class RequestedPeer { public abstract long ID { get; } } partial class RequestedPeerUser { public override long ID => user_id; } partial class RequestedPeerChat { public override long ID => chat_id; } From e6dde325380b489f7d5f1e78eef07efbd888e42c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 28 Jan 2025 13:46:06 +0100 Subject: [PATCH 271/336] Fix Messages_GetAllChats to include only your chats --- README.md | 2 +- src/Client.Helpers.cs | 6 +++++- src/WTelegramClient.csproj | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 2279602..d43c617 100644 --- a/README.md +++ b/README.md @@ -206,4 +206,4 @@ the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still If you like this library, you can [buy me a coffee](https://buymeacoffee.com/wizou) ❤ This will help the project keep going. -© 2024 Olivier Marcoux +© 2021-2025 Olivier Marcoux diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 69d3b22..25124ea 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -504,7 +504,11 @@ namespace WTelegram public async Task Messages_GetAllChats() { var dialogs = await Messages_GetAllDialogs(); - return new Messages_Chats { chats = dialogs.chats }; + var result = new Messages_Chats { chats = [] }; + foreach (var dialog in dialogs.dialogs) + if (dialog.Peer is (PeerChat or PeerChannel) and { ID: var id }) + result.chats[id] = dialogs.chats[id]; + return result; } /// Returns the current user dialog list. Possible codes: 400 (details) diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 819a3c0..5cd6031 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -17,7 +17,7 @@ Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) - Copyright © Olivier Marcoux 2021-2024 + Copyright © Olivier Marcoux 2021-2025 MIT https://wiz0u.github.io/WTelegramClient logo.png From edc6019f2ea3dac74582dae1647b70ec7448e0b1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 30 Jan 2025 02:22:05 +0100 Subject: [PATCH 272/336] Better support for HTML &entities; in HtmlText --- src/Services.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 4ef4379..99ce13b 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -373,9 +373,10 @@ namespace TL char c = sb[offset]; if (c == '&') { - for (end = offset + 1; end < sb.Length; end++) - if (sb[end] == ';') break; - if (end >= sb.Length) break; + end = offset + 1; + if (end < sb.Length && sb[end] == '#') end++; + while (end < sb.Length && sb[end] is >= 'a' and <= 'z' or >= 'A' and <= 'Z' or >= '0' and <= '9') end++; + if (end >= sb.Length || sb[end] != ';') break; var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); if (html.Length == 1) { @@ -421,7 +422,7 @@ namespace TL } else if (tag.StartsWith("a href=\"") && tag[^1] == '"') { - tag = tag[8..^1]; + tag = HttpUtility.HtmlDecode(tag[8..^1]); if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && users?.GetValueOrDefault(user_id)?.access_hash is long hash) entities.Add(new InputMessageEntityMentionName { offset = offset, length = -1, user_id = new InputUser(user_id, hash) }); else @@ -494,7 +495,7 @@ namespace TL if (tag[0] == 'a') { if (nextEntity is MessageEntityTextUrl metu) - tag = $""; + tag = $""; else if (nextEntity is MessageEntityMentionName memn) tag = $""; else if (nextEntity is InputMessageEntityMentionName imemn) From 1fab219ef6c5102e7ed7f1ecf9cc588145a33385 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Jan 2025 20:39:42 +0100 Subject: [PATCH 273/336] Added EmojiStatusBase.DocumentId helper --- src/TL.Xtended.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index d06b07b..7b36f1d 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -761,6 +761,10 @@ namespace TL partial class MessageReplyHeader { public int TopicID => flags.HasFlag(Flags.forum_topic) ? flags.HasFlag(Flags.has_reply_to_top_id) ? reply_to_top_id : reply_to_msg_id : 0; } partial class GroupCallBase { public static implicit operator InputGroupCall(GroupCallBase call) => new() { id = call.ID, access_hash = call.AccessHash }; } + partial class EmojiStatusBase { public virtual long DocumentId => 0; } + partial class EmojiStatus { public override long DocumentId => document_id; } + partial class EmojiStatusCollectible{ public override long DocumentId => document_id; } + partial class ForumTopicBase { public virtual string Title => null; } partial class ForumTopic { public override string Title => title; } From b626c6c644921b46d140987afd9192a10be36eaf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Feb 2025 14:12:04 +0100 Subject: [PATCH 274/336] API Layer 199: reCAPTCHA, PaidReactionPrivacy --- .github/dev.yml | 2 +- .github/release.yml | 2 +- README.md | 2 +- src/TL.Schema.cs | 28 ++++++++++++++++++----- src/TL.SchemaFuncs.cs | 46 ++++++++++++++++++++++++++++---------- src/TL.Table.cs | 10 ++++++--- src/WTelegramClient.csproj | 2 +- 7 files changed, 67 insertions(+), 25 deletions(-) diff --git a/.github/dev.yml b/.github/dev.yml index fefd177..e8a3729 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,7 @@ pr: none trigger: [ master ] -name: 4.2.9-dev.$(Rev:r) +name: 4.3.1-dev.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/.github/release.yml b/.github/release.yml index de79b3b..e4ca17f 100644 --- a/.github/release.yml +++ b/.github/release.yml @@ -1,7 +1,7 @@ pr: none trigger: none -name: 4.2.$(Rev:r) +name: 4.3.$(Rev:r) pool: vmImage: ubuntu-latest diff --git a/README.md b/README.md index d43c617..12f7892 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-198-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-199-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 749dd20..3d612af 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -257,7 +257,7 @@ namespace TL has_ttl_seconds = 0x2, /// Field has a value has_thumb = 0x4, - /// Whether the specified document is a video file with no audio tracks (a GIF animation (even as MPEG4), for example) + /// Whether to send the file as a video even if it doesn't have an audio track (i.e. if set, the attribute will not be set even for videos without audio) nosound_video = 0x8, /// Force the media file to be uploaded as document force_file = 0x10, @@ -5756,11 +5756,11 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } /// Contains the current default paid reaction privacy, see here » for more info. See - [TLDef(0x51CA7AEC)] + [TLDef(0x8B725FCE)] public sealed partial class UpdatePaidReactionPrivacy : Update { /// Whether paid reaction privacy is enabled or disabled. - public bool private_; + public PaidReactionPrivacy private_; } /// Updates state. See @@ -7118,7 +7118,7 @@ namespace TL [IfFlag(2)] public int preload_prefix_size; /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; - /// Codec used for the video, i.e. "h264", "h265", or "av1" + /// Codec used for the video, i.e. “h264”, “h265”, or “av1” [IfFlag(5)] public string video_codec; [Flags] public enum Flags : uint @@ -7129,7 +7129,7 @@ namespace TL supports_streaming = 0x2, /// Field has a value has_preload_prefix_size = 0x4, - /// Whether the specified document is a video file with no audio tracks (a GIF animation (even as MPEG4), for example) + /// Whether the specified document is a video file with no audio tracks nosound = 0x8, /// Field has a value has_video_start_ts = 0x10, @@ -7361,6 +7361,7 @@ namespace TL has_attributes = 0x1000, /// Whether the size of the media in the preview can be changed. has_large_media = 0x2000, + video_cover_photo = 0x4000, } /// Preview ID @@ -19842,7 +19843,7 @@ namespace TL public override int AvailabilityTotal => availability_total; } /// See - [TLDef(0xF2FE7E4A)] + [TLDef(0x5C62D151)] public sealed partial class StarGiftUnique : StarGiftBase { public Flags flags; @@ -19856,12 +19857,14 @@ namespace TL public StarGiftAttribute[] attributes; public int availability_issued; public int availability_total; + [IfFlag(3)] public string gift_address; [Flags] public enum Flags : uint { has_owner_id = 0x1, has_owner_name = 0x2, has_owner_address = 0x4, + has_gift_address = 0x8, } public override long ID => id; @@ -20299,4 +20302,17 @@ namespace TL { public string url; } + + /// See + /// a value means paidReactionPrivacyDefault + public abstract partial class PaidReactionPrivacy : IObject { } + /// See + [TLDef(0x1F0C1AD9)] + public sealed partial class PaidReactionPrivacyAnonymous : PaidReactionPrivacy { } + /// See + [TLDef(0xDC6CFCF0)] + public sealed partial class PaidReactionPrivacyPeer : PaidReactionPrivacy + { + public InputPeer peer; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5f025de..296b6c7 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -126,6 +126,14 @@ namespace TL query = query, }); + /// See + public static Task InvokeWithReCaptcha(this Client client, string token, IMethod query) + => client.Invoke(new InvokeWithReCaptcha + { + token = token, + query = query, + }); + /// Send the verification code for login See Possible codes: 400,406,500 (details) /// Phone number in international format /// Application identifier (see App configuration) @@ -4336,28 +4344,28 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). /// Unique client message ID required to prevent message resending You can use - /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. - public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, bool? private_ = default) + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. + public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction { - flags = (Messages_SendPaidReaction.Flags)(private_ != default ? 0x1 : 0), + flags = (Messages_SendPaidReaction.Flags)(private_ != null ? 0x1 : 0), peer = peer, msg_id = msg_id, count = count, random_id = random_id, - private_ = private_ ?? default, + private_ = private_, }); /// Changes the privacy of already sent paid reactions on a specific message. See Possible codes: 400 (details) /// The channel /// The ID of the message to which we sent the paid reactions /// If true, makes the current anonymous in the top sender leaderboard for this message; otherwise, does the opposite. - public static Task Messages_TogglePaidReactionPrivacy(this Client client, InputPeer peer, int msg_id, bool private_) + public static Task Messages_TogglePaidReactionPrivacy(this Client client, InputPeer peer, int msg_id, PaidReactionPrivacy private_) => client.Invoke(new Messages_TogglePaidReactionPrivacy { peer = peer, @@ -5253,9 +5261,10 @@ namespace TL /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) /// The group where we intend to send messages - public static Task Channels_GetSendAs(this Client client, InputPeer peer) + public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false) => client.Invoke(new Channels_GetSendAs { + flags = (Channels_GetSendAs.Flags)(for_paid_reactions ? 0x1 : 0), peer = peer, }); @@ -7612,6 +7621,13 @@ namespace TL.Methods public IMethod query; } + [TLDef(0xADBB0F94)] + public sealed partial class InvokeWithReCaptcha : IMethod + { + public string token; + public IMethod query; + } + [TLDef(0xA677244F)] public sealed partial class Auth_SendCode : IMethod { @@ -11132,7 +11148,7 @@ namespace TL.Methods } } - [TLDef(0x9DD6A67B)] + [TLDef(0x58BBCB50)] public sealed partial class Messages_SendPaidReaction : IMethod { public Flags flags; @@ -11140,7 +11156,7 @@ namespace TL.Methods public int msg_id; public int count; public long random_id; - [IfFlag(0)] public bool private_; + [IfFlag(0)] public PaidReactionPrivacy private_; [Flags] public enum Flags : uint { @@ -11148,12 +11164,12 @@ namespace TL.Methods } } - [TLDef(0x849AD397)] + [TLDef(0x435885B5)] public sealed partial class Messages_TogglePaidReactionPrivacy : IMethod { public InputPeer peer; public int msg_id; - public bool private_; + public PaidReactionPrivacy private_; } [TLDef(0x472455AA)] @@ -11840,10 +11856,16 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0x0DC770EE)] + [TLDef(0xE785A43F)] public sealed partial class Channels_GetSendAs : IMethod { + public Flags flags; public InputPeer peer; + + [Flags] public enum Flags : uint + { + for_paid_reactions = 0x1, + } } [TLDef(0x367544DB)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index b3f254a..742ecad 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 = 198; // fetched 22/01/2025 22:22:20 + public const int Version = 199; // fetched 13/02/2025 13:06:03 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -419,7 +419,7 @@ namespace TL [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), - [0x51CA7AEC] = typeof(UpdatePaidReactionPrivacy), + [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1344,7 +1344,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x02CC73C8] = typeof(StarGift), - [0xF2FE7E4A] = typeof(StarGiftUnique), + [0x5C62D151] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1377,6 +1377,9 @@ namespace TL [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), [0x84AA3A9C] = typeof(Payments_StarGiftWithdrawalUrl), + [0x206AD49E] = null,//PaidReactionPrivacyDefault + [0x1F0C1AD9] = typeof(PaidReactionPrivacyAnonymous), + [0xDC6CFCF0] = typeof(PaidReactionPrivacyPeer), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1507,6 +1510,7 @@ namespace TL [typeof(Messages_QuickReplies)] = 0x5F91EB5B, //messages.quickRepliesNotModified [typeof(Messages_AvailableEffects)] = 0xD1ED9A5B, //messages.availableEffectsNotModified [typeof(Payments_StarGifts)] = 0xA388A368, //payments.starGiftsNotModified + [typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 5cd6031..79692c1 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: 198 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 199 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From e67a688baa5c6a0a6ea7b331280ee25dcb2b50b5 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 3 Mar 2025 02:02:06 +0100 Subject: [PATCH 275/336] Building with Github Actions --- .github/dev.yml | 9 ++++-- .github/workflows/autolock.yml | 2 +- .github/workflows/dev.yml | 53 ++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 56 ++++++++++++++++++++++++++++++++++ src/Client.cs | 1 + src/TlsStream.cs | 6 ++-- src/WTelegramClient.csproj | 4 +-- 7 files changed, 122 insertions(+), 9 deletions(-) create mode 100644 .github/workflows/dev.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/dev.yml b/.github/dev.yml index e8a3729..6206e8e 100644 --- a/.github/dev.yml +++ b/.github/dev.yml @@ -1,7 +1,11 @@ pr: none -trigger: [ master ] +trigger: + branches: + include: [ master ] + paths: + exclude: [ '.github', '*.md', 'Examples' ] -name: 4.3.1-dev.$(Rev:r) +name: 4.3.2-dev.$(Rev:r) pool: vmImage: ubuntu-latest @@ -57,4 +61,3 @@ stages: "message": "{ \"commitId\": \"$(Build.SourceVersion)\", \"buildNumber\": \"$(Build.BuildNumber)\", \"teamProjectName\": \"$(System.TeamProject)\", \"commitMessage\": \"$(Release_Notes)\" }" } waitForCompletion: 'false' - \ No newline at end of file diff --git a/.github/workflows/autolock.yml b/.github/workflows/autolock.yml index 0bd8a20..9a676bc 100644 --- a/.github/workflows/autolock.yml +++ b/.github/workflows/autolock.yml @@ -2,7 +2,7 @@ name: 'Auto-Lock Issues' on: schedule: - - cron: '17 2 * * *' + - cron: '17 2 * * 1' workflow_dispatch: permissions: diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml new file mode 100644 index 0000000..6130d21 --- /dev/null +++ b/.github/workflows/dev.yml @@ -0,0 +1,53 @@ +name: Dev build + +on: + push: + branches: [ master ] + paths-ignore: [ '.**', 'Examples/**', '**.md' ] + +env: + PROJECT_PATH: src/WTelegramClient.csproj + CONFIGURATION: Release + RELEASE_NOTES: ${{ github.event.head_commit.message }} + +jobs: + build: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 100 + - name: Determine version + run: | + git fetch --depth=100 --tags + DESCR_TAG=$(git describe --tags) + COMMITS=${DESCR_TAG#*-} + COMMITS=${COMMITS%-*} + LAST_TAG=${DESCR_TAG%%-*} + NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1))-dev.$COMMITS + RELEASE_VERSION=${{vars.RELEASE_VERSION}}-dev.$COMMITS + if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi + echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Pack + run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + # - name: Upload artifact + # uses: actions/upload-artifact@v4 + # with: + # name: packages + # path: packages/*.nupkg + - name: Nuget push + run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Deployment Notification + env: + JSON: | + { + "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "message": "{ \"commitId\": \"${{ github.event.head_commit.id }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"teamProjectName\": \"${{ github.event.repository.name }}\"}" + } + run: | + curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..5d1519e --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release build + +on: + workflow_dispatch: + inputs: + release_notes: + description: 'Release notes' + required: true + version: + description: "Release version (leave empty for automatic versioning)" + +run-name: '📌 Release build ${{ inputs.version }}' + +env: + PROJECT_PATH: src/WTelegramClient.csproj + CONFIGURATION: Release + RELEASE_NOTES: ${{ inputs.release_notes }} + VERSION: ${{ inputs.version }} + +jobs: + build: + runs-on: ubuntu-latest + permissions: + contents: write # For git tag + steps: + - uses: actions/checkout@v4 + with: + fetch-depth: 100 + - name: Determine version + if: ${{ env.VERSION == '' }} + run: | + git fetch --depth=100 --tags + DESCR_TAG=$(git describe --tags) + LAST_TAG=${DESCR_TAG%%-*} + NEXT_VERSION=${LAST_TAG%.*}.$((${LAST_TAG##*.} + 1)) + RELEASE_VERSION=${{vars.RELEASE_VERSION}} + if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi + echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION + echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Pack + run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + # - name: Upload artifact + # uses: actions/upload-artifact@v4 + # with: + # name: packages + # path: packages/*.nupkg + - name: Nuget push + run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Git tag + run: | + git tag $VERSION + git push --tags diff --git a/src/Client.cs b/src/Client.cs index fead981..fa172e6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -292,6 +292,7 @@ namespace WTelegram /// ID of the Data Center (use negative values for media_only) /// Connect immediately /// Client connected to the selected DC + /// ⚠️ You shouldn't have to use this method unless you know what you're doing public async Task GetClientForDC(int dcId, bool connect = true) { if (_dcSession.DataCenter?.id == dcId) return this; diff --git a/src/TlsStream.cs b/src/TlsStream.cs index 3adc277..4e6ff30 100644 --- a/src/TlsStream.cs +++ b/src/TlsStream.cs @@ -100,7 +100,7 @@ namespace WTelegram static readonly byte[] TlsClientHello3 = [ // 0x00, 0x00, len { len { 0x00 len { domain } } } len is 16-bit big-endian length of the following block of data 0x00, 0x05, 0x00, 0x05, 0x01, 0x00, 0x00, 0x00, 0x00, - 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A,/*=grease(4)*/ 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, + 0x00, 0x0a, 0x00, 0x0a, 0x00, 0x08, 0x4A, 0x4A/*=grease(4)*/, 0x00, 0x1d, 0x00, 0x17, 0x00, 0x18, 0x00, 0x0b, 0x00, 0x02, 0x01, 0x00, 0x00, 0x0d, 0x00, 0x12, 0x00, 0x10, 0x04, 0x03, 0x08, 0x04, 0x04, 0x01, 0x05, 0x03, 0x08, 0x05, 0x05, 0x01, 0x08, 0x06, 0x06, 0x01, 0x00, 0x10, 0x00, 0x0e, 0x00, 0x0c, 0x02, 0x68, 0x32, 0x08, 0x68, 0x74, 0x74, 0x70, 0x2f, 0x31, 0x2e, 0x31, @@ -108,9 +108,9 @@ namespace WTelegram 0x00, 0x17, 0x00, 0x00, 0x00, 0x1b, 0x00, 0x03, 0x02, 0x00, 0x02, 0x00, 0x23, 0x00, 0x00, - 0x00, 0x2b, 0x00, 0x07, 0x06, 0x6A, 0x6A,/*=grease(6) */ 0x03, 0x04, 0x03, 0x03, + 0x00, 0x2b, 0x00, 0x07, 0x06, 0x6A, 0x6A/*=grease(6)*/, 0x03, 0x04, 0x03, 0x03, 0x00, 0x2d, 0x00, 0x02, 0x01, 0x01, - 0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A,/*=grease(4) */ 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */ + 0x00, 0x33, 0x00, 0x2b, 0x00, 0x29, 0x4A, 0x4A/*=grease(4)*/, 0x00, 0x01, 0x00, 0x00, 0x1d, 0x00, 0x20, /* random[32] */ 0x44, 0x69, 0x00, 0x05, 0x00, 0x03, 0x02, 0x68, 0x32, 0xff, 0x01, 0x00, 0x01, 0x00, ]; diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 79692c1..b54e320 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -33,8 +33,8 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "% - - + + From 1ecd7047eff47111c5ffe5f2abc1ba0e74819657 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 8 Mar 2025 00:21:50 +0100 Subject: [PATCH 276/336] API Layer 200: Paid messages, details on chat partner, ... --- README.md | 2 +- src/TL.Schema.cs | 124 ++++++++++++++++++++++++++----------- src/TL.SchemaFuncs.cs | 119 ++++++++++++++++++++++++++++------- src/TL.Table.cs | 23 ++++--- src/WTelegramClient.csproj | 2 +- 5 files changed, 201 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 12f7892..47419e1 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-199-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-200-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 3d612af..5caaf90 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -768,7 +768,7 @@ namespace TL public long id; } /// Indicates info about a certain user. See - [TLDef(0x4B46C37E)] + [TLDef(0x020B1422)] public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -812,6 +812,7 @@ namespace TL /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; [IfFlag(46)] public long bot_verification_icon; + [IfFlag(47)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { @@ -901,6 +902,8 @@ namespace TL bot_has_main_app = 0x2000, /// Field has a value has_bot_verification_icon = 0x4000, + /// Field has a value + has_send_paid_messages_stars = 0x8000, } } @@ -1071,7 +1074,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0xE00998B7)] + [TLDef(0x7482147E)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1115,6 +1118,7 @@ namespace TL /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; [IfFlag(45)] public long bot_verification_icon; + [IfFlag(46)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { @@ -1198,6 +1202,8 @@ namespace TL signature_profiles = 0x1000, /// Field has a value has_bot_verification_icon = 0x2000, + /// Field has a value + has_send_paid_messages_stars = 0x4000, } /// ID of the channel, see here » for more info @@ -1580,6 +1586,7 @@ namespace TL /// Field has a value has_stargifts_count = 0x40000, stargifts_available = 0x80000, + paid_messages_available = 0x100000, } /// ID of the channel @@ -1757,7 +1764,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x96FDBBE9)] + [TLDef(0xEABCDD4D)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1817,6 +1824,7 @@ namespace TL /// Represents a fact-check ». [IfFlag(35)] public FactCheck factcheck; [IfFlag(37)] public DateTime report_delivery_until_date; + [IfFlag(38)] public long paid_message_stars; [Flags] public enum Flags : uint { @@ -1894,6 +1902,8 @@ namespace TL video_processing_pending = 0x10, /// Field has a value has_report_delivery_until_date = 0x20, + /// Field has a value + has_paid_message_stars = 0x40, } /// ID of the message @@ -2742,12 +2752,14 @@ namespace TL via_giveaway = 0x1, /// Field has a value has_boost_peer = 0x2, - /// If set, the link was not redeemed yet. - unclaimed = 0x4, + /// Fields and have a value + has_currency = 0x4, /// Fields and have a value has_crypto_currency = 0x8, /// Field has a value has_message = 0x10, + /// If set, the link was not redeemed yet. + unclaimed = 0x20, } } /// A giveaway was started. See @@ -3392,7 +3404,7 @@ namespace TL } /// List of actions that are possible when interacting with this user, to be shown as suggested actions in the chat action bar », see here » for more info. See - [TLDef(0xACD66C5E)] + [TLDef(0xF47741F7)] public sealed partial class PeerSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3407,6 +3419,11 @@ namespace TL [IfFlag(13)] public long business_bot_id; /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; + [IfFlag(14)] public long charge_paid_message_stars; + [IfFlag(15)] public string registration_month; + [IfFlag(16)] public string phone_country; + [IfFlag(17)] public DateTime name_change_date; + [IfFlag(18)] public DateTime photo_change_date; [Flags] public enum Flags : uint { @@ -3438,6 +3455,16 @@ namespace TL business_bot_can_reply = 0x1000, /// Fields and have a value has_business_bot_id = 0x2000, + /// Field has a value + has_charge_paid_message_stars = 0x4000, + /// Field has a value + has_registration_month = 0x8000, + /// Field has a value + has_phone_country = 0x10000, + /// Field has a value + has_name_change_date = 0x20000, + /// Field has a value + has_photo_change_date = 0x40000, } } @@ -3538,7 +3565,7 @@ namespace TL } /// Extended user info See - [TLDef(0x4D975BBC)] + [TLDef(0xD2234EA0)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3577,8 +3604,6 @@ namespace TL [IfFlag(17)] public ChatAdminRights bot_group_admin_rights; /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a channel, see here for more info on how to handle them ». [IfFlag(18)] public ChatAdminRights bot_broadcast_admin_rights; - /// Telegram Premium subscriptions gift options - [IfFlag(19)] public PremiumGiftOption[] premium_gifts; /// Wallpaper to use in the private chat with the user. [IfFlag(24)] public WallPaperBase wallpaper; /// Active stories » @@ -3604,6 +3629,7 @@ namespace TL /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; [IfFlag(44)] public BotVerification bot_verification; + [IfFlag(46)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { @@ -3639,8 +3665,6 @@ 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, /// Whether this user doesn't allow sending voice messages in a private chat with them voice_messages_forbidden = 0x100000, /// Field has a value @@ -3693,6 +3717,8 @@ namespace TL has_starref_program = 0x800, /// Field has a value has_bot_verification = 0x1000, + /// Field has a value + has_send_paid_messages_stars = 0x4000, } } @@ -6904,6 +6930,8 @@ namespace TL Birthday = 0xD65A11CC, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0xE1732341, + ///See + NoPaidMessages = 0xBDC597B4, } /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See @@ -6933,6 +6961,8 @@ namespace TL Birthday = 0x2000A518, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0x2CA4FDF8, + ///See + NoPaidMessages = 0x17D348D2, } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , , , @@ -14454,11 +14484,12 @@ namespace TL } /// Global privacy settings See - [TLDef(0x734C4CCB)] + [TLDef(0xC9D8DF1C)] 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; [Flags] public enum Flags : uint { @@ -14472,6 +14503,8 @@ namespace TL hide_read_marks = 0x8, /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
This option may be enabled by both non-
Premium and Premium users only if the new_noncontact_peers_require_premium_without_ownpremium client configuration flag » is equal to true, otherwise it may be enabled only by Premium users and non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
new_noncontact_peers_require_premium = 0x10, + /// Field has a value + has_noncontact_peers_paid_stars = 0x20, } } @@ -15865,6 +15898,20 @@ namespace TL public InputSavedStarGift stargift; public InputPeer to_id; } + /// See + [TLDef(0xDABAB2EF)] + public sealed partial class InputInvoicePremiumGiftStars : InputInvoice + { + public Flags flags; + public InputUserBase user_id; + public int months; + [IfFlag(0)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + has_message = 0x1, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -16072,30 +16119,6 @@ namespace TL } } - /// Telegram Premium gift option See - [TLDef(0x74C34319)] - public sealed partial class PremiumGiftOption : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Duration of gifted Telegram Premium subscription - public int months; - /// 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 amount; - /// An invoice deep link » to an invoice for in-app payment, using the official Premium bot; may be empty if direct payment isn't available. - public string bot_url; - /// An identifier for the App Store/Play Store product associated with the Premium gift. - [IfFlag(0)] public string store_product; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_store_product = 0x1, - } - } - /// Represents an additional payment method See [TLDef(0x88F8F21B)] public sealed partial class PaymentFormMethod : IObject @@ -19349,7 +19372,7 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0x64DFC926)] + [TLDef(0xA39FD94A)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19392,6 +19415,8 @@ namespace TL [IfFlag(17)] public Peer starref_peer; /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. [IfFlag(17)] public StarsAmount starref_amount; + [IfFlag(19)] public int paid_messages; + [IfFlag(20)] public int premium_gift_months; [Flags] public enum Flags : uint { @@ -19432,6 +19457,10 @@ namespace TL /// Fields and have a value has_starref_peer = 0x20000, stargift_upgrade = 0x40000, + /// Field has a value + has_paid_messages = 0x80000, + /// Field has a value + has_premium_gift_months = 0x100000, } } @@ -20256,6 +20285,7 @@ namespace TL refunded = 0x200, can_upgrade = 0x400, has_saved_id = 0x800, + pinned_to_top = 0x1000, } } @@ -20315,4 +20345,24 @@ namespace TL { public InputPeer peer; } + + /// See + [TLDef(0x1E109708)] + public sealed partial class Account_PaidMessagesRevenue : IObject + { + public long stars_amount; + } + + /// See + /// a value means requirementToContactEmpty + public abstract partial class RequirementToContact : IObject { } + /// See + [TLDef(0xE581E4E9)] + public sealed partial class RequirementToContactPremium : RequirementToContact { } + /// See + [TLDef(0xB4F67E93)] + public sealed partial class RequirementToContactPaidMessages : RequirementToContact + { + public long stars_amount; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 296b6c7..004175d 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,6 +1433,21 @@ namespace TL hash = hash, }); + /// See + public static Task Account_AddNoPaidMessagesException(this Client client, InputUserBase user_id, bool refund_charged = false) + => client.Invoke(new Account_AddNoPaidMessagesException + { + flags = (Account_AddNoPaidMessagesException.Flags)(refund_charged ? 0x1 : 0), + user_id = user_id, + }); + + /// See + public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id) + => client.Invoke(new Account_GetPaidMessagesRevenue + { + user_id = user_id, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1459,10 +1474,9 @@ namespace TL errors = errors, }); - /// Check whether we can write to the specified user (this method can only be called by non-Premium users), see here » for more info on the full flow. See - /// Users to fetch info about. - public static Task Users_GetIsPremiumRequiredToContact(this Client client, params InputUserBase[] id) - => client.Invoke(new Users_GetIsPremiumRequiredToContact + /// See + public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) + => client.Invoke(new Users_GetRequirementsToContact { id = id, }); @@ -1880,10 +1894,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1894,6 +1908,7 @@ namespace TL send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, + allow_paid_stars = allow_paid_stars ?? default, }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1915,10 +1930,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1930,6 +1945,7 @@ namespace TL send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, + allow_paid_stars = allow_paid_stars ?? default, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1948,10 +1964,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1961,6 +1977,7 @@ namespace TL send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, video_timestamp = video_timestamp ?? default, + allow_paid_stars = allow_paid_stars ?? default, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) @@ -2458,10 +2475,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. - public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) + public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { - flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), + flags = (Messages_SendInlineBotResult.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (hide_via ? 0x800 : 0)), peer = peer, reply_to = reply_to, random_id = random_id, @@ -2470,6 +2487,7 @@ namespace TL schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + allow_paid_stars = allow_paid_stars ?? default, }); /// Find out if a media message's caption can be edited See Possible codes: 400,403 (details) @@ -2905,10 +2923,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMultiMedia { - flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMultiMedia.Flags)((reply_to != null ? 0x1 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, multi_media = multi_media, @@ -2916,6 +2934,7 @@ namespace TL send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, + allow_paid_stars = allow_paid_stars ?? default, }); /// Upload encrypted file and associate it to a secret chat See Possible codes: 400 (details) @@ -5558,6 +5577,14 @@ namespace TL limit = limit, }); + /// See + public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars) + => client.Invoke(new Channels_UpdatePaidMessagesPrice + { + channel = channel, + send_paid_messages_stars = send_paid_messages_stars, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -6331,6 +6358,14 @@ namespace TL peer = peer, }); + /// See + public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) + => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop + { + peer = peer, + stargift = stargift, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8663,6 +8698,24 @@ namespace TL.Methods public long hash; } + [TLDef(0x6F688AA7)] + public sealed partial class Account_AddNoPaidMessagesException : IMethod + { + public Flags flags; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + refund_charged = 0x1, + } + } + + [TLDef(0xF1266F38)] + public sealed partial class Account_GetPaidMessagesRevenue : IMethod + { + public InputUserBase user_id; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -8682,8 +8735,8 @@ namespace TL.Methods public SecureValueErrorBase[] errors; } - [TLDef(0xA622AA10)] - public sealed partial class Users_GetIsPremiumRequiredToContact : IMethod + [TLDef(0xD89A83A3)] + public sealed partial class Users_GetRequirementsToContact : IMethod { public InputUserBase[] id; } @@ -9028,7 +9081,7 @@ namespace TL.Methods } } - [TLDef(0x983F9745)] + [TLDef(0xFBF2340A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9042,6 +9095,7 @@ namespace TL.Methods [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; + [IfFlag(21)] public long allow_paid_stars; [Flags] public enum Flags : uint { @@ -9060,10 +9114,11 @@ namespace TL.Methods has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, allow_paid_floodskip = 0x80000, + has_allow_paid_stars = 0x200000, } } - [TLDef(0x7852834E)] + [TLDef(0xA550CD78)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9078,6 +9133,7 @@ namespace TL.Methods [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; + [IfFlag(21)] public long allow_paid_stars; [Flags] public enum Flags : uint { @@ -9095,10 +9151,11 @@ namespace TL.Methods has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, allow_paid_floodskip = 0x80000, + has_allow_paid_stars = 0x200000, } } - [TLDef(0x6D74DA08)] + [TLDef(0xBB9FA475)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9111,6 +9168,7 @@ namespace TL.Methods [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(20)] public int video_timestamp; + [IfFlag(21)] public long allow_paid_stars; [Flags] public enum Flags : uint { @@ -9126,6 +9184,7 @@ namespace TL.Methods has_quick_reply_shortcut = 0x20000, allow_paid_floodskip = 0x80000, has_video_timestamp = 0x100000, + has_allow_paid_stars = 0x200000, } } @@ -9519,7 +9578,7 @@ namespace TL.Methods } } - [TLDef(0x3EBEE86A)] + [TLDef(0xC0CF7646)] public sealed partial class Messages_SendInlineBotResult : IMethod { public Flags flags; @@ -9531,6 +9590,7 @@ namespace TL.Methods [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(21)] public long allow_paid_stars; [Flags] public enum Flags : uint { @@ -9542,6 +9602,7 @@ namespace TL.Methods hide_via = 0x800, has_send_as = 0x2000, has_quick_reply_shortcut = 0x20000, + has_allow_paid_stars = 0x200000, } } @@ -9933,7 +9994,7 @@ namespace TL.Methods public long hash; } - [TLDef(0x37B74355)] + [TLDef(0x1BF89D74)] public sealed partial class Messages_SendMultiMedia : IMethod { public Flags flags; @@ -9944,6 +10005,7 @@ namespace TL.Methods [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; + [IfFlag(21)] public long allow_paid_stars; [Flags] public enum Flags : uint { @@ -9959,6 +10021,7 @@ namespace TL.Methods has_quick_reply_shortcut = 0x20000, has_effect = 0x40000, allow_paid_floodskip = 0x80000, + has_allow_paid_stars = 0x200000, } } @@ -12102,6 +12165,13 @@ namespace TL.Methods public int limit; } + [TLDef(0xFC84653F)] + public sealed partial class Channels_UpdatePaidMessagesPrice : IMethod + { + public InputChannelBase channel; + public long send_paid_messages_stars; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -12774,6 +12844,13 @@ namespace TL.Methods } } + [TLDef(0x1513E7B0)] + public sealed partial class Payments_ToggleStarGiftsPinnedToTop : IMethod + { + public InputPeer peer; + public InputSavedStarGift[] stargift; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 742ecad..1b55bf1 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 = 199; // fetched 13/02/2025 13:06:03 + public const int Version = 200; // fetched 07/03/2025 23:09:37 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -124,7 +124,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x4B46C37E] = typeof(User), + [0x020B1422] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -136,7 +136,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0xE00998B7] = typeof(Channel), + [0x7482147E] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0x52D6806B] = typeof(ChannelFull), @@ -148,7 +148,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x96FDBBE9] = typeof(Message), + [0xEABCDD4D] = typeof(Message), [0xD3D28540] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -239,10 +239,10 @@ namespace TL [0x5C467992] = typeof(InputNotifyForumTopic), [0xCACB6AE2] = typeof(InputPeerNotifySettings), [0x99622C0C] = typeof(PeerNotifySettings), - [0xACD66C5E] = typeof(PeerSettings), + [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x4D975BBC] = typeof(UserFull), + [0xD2234EA0] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -1013,7 +1013,7 @@ namespace TL [0xD7584C87] = typeof(StatsGroupTopAdmin), [0x535F779D] = typeof(StatsGroupTopInviter), [0xEF7FF916] = typeof(Stats_MegagroupStats), - [0x734C4CCB] = typeof(GlobalPrivacySettings), + [0xC9D8DF1C] = typeof(GlobalPrivacySettings), [0x4203C5EF] = typeof(Help_CountryCode), [0xC3878E23] = typeof(Help_Country), [0x93CC1F32] = null,//Help_CountriesListNotModified @@ -1106,6 +1106,7 @@ namespace TL [0xE8625E92] = typeof(InputInvoiceStarGift), [0x4D818D5D] = typeof(InputInvoiceStarGiftUpgrade), [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), + [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1116,7 +1117,6 @@ namespace TL [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), [0x751F08FA] = typeof(InputStorePaymentStarsGiveaway), - [0x74C34319] = typeof(PremiumGiftOption), [0x88F8F21B] = typeof(PaymentFormMethod), [0x2DE11AAE] = null,//EmojiStatusEmpty [0xE7FF068A] = typeof(EmojiStatus), @@ -1324,7 +1324,7 @@ namespace TL [0x60682812] = typeof(StarsTransactionPeerAds), [0xF9677AAD] = typeof(StarsTransactionPeerAPI), [0x0BD915C0] = typeof(StarsTopupOption), - [0x64DFC926] = typeof(StarsTransaction), + [0xA39FD94A] = typeof(StarsTransaction), [0x6C9CE8ED] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), @@ -1380,6 +1380,10 @@ namespace TL [0x206AD49E] = null,//PaidReactionPrivacyDefault [0x1F0C1AD9] = typeof(PaidReactionPrivacyAnonymous), [0xDC6CFCF0] = typeof(PaidReactionPrivacyPeer), + [0x1E109708] = typeof(Account_PaidMessagesRevenue), + [0x050A9839] = null,//RequirementToContactEmpty + [0xE581E4E9] = typeof(RequirementToContactPremium), + [0xB4F67E93] = typeof(RequirementToContactPaidMessages), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1511,6 +1515,7 @@ namespace TL [typeof(Messages_AvailableEffects)] = 0xD1ED9A5B, //messages.availableEffectsNotModified [typeof(Payments_StarGifts)] = 0xA388A368, //payments.starGiftsNotModified [typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault + [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index b54e320..dd5cdd1 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: 199 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 200 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 0867c044fa55e0d1fdeb1c20e6392a454f08d893 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 12 Mar 2025 02:17:36 +0100 Subject: [PATCH 277/336] Handle CONNECTION_NOT_INITED --- .github/workflows/dev.yml | 2 +- src/Client.cs | 44 ++++++++++++++++++++++++--------------- 2 files changed, 28 insertions(+), 18 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 6130d21..a30001c 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -47,7 +47,7 @@ jobs: JSON: | { "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, - "message": "{ \"commitId\": \"${{ github.event.head_commit.id }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"teamProjectName\": \"${{ github.event.repository.name }}\"}" + "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" } run: | curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }} diff --git a/src/Client.cs b/src/Client.cs index fa172e6..2dc60d6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -985,23 +985,7 @@ namespace WTelegram else { if (_dcSession.Layer != 0 && _dcSession.Layer != Layer.Version) _dcSession.Renew(); - var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonDocument.Parse(Config("init_params")).RootElement); - TLConfig = await this.InvokeWithLayer(Layer.Version, - new TL.Methods.InitConnection - { - flags = TL.Methods.InitConnection.Flags.has_params, - api_id = _session.ApiId, - device_model = Config("device_model"), - system_version = Config("system_version"), - app_version = Config("app_version"), - system_lang_code = Config("system_lang_code"), - lang_pack = Config("lang_pack"), - lang_code = Config("lang_code"), - params_ = initParams, - query = new TL.Methods.Help_GetConfig() - }); - _dcSession.Layer = Layer.Version; - _session.DcOptions = TLConfig.dc_options; + await InitConnection(); if (_dcSession.DataCenter == null) { _dcSession.DataCenter = _session.DcOptions.Where(dc => dc.id == TLConfig.this_dc) @@ -1022,6 +1006,27 @@ namespace WTelegram Helpers.Log(2, $"Connected to {(TLConfig.test_mode ? "Test DC" : "DC")} {TLConfig.this_dc}... {TLConfig.flags & (Config.Flags)~0x18E00U}"); } + private async Task InitConnection() + { + var initParams = JSONValue.FromJsonElement(System.Text.Json.JsonDocument.Parse(Config("init_params")).RootElement); + TLConfig = await this.InvokeWithLayer(Layer.Version, + new TL.Methods.InitConnection + { + flags = TL.Methods.InitConnection.Flags.has_params, + api_id = _session.ApiId, + device_model = Config("device_model"), + system_version = Config("system_version"), + app_version = Config("app_version"), + system_lang_code = Config("system_lang_code"), + lang_pack = Config("lang_pack"), + lang_code = Config("lang_code"), + params_ = initParams, + query = new TL.Methods.Help_GetConfig() + }); + _dcSession.Layer = Layer.Version; + _session.DcOptions = TLConfig.dc_options; + } + private async Task KeepAlive(CancellationToken ct) { int ping_id = _random.Next(); @@ -1615,6 +1620,11 @@ namespace WTelegram got503 = true; goto retry; } + else if (code == 400 && message == "CONNECTION_NOT_INITED") + { + await InitConnection(); + goto retry; + } else if (code == 500 && message == "AUTH_RESTART") { _session.UserId = 0; // force a full login authorization flow, next time From e6a4b802e719880a74f9d7ed615c793426b30c6b Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 23 Mar 2025 03:10:04 +0100 Subject: [PATCH 278/336] Html/Markdown: prune entities of length=0 (fix wiz0u/WTelegramBot#6) --- src/Services.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 99ce13b..d62b877 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -458,11 +458,13 @@ namespace TL { int newlen = sb.Length; while (--newlen >= 0 && char.IsWhiteSpace(sb[newlen])); - if (++newlen == sb.Length) return; - sb.Length = newlen; - foreach (var entity in entities) - if (entity.offset + entity.length > newlen) - entity.length = newlen - entity.offset; + if (++newlen != sb.Length) sb.Length = newlen; + for (int i = 0; i < entities.Count; i++) + { + var entity = entities[i]; + if (entity.offset + entity.length > newlen) entity.length = newlen - entity.offset; + if (entity.length == 0) entities.RemoveAt(i--); + } } /// Converts the (plain text + entities) format used by Telegram messages into an HTML-formatted text From 3f1d4eba921e0b0944d68f446588d9b5a993081e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 27 Mar 2025 00:59:57 +0100 Subject: [PATCH 279/336] API Layer 201: Paid msg service messages, Gifts settings, Business bot rights, sentCodePayment, sponsored peers ... --- README.md | 2 +- src/TL.Schema.cs | 134 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 77 +++++++++++---------- src/TL.Table.cs | 21 ++++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 185 insertions(+), 51 deletions(-) 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")) From f495f59bc88c1d690a673b117e10205163bf1cdc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 2 Apr 2025 05:58:04 +0200 Subject: [PATCH 280/336] Use media DC for uploads --- src/Client.Helpers.cs | 5 +++-- src/Client.cs | 2 +- src/TL.Xtended.cs | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 25124ea..eefcd36 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -33,6 +33,7 @@ namespace WTelegram /// an or than can be used in various requests public async Task UploadFileAsync(Stream stream, string filename, ProgressCallback progress = null) { + var client = await GetClientForDC(-_dcSession.DcID, true); using (stream) { bool hasLength = stream.CanSeek; @@ -65,9 +66,9 @@ namespace WTelegram try { if (isBig) - await this.Upload_SaveBigFilePart(file_id, file_part, file_total_parts, bytes); + await client.Upload_SaveBigFilePart(file_id, file_part, file_total_parts, bytes); else - await this.Upload_SaveFilePart(file_id, file_part, bytes); + await client.Upload_SaveFilePart(file_id, file_part, bytes); lock (tasks) { transmitted += bytes.Length; tasks.Remove(file_part); } progress?.Invoke(transmitted, length); } diff --git a/src/Client.cs b/src/Client.cs index 2dc60d6..29d50b7 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -312,7 +312,7 @@ namespace WTelegram try { Auth_ExportedAuthorization exported = null; - if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId) + if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId && altSession.DcID != _dcSession.DcID) exported = await this.Auth_ExportAuthorization(Math.Abs(dcId)); await altSession.Client.ConnectAsync(); if (exported != null) diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 7b36f1d..30a2c39 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -525,7 +525,7 @@ namespace TL partial class Document { public override long ID => id; - public override string ToString() => Filename is string filename ? base.ToString() + ": " + filename : base.ToString(); + public override string ToString() => $"{Filename ?? $"Document {mime_type}"} {size:N0} bytes"; public string Filename => GetAttribute()?.file_name; protected override InputDocument ToInputDocument() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputDocumentFileLocation ToFileLocation(PhotoSizeBase thumbSize = null) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = thumbSize?.Type }; From 6d238dc528e28e490f877ccedb722774ca91d6ea Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 6 Apr 2025 19:48:43 +0200 Subject: [PATCH 281/336] Store less stuff in session data and reduce save frequency for better performance. --- Examples/Program_Heroku.cs | 22 +++------- src/Client.cs | 88 ++++++++++++++++++++------------------ src/Encryption.cs | 8 ++-- src/Session.cs | 19 ++++---- 4 files changed, 67 insertions(+), 70 deletions(-) diff --git a/Examples/Program_Heroku.cs b/Examples/Program_Heroku.cs index 5ae5fe7..4ad3740 100644 --- a/Examples/Program_Heroku.cs +++ b/Examples/Program_Heroku.cs @@ -62,10 +62,8 @@ namespace WTelegramClientTest { private readonly NpgsqlConnection _sql; private readonly string _sessionName; - private byte[] _data; - private int _dataLen; - private DateTime _lastWrite; - private Task _delayedWrite; + private readonly byte[] _data; + private readonly int _dataLen; /// Heroku DB URL of the form "postgres://user:password@host:port/database" /// Entry name for the session data in the WTelegram_sessions table (default: "Heroku") @@ -85,7 +83,6 @@ namespace WTelegramClientTest protected override void Dispose(bool disposing) { - _delayedWrite?.Wait(); _sql.Dispose(); } @@ -97,18 +94,9 @@ namespace WTelegramClientTest public override void Write(byte[] buffer, int offset, int count) // Write call and buffer modifications are done within a lock() { - _data = buffer; _dataLen = count; - if (_delayedWrite != null) return; - var left = 1000 - (int)(DateTime.UtcNow - _lastWrite).TotalMilliseconds; - if (left < 0) - { - using var cmd = new NpgsqlCommand($"INSERT INTO WTelegram_sessions (name, data) VALUES ('{_sessionName}', @data) ON CONFLICT (name) DO UPDATE SET data = EXCLUDED.data", _sql); - cmd.Parameters.AddWithValue("data", count == buffer.Length ? buffer : buffer[offset..(offset + count)]); - cmd.ExecuteNonQuery(); - _lastWrite = DateTime.UtcNow; - } - else // delay writings for a full second - _delayedWrite = Task.Delay(left).ContinueWith(t => { lock (this) { _delayedWrite = null; Write(_data, 0, _dataLen); } }); + using var cmd = new NpgsqlCommand($"INSERT INTO WTelegram_sessions (name, data) VALUES ('{_sessionName}', @data) ON CONFLICT (name) DO UPDATE SET data = EXCLUDED.data", _sql); + cmd.Parameters.AddWithValue("data", count == buffer.Length ? buffer : buffer[offset..(offset + count)]); + cmd.ExecuteNonQuery(); } public override long Length => _dataLen; diff --git a/src/Client.cs b/src/Client.cs index 29d50b7..74e0b7a 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -115,7 +115,7 @@ namespace WTelegram _session = Session.LoadOrCreate(sessionStore, Convert.FromHexString(session_key)); if (_session.ApiId == 0) _session.ApiId = int.Parse(Config("api_id")); if (_session.MainDC != 0) _session.DCSessions.TryGetValue(_session.MainDC, out _dcSession); - _dcSession ??= new() { Id = Helpers.RandomLong() }; + _dcSession ??= new(); _dcSession.Client = this; var version = Assembly.GetExecutingAssembly().GetCustomAttribute().InformationalVersion; Helpers.Log(1, $"WTelegramClient {version} running under {System.Runtime.InteropServices.RuntimeInformation.FrameworkDescription}"); @@ -272,8 +272,8 @@ namespace WTelegram // we have already negociated an AuthKey with this DC if (dcSession.DataCenter.flags == flags && _session.DCSessions.Remove(-dcId)) return _session.DCSessions[dcId] = dcSession; // we found a misclassed DC, change its sign - dcSession = new Session.DCSession { Id = Helpers.RandomLong(), // clone AuthKey for a session on the matching media_only DC - AuthKeyID = dcSession.AuthKeyID, AuthKey = dcSession.AuthKey, UserId = dcSession.UserId }; + dcSession = new Session.DCSession { // clone AuthKey for a session on the matching media_only DC + authKeyID = dcSession.authKeyID, AuthKey = dcSession.AuthKey, UserId = dcSession.UserId }; } // try to find the most appropriate DcOption for this DC if (dcSession?.AuthKey == null) // we'll need to negociate an AuthKey => can't use media_only DC @@ -283,7 +283,7 @@ namespace WTelegram } var dcOptions = GetDcOptions(Math.Abs(dcId), flags); var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); - dcSession ??= new Session.DCSession { Id = Helpers.RandomLong() }; // create new session only if not already existing + dcSession ??= new(); // create new session only if not already existing dcSession.DataCenter = dcOption; return _session.DCSessions[dcId] = dcSession; } @@ -302,6 +302,7 @@ namespace WTelegram var flags = _dcSession.DataCenter.flags; if (dcId < 0) flags = (flags & DcOption.Flags.ipv6) | DcOption.Flags.media_only; altSession = GetOrCreateDCSession(dcId, flags); + _session.Save(); if (altSession.Client?.Disconnected ?? false) { altSession.Client.Dispose(); altSession.Client = null; } altSession.Client ??= new Client(this, altSession); } @@ -321,6 +322,7 @@ namespace WTelegram if (authorization is not Auth_Authorization { user: User user }) throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); altSession.UserId = user.id; + lock (_session) _session.Save(); } } finally @@ -419,7 +421,7 @@ namespace WTelegram } internal DateTime MsgIdToStamp(long serverMsgId) - => new((serverMsgId >> 32) * 10000000 - _dcSession.ServerTicksOffset + 621355968000000000L, DateTimeKind.Utc); + => new((serverMsgId >> 32) * 10000000 - _dcSession.serverTicksOffset + 621355968000000000L, DateTimeKind.Utc); internal IObject ReadFrame(byte[] data, int dataLen) { @@ -432,7 +434,7 @@ namespace WTelegram throw new WTException($"Packet payload too small: {dataLen}"); long authKeyId = BinaryPrimitives.ReadInt64LittleEndian(data); - if (authKeyId != _dcSession.AuthKeyID) + if (authKeyId != _dcSession.authKeyID) throw new WTException($"Received a packet encrypted with unexpected key {authKeyId:X}"); if (authKeyId == 0) // Unencrypted message { @@ -468,7 +470,7 @@ namespace WTelegram if (length < 0 || length % 4 != 0) throw new WTException($"Invalid message_data_length: {length}"); if (decrypted_data.Length - 32 - length is < 12 or > 1024) throw new WTException($"Invalid message padding length: {decrypted_data.Length - 32}-{length}"); - if (sessionId != _dcSession.Id) throw new WTException($"Unexpected session ID: {sessionId} != {_dcSession.Id}"); + if (sessionId != _dcSession.id) throw new WTException($"Unexpected session ID: {sessionId} != {_dcSession.id}"); if ((msgId & 1) == 0) throw new WTException($"msg_id is not odd: {msgId}"); if (!_dcSession.CheckNewMsgId(msgId)) { @@ -477,19 +479,20 @@ namespace WTelegram } var utcNow = DateTime.UtcNow; if (_lastRecvMsgId == 0) // resync ServerTicksOffset on first message - _dcSession.ServerTicksOffset = (msgId >> 32) * 10000000 - utcNow.Ticks + 621355968000000000L; + _dcSession.serverTicksOffset = (msgId >> 32) * 10000000 - utcNow.Ticks + 621355968000000000L; var msgStamp = MsgIdToStamp(_lastRecvMsgId = msgId); long deltaTicks = (msgStamp - utcNow).Ticks; if (deltaTicks is > 0) if (deltaTicks < Ticks5Secs) // resync if next message is less than 5 seconds in the future - _dcSession.ServerTicksOffset += deltaTicks; - else if (_dcSession.ServerTicksOffset < -Ticks5Secs && deltaTicks + _dcSession.ServerTicksOffset < 0) - _dcSession.ServerTicksOffset += deltaTicks; + _dcSession.serverTicksOffset += deltaTicks; + else if (_dcSession.serverTicksOffset < -Ticks5Secs && deltaTicks + _dcSession.serverTicksOffset < 0) + _dcSession.serverTicksOffset += deltaTicks; if (serverSalt != _dcSession.Salt && serverSalt != _dcSession.OldSalt && serverSalt != _dcSession.Salts?.Values.ElementAtOrDefault(1)) { Helpers.Log(3, $"{_dcSession.DcID}>Server salt has changed: {_dcSession.Salt:X} -> {serverSalt:X}"); _dcSession.OldSalt = _dcSession.Salt; _dcSession.Salt = serverSalt; + lock (_session) _session.Save(); if (++_saltChangeCounter >= 10) throw new WTException("Server salt changed too often! Security issue?"); CheckSalt(); @@ -499,7 +502,7 @@ namespace WTelegram var ctorNb = reader.ReadUInt32(); if (ctorNb != Layer.BadMsgCtor && deltaTicks / TimeSpan.TicksPerSecond is > 30 or < -300) { // msg_id values that belong over 30 seconds in the future or over 300 seconds in the past are to be ignored. - Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.ServerTicksOffset):c}"); + Helpers.Log(1, $"{_dcSession.DcID}>Ignoring 0x{ctorNb:X8} because of wrong timestamp {msgStamp:u} - {utcNow:u} Δ={new TimeSpan(_dcSession.serverTicksOffset):c}"); return null; } try @@ -546,9 +549,11 @@ namespace WTelegram { var keys = _dcSession.Salts.Keys; if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing - var now = DateTime.UtcNow.AddTicks(_dcSession.ServerTicksOffset); - for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0]) + var now = DateTime.UtcNow.AddTicks(_dcSession.serverTicksOffset); + bool removed = false; + for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0], removed = true) _dcSession.Salts.RemoveAt(0); + if (removed) _session.Save(); if (_dcSession.Salts.Count > 48) return; } _dcSession.Salts[DateTime.MaxValue] = 0; @@ -694,7 +699,7 @@ namespace WTelegram rpc.tcs.SetResult(obj); return; } - else if (_dcSession.AuthKeyID == 0) + else if (_dcSession.authKeyID == 0) throw new WTException($"Received a {obj.GetType()} incompatible with expected bare {rpc?.type}"); lock (_pendingRpcs) _pendingRpcs[_bareRpc.msgId] = _bareRpc; @@ -726,7 +731,7 @@ namespace WTelegram break; // we don't do anything with these, for now case BadMsgNotification badMsgNotification: await _sendSemaphore.WaitAsync(); - bool retryLast = badMsgNotification.bad_msg_id == _dcSession.LastSentMsgId; + bool retryLast = badMsgNotification.bad_msg_id == _dcSession.lastSentMsgId; var lastSentMsg = _lastSentMsg; _sendSemaphore.Release(); var logLevel = badMsgNotification.error_code == 48 ? 2 : 4; @@ -735,14 +740,14 @@ namespace WTelegram { case 16: // msg_id too low (most likely, client time is wrong; synchronize it using msg_id notifications and re-send the original message) case 17: // msg_id too high (similar to the previous case, the client time has to be synchronized, and the message re-sent with the correct msg_id) - _dcSession.LastSentMsgId = 0; + _dcSession.lastSentMsgId = 0; var localTime = DateTime.UtcNow; - _dcSession.ServerTicksOffset = (_lastRecvMsgId >> 32) * 10000000 - localTime.Ticks + 621355968000000000L; - Helpers.Log(1, $"Time offset: {_dcSession.ServerTicksOffset} | Server: {MsgIdToStamp(_lastRecvMsgId).AddTicks(_dcSession.ServerTicksOffset).TimeOfDay} UTC | Local: {localTime.TimeOfDay} UTC"); + _dcSession.serverTicksOffset = (_lastRecvMsgId >> 32) * 10000000 - localTime.Ticks + 621355968000000000L; + Helpers.Log(1, $"Time offset: {_dcSession.serverTicksOffset} | Server: {MsgIdToStamp(_lastRecvMsgId).AddTicks(_dcSession.serverTicksOffset).TimeOfDay} UTC | Local: {localTime.TimeOfDay} UTC"); break; case 32: // msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno) case 33: // msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno) - if (_dcSession.Seqno <= 1) + if (_dcSession.seqno <= 1) retryLast = false; else { @@ -754,6 +759,7 @@ namespace WTelegram case 48: // incorrect server salt (in this case, the bad_server_salt response is received with the correct salt, and the message is to be re-sent with it) _dcSession.OldSalt = _dcSession.Salt; _dcSession.Salt = ((BadServerSalt)badMsgNotification).new_server_salt; + lock (_session) _session.Save(); CheckSalt(); break; default: @@ -942,7 +948,7 @@ namespace WTelegram // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); if (defaultDc != 0) _dcSession ??= _session.DCSessions.GetValueOrDefault(defaultDc); - _dcSession ??= new() { Id = Helpers.RandomLong() }; + _dcSession ??= new(); _dcSession.Client = this; _dcSession.DataCenter = null; Helpers.Log(2, $"Connecting to {endpoint}..."); @@ -976,7 +982,7 @@ namespace WTelegram try { - if (_dcSession.AuthKeyID == 0) + if (_dcSession.authKeyID == 0) await CreateAuthorizationKey(this, _dcSession); if (_networkStream != null) _ = KeepAlive(_cts.Token); @@ -1125,6 +1131,7 @@ namespace WTelegram if (self.id == long.Parse(botToken.Split(':')[0])) { _session.UserId = _dcSession.UserId = self.id; + lock (_session) _session.Save(); RaiseUpdates(self); return User = self; } @@ -1164,6 +1171,7 @@ namespace WTelegram self.phone == string.Concat((phone_number = Config("phone_number")).Where(char.IsDigit))) { _session.UserId = _dcSession.UserId = self.id; + lock (_session) _session.Save(); RaiseUpdates(self); return User = self; } @@ -1420,21 +1428,17 @@ namespace WTelegram internal (long msgId, int seqno) NewMsgId(bool isContent) { int seqno; - long msgId = DateTime.UtcNow.Ticks + _dcSession.ServerTicksOffset - 621355968000000000L; + long msgId = DateTime.UtcNow.Ticks + _dcSession.serverTicksOffset - 621355968000000000L; msgId = msgId * 428 + (msgId >> 24) * 25110956; // approximately unixtime*2^32 and divisible by 4 - lock (_session) - { - if (msgId <= _dcSession.LastSentMsgId) msgId = _dcSession.LastSentMsgId += 4; else _dcSession.LastSentMsgId = msgId; - seqno = isContent ? _dcSession.Seqno++ * 2 + 1 : _dcSession.Seqno * 2; - _session.Save(); - } + if (msgId <= _dcSession.lastSentMsgId) msgId = _dcSession.lastSentMsgId += 4; else _dcSession.lastSentMsgId = msgId; + seqno = isContent ? _dcSession.seqno++ * 2 + 1 : _dcSession.seqno * 2; return (msgId, seqno); } private async Task SendAsync(IObject msg, bool isContent, Rpc rpc = null) { if (_reactorTask == null) throw new WTException("You must connect to Telegram first"); - isContent &= _dcSession.AuthKeyID != 0; + isContent &= _dcSession.authKeyID != 0; var (msgId, seqno) = NewMsgId(isContent); if (rpc != null) lock (_pendingRpcs) @@ -1462,7 +1466,7 @@ namespace WTelegram using var writer = new BinaryWriter(memStream); writer.Write(0); // int32 payload_len (to be patched with payload length) - if (_dcSession.AuthKeyID == 0) // send unencrypted message + if (_dcSession.authKeyID == 0) // send unencrypted message { if (_bareRpc == null) throw new WTException($"Shouldn't send a {msg.GetType().Name} unencrypted"); writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted) @@ -1479,7 +1483,7 @@ namespace WTelegram using var clearWriter = new BinaryWriter(clearStream); clearWriter.Write(_dcSession.AuthKey, 88, 32); clearWriter.Write(_dcSession.Salt); // int64 salt - clearWriter.Write(_dcSession.Id); // int64 session_id + clearWriter.Write(_dcSession.id); // int64 session_id clearWriter.Write(msgId); // int64 message_id clearWriter.Write(seqno); // int32 msg_seqno clearWriter.Write(0); // int32 message_data_length (to be patched) @@ -1499,13 +1503,13 @@ namespace WTelegram const int msgKeyOffset = 8; // msg_key = middle 128-bits of SHA256(authkey_part+plaintext+padding) byte[] encrypted_data = EncryptDecryptMessage(clearBuffer.AsSpan(32, clearLength + padding), true, 0, _dcSession.AuthKey, msgKeyLarge, msgKeyOffset, _sha256); - writer.Write(_dcSession.AuthKeyID); // int64 auth_key_id + writer.Write(_dcSession.authKeyID); // int64 auth_key_id writer.Write(msgKeyLarge, msgKeyOffset, 16); // int128 msg_key writer.Write(encrypted_data); // bytes encrypted_data } if (_paddedMode) // Padded intermediate mode => append random padding { - var padding = new byte[_random.Next(_dcSession.AuthKeyID == 0 ? 257 : 16)]; + var padding = new byte[_random.Next(_dcSession.authKeyID == 0 ? 257 : 16)]; RNG.GetBytes(padding); writer.Write(padding); } @@ -1572,7 +1576,7 @@ namespace WTelegram /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied public async Task Invoke(IMethod query) { - if (_dcSession.WithoutUpdates && query is not IMethod and not IMethod) + if (_dcSession.withoutUpdates && query is not IMethod and not IMethod) query = new TL.Methods.InvokeWithoutUpdates { query = query }; bool got503 = false; retry: @@ -1610,7 +1614,7 @@ namespace WTelegram { if (x <= FloodRetryThreshold) { - if (x == 0) x =1; + if (x == 0) x = 1; await Task.Delay(x * 1000); goto retry; } @@ -1623,14 +1627,16 @@ namespace WTelegram else if (code == 400 && message == "CONNECTION_NOT_INITED") { await InitConnection(); + lock (_session) _session.Save(); goto retry; } else if (code == 500 && message == "AUTH_RESTART") - { - _session.UserId = 0; // force a full login authorization flow, next time - User = null; - lock (_session) _session.Save(); - } + lock (_session) + { + _session.UserId = 0; // force a full login authorization flow, next time + User = null; + _session.Save(); + } throw new RpcException(code, message, x); case ReactorError: goto retry; diff --git a/src/Encryption.cs b/src/Encryption.cs index d943e5d..957c537 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -110,9 +110,9 @@ namespace WTelegram var g_a = BigEndianInteger(serverDHinnerData.g_a); var dh_prime = BigEndianInteger(serverDHinnerData.dh_prime); CheckGoodPrime(dh_prime, serverDHinnerData.g); - session.LastSentMsgId = 0; - session.ServerTicksOffset = (serverDHinnerData.server_time - localTime).Ticks; - Helpers.Log(1, $"Time offset: {session.ServerTicksOffset} | Server: {serverDHinnerData.server_time.TimeOfDay} UTC | Local: {localTime.TimeOfDay} UTC"); + session.lastSentMsgId = 0; + session.serverTicksOffset = (serverDHinnerData.server_time - localTime).Ticks; + Helpers.Log(1, $"Time offset: {session.serverTicksOffset} | Server: {serverDHinnerData.server_time.TimeOfDay} UTC | Local: {localTime.TimeOfDay} UTC"); //6) var salt = new byte[256]; RNG.GetBytes(salt); @@ -159,7 +159,7 @@ namespace WTelegram if (!Enumerable.SequenceEqual(dhGenOk.new_nonce_hash1.raw, sha1.ComputeHash(expected_new_nonceN).Skip(4))) throw new WTException("setClientDHparamsAnswer.new_nonce_hashN mismatch"); - session.AuthKeyID = BinaryPrimitives.ReadInt64LittleEndian(authKeyHash.AsSpan(12)); + session.authKeyID = BinaryPrimitives.ReadInt64LittleEndian(authKeyHash.AsSpan(12)); session.AuthKey = authKey; session.Salt = BinaryPrimitives.ReadInt64LittleEndian(pqInnerData.new_nonce.raw) ^ BinaryPrimitives.ReadInt64LittleEndian(resPQ.server_nonce.raw); session.OldSalt = session.Salt; diff --git a/src/Session.cs b/src/Session.cs index 86a0fec..c12d65a 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -21,25 +21,25 @@ namespace WTelegram public sealed class DCSession { - public long Id; - public long AuthKeyID; public byte[] AuthKey; // 2048-bit = 256 bytes public long UserId; public long OldSalt; // still accepted for a further 1800 seconds public long Salt; public SortedList Salts; - public int Seqno; - public long ServerTicksOffset; - public long LastSentMsgId; public TL.DcOption DataCenter; - public bool WithoutUpdates; public int Layer; + internal long id = Helpers.RandomLong(); + internal long authKeyID; + internal int seqno; + internal long serverTicksOffset; + internal long lastSentMsgId; + internal bool withoutUpdates; internal Client Client; internal int DcID => DataCenter?.id ?? 0; internal IPEndPoint EndPoint => DataCenter == null ? null : new(IPAddress.Parse(DataCenter.ip_address), DataCenter.port); - internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); Id = Helpers.RandomLong(); Seqno = 0; LastSentMsgId = 0; } - public void DisableUpdates(bool disable = true) { if (WithoutUpdates != disable) { WithoutUpdates = disable; Renew(); } } + internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); id = Helpers.RandomLong(); seqno = 0; lastSentMsgId = 0; } + public void DisableUpdates(bool disable = true) { if (withoutUpdates != disable) { withoutUpdates = disable; Renew(); } } const int MsgIdsN = 512; private long[] _msgIds; @@ -117,6 +117,9 @@ namespace WTelegram throw new WTException("Integrity check failed in session loading"); session = JsonSerializer.Deserialize(utf8Json.AsSpan(32), Helpers.JsonOptions); Helpers.Log(2, "Loaded previous session"); + using var sha1 = SHA1.Create(); + foreach (var dcs in session.DCSessions.Values) + dcs.authKeyID = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(dcs.AuthKey).AsSpan(12)); } session ??= new Session(); session._store = store; From eaea2d051a3f4ae8624d263da7d803d81ea9f457 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 20 Apr 2025 03:23:43 +0200 Subject: [PATCH 282/336] API Layer 201.2: business bot stars --- src/TL.Schema.cs | 8 ++++++++ src/TL.Table.cs | 3 ++- 2 files changed, 10 insertions(+), 1 deletion(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 9a1af73..424006f 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -15946,6 +15946,13 @@ namespace TL has_message = 0x1, } } + /// See + [TLDef(0xF4997E42)] + public sealed partial class InputInvoiceBusinessBotTransferStars : InputInvoice + { + public InputUserBase bot; + public long stars; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -19510,6 +19517,7 @@ namespace TL has_paid_messages = 0x80000, /// Field has a value has_premium_gift_months = 0x100000, + business_transfer = 0x200000, } } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index e441650..36011aa 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 = 201; // fetched 26/03/2025 23:35:58 + public const int Version = 201; // fetched 20/04/2025 01:20:15 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1111,6 +1111,7 @@ namespace TL [0x4D818D5D] = typeof(InputInvoiceStarGiftUpgrade), [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), + [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), From 6fb59286bde7fc8641c93f31ea01bf32c87db2fd Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 1 May 2025 12:17:06 +0200 Subject: [PATCH 283/336] API Layer 202: E2E group calls https://core.telegram.org/api/end-to-end/group-calls --- README.md | 2 +- src/TL.Schema.cs | 117 ++++++++++++--------- src/TL.SchemaFuncs.cs | 210 ++++++++++++++++++++++++++++--------- src/TL.Table.cs | 20 ++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 242 insertions(+), 109 deletions(-) diff --git a/README.md b/README.md index 32a183d..d2aadf3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-201-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-202-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 424006f..58a7de8 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -692,7 +692,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Livestream info - public InputGroupCall call; + public InputGroupCallBase call; /// Timestamp in milliseconds public long time_ms; /// Specifies the duration of the video segment to fetch in milliseconds, by bitshifting 1000 to the right scale times: duration_ms := 1000 >> scale @@ -1262,7 +1262,7 @@ namespace TL /// Peer folder ID, for more info click here public virtual int Folder => default; /// Group call information - public virtual InputGroupCall Call => default; + public virtual InputGroupCallBase Call => default; /// Time-To-Live of messages sent by the current user to this chat public virtual int TtlPeriod => default; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1303,7 +1303,7 @@ namespace TL /// Peer folder ID, for more info click here [IfFlag(11)] public int folder_id; /// Group call information - [IfFlag(12)] public InputGroupCall call; + [IfFlag(12)] public InputGroupCallBase call; /// Time-To-Live of messages sent by the current user to this chat [IfFlag(14)] public int ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1370,7 +1370,7 @@ namespace TL /// Peer folder ID, for more info click here public override int Folder => folder_id; /// Group call information - public override InputGroupCall Call => call; + public override InputGroupCallBase Call => call; /// Time-To-Live of messages sent by the current user to this chat public override int TtlPeriod => ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -1447,7 +1447,7 @@ namespace TL /// Latest PTS for this channel public int pts; /// Livestream or group call information - [IfFlag(21)] public InputGroupCall call; + [IfFlag(21)] public InputGroupCallBase call; /// Time-To-Live of messages in this channel or supergroup [IfFlag(24)] public int ttl_period; /// A list of suggested actions for the supergroup admin, see here for more info ». @@ -1606,7 +1606,7 @@ namespace TL /// Peer folder ID, for more info click here public override int Folder => folder_id; /// Livestream or group call information - public override InputGroupCall Call => call; + public override InputGroupCallBase Call => call; /// Time-To-Live of messages in this channel or supergroup public override int TtlPeriod => ttl_period; /// When using Phone_GetGroupCallJoinAs to get a list of peers that can be used to join a group call, this field indicates the peer that should be selected by default. @@ -2548,7 +2548,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Group call - public InputGroupCall call; + public InputGroupCallBase call; /// Group call duration [IfFlag(0)] public int duration; @@ -2563,7 +2563,7 @@ namespace TL public sealed partial class MessageActionInviteToGroupCall : MessageAction { /// The group call - public InputGroupCall call; + public InputGroupCallBase call; /// The invited users public long[] users; } @@ -2589,7 +2589,7 @@ namespace TL public sealed partial class MessageActionGroupCallScheduled : MessageAction { /// The group call - public InputGroupCall call; + public InputGroupCallBase call; /// When is this group call scheduled to start public DateTime schedule_date; } @@ -2959,6 +2959,24 @@ namespace TL { public long stars; } + /// See + [TLDef(0x2FFE2F7A)] + public sealed partial class MessageActionConferenceCall : MessageAction + { + public Flags flags; + public long call_id; + [IfFlag(2)] public int duration; + [IfFlag(3)] public Peer[] other_participants; + + [Flags] public enum Flags : uint + { + missed = 0x1, + active = 0x2, + has_duration = 0x4, + has_other_participants = 0x8, + video = 0x10, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -5124,7 +5142,7 @@ namespace TL public sealed partial class UpdateGroupCallParticipants : Update { /// Group call - public InputGroupCall call; + public InputGroupCallBase call; /// New participant list public GroupCallParticipant[] participants; /// Version @@ -5818,6 +5836,15 @@ namespace TL { public Auth_SentCodeBase sent_code; } + /// See + [TLDef(0xA477288F)] + public sealed partial class UpdateGroupCallChainBlocks : Update + { + public InputGroupCallBase call; + public int sub_chain_id; + public byte[][] blocks; + public int next_offset; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -10529,11 +10556,11 @@ namespace TL /// The phone call was discarded because the user is busy in another call See [TLDef(0xFAF7E8C9)] public sealed partial class PhoneCallDiscardReasonBusy : PhoneCallDiscardReason { } - /// See - [TLDef(0xAFE2B839)] - public sealed partial class PhoneCallDiscardReasonAllowGroupCall : PhoneCallDiscardReason + /// See + [TLDef(0x9FBBF1F7)] + public sealed partial class PhoneCallDiscardReasonMigrateConferenceCall : PhoneCallDiscardReason { - public byte[] encrypted_key; + public string slug; } /// Represents a json-encoded object See @@ -11232,7 +11259,6 @@ namespace TL public virtual long ParticipantId => default; /// Phone call protocol info public virtual PhoneCallProtocol Protocol => default; - public virtual InputGroupCall ConferenceCall => default; } /// Empty constructor See [TLDef(0x5366C915)] @@ -11245,7 +11271,7 @@ namespace TL public override long ID => id; } /// Incoming phone call See - [TLDef(0xEED42858)] + [TLDef(0xC5226F17)] public sealed partial class PhoneCallWaiting : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11264,7 +11290,6 @@ namespace TL public PhoneCallProtocol protocol; /// When was the phone call received [IfFlag(0)] public DateTime receive_date; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11272,8 +11297,6 @@ namespace TL has_receive_date = 0x1, /// Is this a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Call ID @@ -11288,10 +11311,9 @@ namespace TL public override long ParticipantId => participant_id; /// Phone call protocol info public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Requested phone call See - [TLDef(0x45361C63)] + [TLDef(0x14B0ED0C)] public sealed partial class PhoneCallRequested : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11310,14 +11332,11 @@ namespace TL public byte[] g_a_hash; /// Call protocol info to be passed to libtgvoip public PhoneCallProtocol protocol; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Phone call ID @@ -11332,10 +11351,9 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// An accepted phone call See - [TLDef(0x22FD7181)] + [TLDef(0x3660C311)] public sealed partial class PhoneCallAccepted : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11354,14 +11372,11 @@ namespace TL public byte[] g_b; /// Protocol to use for phone call public PhoneCallProtocol protocol; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { /// Whether this is a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// ID of accepted phone call @@ -11376,10 +11391,9 @@ namespace TL public override long ParticipantId => participant_id; /// Protocol to use for phone call public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Phone call See - [TLDef(0x3BA5940C)] + [TLDef(0x30535AF5)] public sealed partial class PhoneCall : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11406,7 +11420,6 @@ namespace TL public DateTime start_date; /// Custom JSON-encoded call parameters to be passed to tgcalls. [IfFlag(7)] public DataJSON custom_parameters; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11416,8 +11429,7 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, - /// Field has a value - has_conference_call = 0x100, + conference_supported = 0x100, } /// Call ID @@ -11432,10 +11444,9 @@ namespace TL public override long ParticipantId => participant_id; /// Call protocol info to be passed to libtgvoip public override PhoneCallProtocol Protocol => protocol; - public override InputGroupCall ConferenceCall => conference_call; } /// Indicates a discarded phone call See - [TLDef(0xF9D25503)] + [TLDef(0x50CA4DE1)] public sealed partial class PhoneCallDiscarded : PhoneCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -11446,7 +11457,6 @@ namespace TL [IfFlag(0)] public PhoneCallDiscardReason reason; /// Duration of the phone call in seconds [IfFlag(1)] public int duration; - [IfFlag(8)] public InputGroupCall conference_call; [Flags] public enum Flags : uint { @@ -11460,13 +11470,10 @@ namespace TL need_debug = 0x8, /// Whether the call was a video call video = 0x40, - /// Field has a value - has_conference_call = 0x100, } /// Call ID public override long ID => id; - public override InputGroupCall ConferenceCall => conference_call; } /// Phone call connection See Derived classes: , @@ -11904,14 +11911,14 @@ namespace TL public sealed partial class ChannelAdminLogEventActionStartGroupCall : ChannelAdminLogEventAction { /// Group call - public InputGroupCall call; + public InputGroupCallBase call; } /// A group call was terminated See [TLDef(0xDB9F9140)] public sealed partial class ChannelAdminLogEventActionDiscardGroupCall : ChannelAdminLogEventAction { /// The group call that was terminated - public InputGroupCall call; + public InputGroupCallBase call; } /// A group call participant was muted See [TLDef(0xF92424D2)] @@ -14809,7 +14816,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0xCDF8D3E3)] + [TLDef(0x553B0BA1)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14834,7 +14841,7 @@ namespace TL public int unmuted_video_limit; /// Version public int version; - [IfFlag(14)] public long conference_from_call; + [IfFlag(16)] public string invite_link; [Flags] public enum Flags : uint { @@ -14864,8 +14871,10 @@ namespace TL rtmp_stream = 0x1000, /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, - /// Field has a value - has_conference_from_call = 0x4000, + conference = 0x4000, + creator = 0x8000, + /// Field has a value + has_invite_link = 0x10000, } /// Group call ID @@ -14874,15 +14883,29 @@ namespace TL public override long AccessHash => access_hash; } + /// Indicates a group call See Derived classes: + public abstract partial class InputGroupCallBase : IObject { } /// Points to a specific group call See [TLDef(0xD8AA840F)] - public sealed partial class InputGroupCall : IObject + public sealed partial class InputGroupCall : InputGroupCallBase { /// Group call ID public long id; /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } + ///
See + [TLDef(0xFE06823F)] + public sealed partial class InputGroupCallSlug : InputGroupCallBase + { + public string slug; + } + /// See + [TLDef(0x8C10603F)] + public sealed partial class InputGroupCallInviteMessage : InputGroupCallBase + { + public int msg_id; + } /// Info about a group call participant See [TLDef(0xEBA636FE)] diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index aa0b3db..9a50d76 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -6509,12 +6509,11 @@ namespace TL /// Random ID to avoid resending the same object /// Parameter for E2E encryption key exchange » /// Phone call settings - public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, InputGroupCall conference_call = null, bool video = false) + public static Task Phone_RequestCall(this Client client, InputUserBase user_id, int random_id, byte[] g_a_hash, PhoneCallProtocol protocol, bool video = false) => client.Invoke(new Phone_RequestCall { - flags = (Phone_RequestCall.Flags)((conference_call != null ? 0x2 : 0) | (video ? 0x1 : 0)), + flags = (Phone_RequestCall.Flags)(video ? 0x1 : 0), user_id = user_id, - conference_call = conference_call, random_id = random_id, g_a_hash = g_a_hash, protocol = protocol, @@ -6627,21 +6626,22 @@ namespace TL /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. /// WebRTC parameters - public static Task Phone_JoinGroupCall(this Client client, InputGroupCall call, InputPeer join_as, DataJSON params_, string invite_hash = null, long? key_fingerprint = null, bool muted = false, bool video_stopped = false) + public static Task Phone_JoinGroupCall(this Client client, InputGroupCallBase call, InputPeer join_as, DataJSON params_, string invite_hash = null, Int256? public_key = null, byte[] block = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall { - flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (key_fingerprint != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), + flags = (Phone_JoinGroupCall.Flags)((invite_hash != null ? 0x2 : 0) | (public_key != null ? 0x8 : 0) | (block != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0)), call = call, join_as = join_as, invite_hash = invite_hash, - key_fingerprint = key_fingerprint ?? default, + public_key = public_key ?? default, + block = block, params_ = params_, }); /// Leave a group call See Possible codes: 400 (details) /// The group call /// Your source ID - public static Task Phone_LeaveGroupCall(this Client client, InputGroupCall call, int source) + public static Task Phone_LeaveGroupCall(this Client client, InputGroupCallBase call, int source) => client.Invoke(new Phone_LeaveGroupCall { call = call, @@ -6651,7 +6651,7 @@ namespace TL /// Invite a set of users to a group call. See Possible codes: 400,403 (details) /// The group call /// The users to invite. - public static Task Phone_InviteToGroupCall(this Client client, InputGroupCall call, params InputUserBase[] users) + public static Task Phone_InviteToGroupCall(this Client client, InputGroupCallBase call, params InputUserBase[] users) => client.Invoke(new Phone_InviteToGroupCall { call = call, @@ -6660,7 +6660,7 @@ namespace TL /// Terminate a group call See Possible codes: 400,403 (details) /// The group call to terminate - public static Task Phone_DiscardGroupCall(this Client client, InputGroupCall call) + public static Task Phone_DiscardGroupCall(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_DiscardGroupCall { call = call, @@ -6670,7 +6670,7 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCall call, bool? join_muted = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), @@ -6681,7 +6681,7 @@ namespace TL /// Get info about a group call See Possible codes: 400,403 (details) /// The group call /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupCall(this Client client, InputGroupCall call, int limit = int.MaxValue) + public static Task Phone_GetGroupCall(this Client client, InputGroupCallBase call, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCall { call = call, @@ -6694,7 +6694,7 @@ namespace TL /// If specified, will fetch group participant info about the specified WebRTC source IDs /// Offset for results, taken from the next_offset field of , initially an empty string.
Note: if no more results are available, the method call will return an empty next_offset; thus, avoid providing the next_offset returned in if it is empty, to avoid an infinite loop. /// Maximum number of results to return, see pagination - public static Task Phone_GetGroupParticipants(this Client client, InputGroupCall call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) + public static Task Phone_GetGroupParticipants(this Client client, InputGroupCallBase call, InputPeer[] ids, int[] sources, string offset, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupParticipants { call = call, @@ -6707,7 +6707,7 @@ namespace TL /// Check whether the group call Server Forwarding Unit is currently receiving the streams with the specified WebRTC source IDs.
Returns an intersection of the source IDs specified in sources, and the source IDs currently being forwarded by the SFU. See Possible codes: 400 (details)
/// Group call /// Source IDs - public static Task Phone_CheckGroupCall(this Client client, InputGroupCall call, params int[] sources) + public static Task Phone_CheckGroupCall(this Client client, InputGroupCallBase call, params int[] sources) => client.Invoke(new Phone_CheckGroupCall { call = call, @@ -6720,7 +6720,7 @@ namespace TL /// The group call or livestream /// Recording title /// If video stream recording is enabled, whether to record in portrait or landscape mode - public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCall call, string title = null, bool? video_portrait = default, bool start = false, bool video = false) + public static Task Phone_ToggleGroupCallRecord(this Client client, InputGroupCallBase call, string title = null, bool? video_portrait = default, bool start = false, bool video = false) => client.Invoke(new Phone_ToggleGroupCallRecord { flags = (Phone_ToggleGroupCallRecord.Flags)((title != null ? 0x2 : 0) | (video_portrait != default ? 0x4 : 0) | (start ? 0x1 : 0) | (video ? 0x4 : 0)), @@ -6738,7 +6738,7 @@ namespace TL /// Start or stop the video stream /// Pause or resume the video stream /// Pause or resume the screen sharing stream - public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCall call, InputPeer participant, bool? muted = default, int? volume = null, bool? raise_hand = default, bool? video_stopped = default, bool? video_paused = default, bool? presentation_paused = default) + public static Task Phone_EditGroupCallParticipant(this Client client, InputGroupCallBase call, InputPeer participant, bool? muted = default, int? volume = null, bool? raise_hand = default, bool? video_stopped = default, bool? video_paused = default, bool? presentation_paused = default) => client.Invoke(new Phone_EditGroupCallParticipant { flags = (Phone_EditGroupCallParticipant.Flags)((muted != default ? 0x1 : 0) | (volume != null ? 0x2 : 0) | (raise_hand != default ? 0x4 : 0) | (video_stopped != default ? 0x8 : 0) | (video_paused != default ? 0x10 : 0) | (presentation_paused != default ? 0x20 : 0)), @@ -6755,7 +6755,7 @@ namespace TL /// Edit the title of a group call or livestream See Possible codes: 400,403 (details) /// Group call /// New title - public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCall call, string title) + public static Task Phone_EditGroupCallTitle(this Client client, InputGroupCallBase call, string title) => client.Invoke(new Phone_EditGroupCallTitle { call = call, @@ -6773,7 +6773,7 @@ namespace TL /// Get an invite link for a group call or livestream See Possible codes: 400,403 (details) /// For livestreams or muted group chats, if set, users that join using this link will be able to speak without explicitly requesting permission by (for example by raising their hand). /// The group call - public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCall call, bool can_self_unmute = false) + public static Task Phone_ExportGroupCallInvite(this Client client, InputGroupCallBase call, bool can_self_unmute = false) => client.Invoke(new Phone_ExportGroupCallInvite { flags = (Phone_ExportGroupCallInvite.Flags)(can_self_unmute ? 0x1 : 0), @@ -6783,7 +6783,7 @@ namespace TL /// Subscribe or unsubscribe to a scheduled group call See Possible codes: 400,403 (details) /// Scheduled group call /// Enable or disable subscription - public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCall call, bool subscribed) + public static Task Phone_ToggleGroupCallStartSubscription(this Client client, InputGroupCallBase call, bool subscribed) => client.Invoke(new Phone_ToggleGroupCallStartSubscription { call = call, @@ -6792,7 +6792,7 @@ namespace TL /// Start a scheduled group call. See Possible codes: 400,403 (details) /// The scheduled group call - public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCall call) + public static Task Phone_StartScheduledGroupCall(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_StartScheduledGroupCall { call = call, @@ -6811,7 +6811,7 @@ namespace TL /// Start screen sharing in a call See Possible codes: 400,403 (details) /// The group call /// WebRTC parameters - public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCall call, DataJSON params_) + public static Task Phone_JoinGroupCallPresentation(this Client client, InputGroupCallBase call, DataJSON params_) => client.Invoke(new Phone_JoinGroupCallPresentation { call = call, @@ -6820,7 +6820,7 @@ namespace TL /// Stop screen sharing in a group call See Possible codes: 400 (details) /// The group call - public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCall call) + public static Task Phone_LeaveGroupCallPresentation(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_LeaveGroupCallPresentation { call = call, @@ -6828,7 +6828,7 @@ namespace TL /// Get info about RTMP streams in a group call or livestream.
This method should be invoked to the same group/channel-related DC used for downloading livestream chunks.
As usual, the media DC is preferred, if available. See Possible codes: 400 (details)
/// Group call or livestream - public static Task Phone_GetGroupCallStreamChannels(this Client client, InputGroupCall call) + public static Task Phone_GetGroupCallStreamChannels(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_GetGroupCallStreamChannels { call = call, @@ -6855,11 +6855,58 @@ namespace TL }); /// See - public static Task Phone_CreateConferenceCall(this Client client, InputPhoneCall peer, long key_fingerprint) + public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { - peer = peer, - key_fingerprint = key_fingerprint, + flags = (Phone_CreateConferenceCall.Flags)((public_key != null ? 0x8 : 0) | (block != null ? 0x8 : 0) | (params_ != null ? 0x8 : 0) | (muted ? 0x1 : 0) | (video_stopped ? 0x4 : 0) | (join ? 0x8 : 0)), + random_id = random_id, + public_key = public_key ?? default, + block = block, + params_ = params_, + }); + + /// See + public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) + => client.Invoke(new Phone_DeleteConferenceCallParticipants + { + flags = (Phone_DeleteConferenceCallParticipants.Flags)((only_left ? 0x1 : 0) | (kick ? 0x2 : 0)), + call = call, + ids = ids, + block = block, + }); + + /// See + public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) + => client.Invoke(new Phone_SendConferenceCallBroadcast + { + call = call, + block = block, + }); + + /// See + public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) + => client.Invoke(new Phone_InviteConferenceCallParticipant + { + flags = (Phone_InviteConferenceCallParticipant.Flags)(video ? 0x1 : 0), + call = call, + user_id = user_id, + }); + + /// See + public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) + => client.Invoke(new Phone_DeclineConferenceCallInvite + { + msg_id = msg_id, + }); + + /// See + public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Phone_GetGroupCallChainBlocks + { + call = call, + sub_chain_id = sub_chain_id, + offset = offset, + limit = limit, }); /// Get localization pack strings See Possible codes: 400 (details) @@ -12964,12 +13011,11 @@ namespace TL.Methods [TLDef(0x55451FA9)] public sealed partial class Phone_GetCallConfig : IMethod { } - [TLDef(0xA6C4600C)] + [TLDef(0x42FF96ED)] public sealed partial class Phone_RequestCall : IMethod { public Flags flags; public InputUserBase user_id; - [IfFlag(1)] public InputGroupCall conference_call; public int random_id; public byte[] g_a_hash; public PhoneCallProtocol protocol; @@ -12977,7 +13023,6 @@ namespace TL.Methods [Flags] public enum Flags : uint { video = 0x1, - has_conference_call = 0x2, } } @@ -13064,14 +13109,15 @@ namespace TL.Methods } } - [TLDef(0xD61E1DF3)] + [TLDef(0x8FB53057)] public sealed partial class Phone_JoinGroupCall : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer join_as; [IfFlag(1)] public string invite_hash; - [IfFlag(3)] public long key_fingerprint; + [IfFlag(3)] public Int256 public_key; + [IfFlag(3)] public byte[] block; public DataJSON params_; [Flags] public enum Flags : uint @@ -13079,35 +13125,35 @@ namespace TL.Methods muted = 0x1, has_invite_hash = 0x2, video_stopped = 0x4, - has_key_fingerprint = 0x8, + has_public_key = 0x8, } } [TLDef(0x500377F9)] public sealed partial class Phone_LeaveGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int source; } [TLDef(0x7B393160)] public sealed partial class Phone_InviteToGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public InputUserBase[] users; } [TLDef(0x7A777135)] public sealed partial class Phone_DiscardGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x74BBB43D)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; [Flags] public enum Flags : uint @@ -13120,14 +13166,14 @@ namespace TL.Methods [TLDef(0x041845DB)] public sealed partial class Phone_GetGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int limit; } [TLDef(0xC558D8AB)] public sealed partial class Phone_GetGroupParticipants : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer[] ids; public int[] sources; public string offset; @@ -13137,7 +13183,7 @@ namespace TL.Methods [TLDef(0xB59CF977)] public sealed partial class Phone_CheckGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public int[] sources; } @@ -13145,7 +13191,7 @@ namespace TL.Methods public sealed partial class Phone_ToggleGroupCallRecord : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [IfFlag(1)] public string title; [IfFlag(2)] public bool video_portrait; @@ -13161,7 +13207,7 @@ namespace TL.Methods public sealed partial class Phone_EditGroupCallParticipant : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; public InputPeer participant; [IfFlag(0)] public bool muted; [IfFlag(1)] public int volume; @@ -13184,7 +13230,7 @@ namespace TL.Methods [TLDef(0x1CA6AC0A)] public sealed partial class Phone_EditGroupCallTitle : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public string title; } @@ -13198,7 +13244,7 @@ namespace TL.Methods public sealed partial class Phone_ExportGroupCallInvite : IMethod { public Flags flags; - public InputGroupCall call; + public InputGroupCallBase call; [Flags] public enum Flags : uint { @@ -13209,14 +13255,14 @@ namespace TL.Methods [TLDef(0x219C34E6)] public sealed partial class Phone_ToggleGroupCallStartSubscription : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public bool subscribed; } [TLDef(0x5680E342)] public sealed partial class Phone_StartScheduledGroupCall : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x575E1F8C)] @@ -13229,20 +13275,20 @@ namespace TL.Methods [TLDef(0xCBEA6BC4)] public sealed partial class Phone_JoinGroupCallPresentation : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; public DataJSON params_; } [TLDef(0x1C50D144)] public sealed partial class Phone_LeaveGroupCallPresentation : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0x1AB21940)] public sealed partial class Phone_GetGroupCallStreamChannels : IMethod { - public InputGroupCall call; + public InputGroupCallBase call; } [TLDef(0xDEB3ABBF)] @@ -13259,11 +13305,71 @@ namespace TL.Methods public InputFileBase file; } - [TLDef(0xDFC909AB)] - public sealed partial class Phone_CreateConferenceCall : IMethod + [TLDef(0x7D0444BB)] + public sealed partial class Phone_CreateConferenceCall : IMethod { - public InputPhoneCall peer; - public long key_fingerprint; + public Flags flags; + public int random_id; + [IfFlag(3)] public Int256 public_key; + [IfFlag(3)] public byte[] block; + [IfFlag(3)] public DataJSON params_; + + [Flags] public enum Flags : uint + { + muted = 0x1, + video_stopped = 0x4, + join = 0x8, + } + } + + [TLDef(0x8CA60525)] + public sealed partial class Phone_DeleteConferenceCallParticipants : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public long[] ids; + public byte[] block; + + [Flags] public enum Flags : uint + { + only_left = 0x1, + kick = 0x2, + } + } + + [TLDef(0xC6701900)] + public sealed partial class Phone_SendConferenceCallBroadcast : IMethod + { + public InputGroupCallBase call; + public byte[] block; + } + + [TLDef(0xBCF22685)] + public sealed partial class Phone_InviteConferenceCallParticipant : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + video = 0x1, + } + } + + [TLDef(0x3C479971)] + public sealed partial class Phone_DeclineConferenceCallInvite : IMethod + { + public int msg_id; + } + + [TLDef(0xEE9F88A6)] + public sealed partial class Phone_GetGroupCallChainBlocks : IMethod + { + public InputGroupCallBase call; + public int sub_chain_id; + public int offset; + public int limit; } [TLDef(0xF2F2330A)] diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 36011aa..892f37e 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 = 201; // fetched 20/04/2025 01:20:15 + public const int Version = 202; // fetched 01/05/2025 10:01:40 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -217,6 +217,7 @@ namespace TL [0xACDFCB81] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), + [0x2FFE2F7A] = typeof(MessageActionConferenceCall), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -424,6 +425,7 @@ namespace TL [0x283BD312] = typeof(UpdateBotPurchasedPaidMedia), [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0x504AA18F] = typeof(UpdateSentPhoneCode), + [0xA477288F] = typeof(UpdateGroupCallChainBlocks), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -756,7 +758,7 @@ namespace TL [0xE095C1A0] = typeof(PhoneCallDiscardReasonDisconnect), [0x57ADC690] = typeof(PhoneCallDiscardReasonHangup), [0xFAF7E8C9] = typeof(PhoneCallDiscardReasonBusy), - [0xAFE2B839] = typeof(PhoneCallDiscardReasonAllowGroupCall), + [0x9FBBF1F7] = typeof(PhoneCallDiscardReasonMigrateConferenceCall), [0x7D748D04] = typeof(DataJSON), [0xCB296BF8] = typeof(LabeledPrice), [0x049EE584] = typeof(Invoice), @@ -789,11 +791,11 @@ namespace TL [0x32DA9E9C] = typeof(InputStickerSetItem), [0x1E36FDED] = typeof(InputPhoneCall), [0x5366C915] = typeof(PhoneCallEmpty), - [0xEED42858] = typeof(PhoneCallWaiting), - [0x45361C63] = typeof(PhoneCallRequested), - [0x22FD7181] = typeof(PhoneCallAccepted), - [0x3BA5940C] = typeof(PhoneCall), - [0xF9D25503] = typeof(PhoneCallDiscarded), + [0xC5226F17] = typeof(PhoneCallWaiting), + [0x14B0ED0C] = typeof(PhoneCallRequested), + [0x3660C311] = typeof(PhoneCallAccepted), + [0x30535AF5] = typeof(PhoneCall), + [0x50CA4DE1] = typeof(PhoneCallDiscarded), [0x9CC123C7] = typeof(PhoneConnection), [0x635FE375] = typeof(PhoneConnectionWebrtc), [0xFC878FC8] = typeof(PhoneCallProtocol), @@ -1031,8 +1033,10 @@ namespace TL [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0xCDF8D3E3] = typeof(GroupCall), + [0x553B0BA1] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), + [0xFE06823F] = typeof(InputGroupCallSlug), + [0x8C10603F] = typeof(InputGroupCallInviteMessage), [0xEBA636FE] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), [0xF47751B6] = typeof(Phone_GroupParticipants), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1debd31..a19c731 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: 201 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 202 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 8836f8372b6a76d747e34867e1e7218c715cb50e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 14 May 2025 18:18:20 +0200 Subject: [PATCH 284/336] API Layer 203: Stargift resale, auto-translation... --- README.md | 2 +- src/TL.Schema.cs | 143 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 67 ++++++++++++++++- src/TL.Table.cs | 24 +++++-- src/WTelegramClient.csproj | 2 +- 5 files changed, 215 insertions(+), 23 deletions(-) diff --git a/README.md b/README.md index d2aadf3..557ce41 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-202-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-203-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 58a7de8..c05334e 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1204,6 +1204,7 @@ namespace TL has_bot_verification_icon = 0x2000, /// Field has a value has_send_paid_messages_stars = 0x4000, + autotranslation = 0x8000, } /// ID of the channel, see here » for more info @@ -2923,7 +2924,7 @@ namespace TL } } /// See - [TLDef(0xACDFCB81)] + [TLDef(0x2E3AE60E)] public sealed partial class MessageActionStarGiftUnique : MessageAction { public Flags flags; @@ -2933,6 +2934,9 @@ namespace TL [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; + [IfFlag(8)] public long resale_stars; + [IfFlag(9)] public int can_transfer_at; + [IfFlag(10)] public int can_resell_at; [Flags] public enum Flags : uint { @@ -2944,6 +2948,9 @@ namespace TL refunded = 0x20, has_from_id = 0x40, has_peer = 0x80, + has_resale_stars = 0x100, + has_can_transfer_at = 0x200, + has_can_resell_at = 0x400, } } /// See @@ -12137,6 +12144,12 @@ namespace TL /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } + /// See + [TLDef(0xC517F77E)] + public sealed partial class ChannelAdminLogEventActionToggleAutotranslation : ChannelAdminLogEventAction + { + public bool new_value; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -14367,7 +14380,7 @@ namespace TL public DateTime expires; } /// MTProxy/Public Service Announcement information See - [TLDef(0x8C39793F)] + [TLDef(0x08A4D87A)] public sealed partial class Help_PromoData : Help_PromoDataBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14375,15 +14388,18 @@ namespace TL /// Expiry of PSA/MTProxy info public DateTime expires; /// MTProxy/PSA peer - public Peer peer; - /// Chat info - public Dictionary chats; - /// User info - public Dictionary users; + [IfFlag(3)] public Peer peer; /// PSA type [IfFlag(1)] public string psa_type; /// PSA message [IfFlag(2)] public string psa_message; + public string[] pending_suggestions; + public string[] dismissed_suggestions; + [IfFlag(4)] public PendingSuggestion custom_pending_suggestion; + /// Chat info + public Dictionary chats; + /// User info + public Dictionary users; [Flags] public enum Flags : uint { @@ -14393,6 +14409,10 @@ namespace TL has_psa_type = 0x2, /// Field has a value has_psa_message = 0x4, + /// Field has a value + has_peer = 0x8, + /// Field has a value + has_custom_pending_suggestion = 0x10, } /// returns a or for the result public IPeerInfo UserOrChat => peer?.UserOrChat(users, chats); @@ -15976,6 +15996,13 @@ namespace TL public InputUserBase bot; public long stars; } + /// See + [TLDef(0x63CBC38C)] + public sealed partial class InputInvoiceStarGiftResale : InputInvoice + { + public string slug; + public InputPeer to_id; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -19541,6 +19568,7 @@ namespace TL /// Field has a value has_premium_gift_months = 0x100000, business_transfer = 0x200000, + stargift_resale = 0x400000, } } @@ -19909,9 +19937,10 @@ namespace TL public virtual long ID => default; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; + public virtual string Title => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x02CC73C8)] + [TLDef(0xC62ACA28)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -19926,6 +19955,7 @@ namespace TL [IfFlag(0)] public int availability_remains; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. [IfFlag(0)] public int availability_total; + [IfFlag(4)] public long availability_resale; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
public long convert_stars; /// For sold out gifts only: when was the gift first bought. @@ -19933,6 +19963,8 @@ namespace TL /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; [IfFlag(3)] public long upgrade_stars; + [IfFlag(4)] public long resell_min_stars; + [IfFlag(5)] public string title; [Flags] public enum Flags : uint { @@ -19944,15 +19976,20 @@ namespace TL birthday = 0x4, /// Field has a value has_upgrade_stars = 0x8, + /// Fields and have a value + has_availability_resale = 0x10, + /// Field has a value + has_title = 0x20, } /// Identifier of the gift public override long ID => id; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; + public override string Title => title; } ///
See - [TLDef(0x5C62D151)] + [TLDef(0x6411DB89)] public sealed partial class StarGiftUnique : StarGiftBase { public Flags flags; @@ -19967,6 +20004,7 @@ namespace TL public int availability_issued; public int availability_total; [IfFlag(3)] public string gift_address; + [IfFlag(4)] public long resell_stars; [Flags] public enum Flags : uint { @@ -19974,10 +20012,12 @@ namespace TL has_owner_name = 0x2, has_owner_address = 0x4, has_gift_address = 0x8, + has_resell_stars = 0x10, } public override long ID => id; public override int AvailabilityTotal => availability_total; + public override string Title => title; } /// Available gifts ». See @@ -20272,10 +20312,11 @@ namespace TL public int rarity_permille; } /// See - [TLDef(0x94271762)] + [TLDef(0xD93D859C)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { public string name; + public int backdrop_id; public int center_color; public int edge_color; public int pattern_color; @@ -20336,7 +20377,7 @@ namespace TL } /// See - [TLDef(0x6056DBA5)] + [TLDef(0xDFDA0499)] public sealed partial class SavedStarGift : IObject { public Flags flags; @@ -20350,6 +20391,8 @@ namespace TL [IfFlag(6)] public long upgrade_stars; [IfFlag(7)] public int can_export_at; [IfFlag(8)] public long transfer_stars; + [IfFlag(13)] public int can_transfer_at; + [IfFlag(14)] public int can_resell_at; [Flags] public enum Flags : uint { @@ -20366,6 +20409,8 @@ namespace TL can_upgrade = 0x400, has_saved_id = 0x800, pinned_to_top = 0x1000, + has_can_transfer_at = 0x2000, + has_can_resell_at = 0x4000, } } @@ -20405,6 +20450,12 @@ namespace TL public InputPeer peer; public long saved_id; } + /// See + [TLDef(0x2085C238)] + public sealed partial class InputSavedStarGiftSlug : InputSavedStarGift + { + public string slug; + } /// See [TLDef(0x84AA3A9C)] @@ -20514,4 +20565,74 @@ namespace TL /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + + /// See + public abstract partial class StarGiftAttributeId : IObject { } + /// See + [TLDef(0x48AAAE3C)] + public sealed partial class StarGiftAttributeIdModel : StarGiftAttributeId + { + public long document_id; + } + /// See + [TLDef(0x4A162433)] + public sealed partial class StarGiftAttributeIdPattern : StarGiftAttributeId + { + public long document_id; + } + /// See + [TLDef(0x1F01C757)] + public sealed partial class StarGiftAttributeIdBackdrop : StarGiftAttributeId + { + public int backdrop_id; + } + + /// See + [TLDef(0x2EB1B658)] + public sealed partial class StarGiftAttributeCounter : IObject + { + public StarGiftAttributeId attribute; + public int count; + } + + /// See + [TLDef(0x947A12DF)] + public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver + { + public Flags flags; + public int count; + public StarGiftBase[] gifts; + [IfFlag(0)] public string next_offset; + [IfFlag(1)] public StarGiftAttribute[] attributes; + [IfFlag(1)] public long attributes_hash; + public Dictionary chats; + [IfFlag(2)] public StarGiftAttributeCounter[] counters; + public Dictionary users; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + has_attributes = 0x2, + has_counters = 0x4, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xC387C04E)] + public sealed partial class Stories_CanSendStoryCount : IObject + { + public int count_remains; + } + + /// See + [TLDef(0xE7E82E12)] + public sealed partial class PendingSuggestion : IObject + { + public string suggestion; + public TextWithEntities title; + public TextWithEntities description; + public string url; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9a50d76..e872cc4 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -5587,6 +5587,14 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); + /// See + public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) + => client.Invoke(new Channels_ToggleAutotranslation + { + 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 @@ -6367,6 +6375,26 @@ namespace TL purpose = purpose, }); + /// See + public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) + => client.Invoke(new Payments_GetResaleStarGifts + { + flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0)), + attributes_hash = attributes_hash ?? default, + gift_id = gift_id, + attributes = attributes, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) + => client.Invoke(new Payments_UpdateStarGiftPrice + { + stargift = stargift, + resell_stars = resell_stars, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -7193,7 +7221,7 @@ namespace TL /// Check whether we can post stories as the specified peer. See Possible codes: 400 (details) /// The peer from which we wish to post stories. - public static Task Stories_CanSendStory(this Client client, InputPeer peer) + public static Task Stories_CanSendStory(this Client client, InputPeer peer) => client.Invoke(new Stories_CanSendStory { peer = peer, @@ -12224,6 +12252,13 @@ namespace TL.Methods public long send_paid_messages_stars; } + [TLDef(0x167FC0A1)] + public sealed partial class Channels_ToggleAutotranslation : IMethod + { + public InputChannelBase channel; + public bool enabled; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -12903,6 +12938,32 @@ namespace TL.Methods public InputStorePaymentPurpose purpose; } + [TLDef(0x7A5FA236)] + public sealed partial class Payments_GetResaleStarGifts : IMethod + { + public Flags flags; + [IfFlag(0)] public long attributes_hash; + public long gift_id; + [IfFlag(3)] public StarGiftAttributeId[] attributes; + public string offset; + public int limit; + + [Flags] public enum Flags : uint + { + has_attributes_hash = 0x1, + sort_by_price = 0x2, + sort_by_num = 0x4, + has_attributes = 0x8, + } + } + + [TLDef(0x3BAEA4E1)] + public sealed partial class Payments_UpdateStarGiftPrice : IMethod + { + public InputSavedStarGift stargift; + public long resell_stars; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -13604,8 +13665,8 @@ namespace TL.Methods public InputPeer[] peers; } - [TLDef(0xC7DFDFDD)] - public sealed partial class Stories_CanSendStory : IMethod + [TLDef(0x30EB63F0)] + public sealed partial class Stories_CanSendStory : IMethod { public InputPeer peer; } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 892f37e..8e52198 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 = 202; // fetched 01/05/2025 10:01:40 + public const int Version = 203; // fetched 14/05/2025 16:07:47 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -214,7 +214,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0x4717E8A4] = typeof(MessageActionStarGift), - [0xACDFCB81] = typeof(MessageActionStarGiftUnique), + [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -859,6 +859,7 @@ namespace TL [0x46D840AB] = typeof(ChannelAdminLogEventActionChangeEmojiStickerSet), [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), + [0xC517F77E] = typeof(ChannelAdminLogEventActionToggleAutotranslation), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1011,7 +1012,7 @@ namespace TL [0x8EA464B6] = typeof(StatsGraph), [0x396CA5FC] = typeof(Stats_BroadcastStats), [0x98F6AC75] = typeof(Help_PromoDataEmpty), - [0x8C39793F] = typeof(Help_PromoData), + [0x08A4D87A] = typeof(Help_PromoData), [0xDE33B094] = typeof(VideoSize), [0xF85C413C] = typeof(VideoSizeEmojiMarkup), [0x0DA082FE] = typeof(VideoSizeStickerMarkup), @@ -1116,6 +1117,7 @@ namespace TL [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), + [0x63CBC38C] = typeof(InputInvoiceStarGiftResale), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1353,8 +1355,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x02CC73C8] = typeof(StarGift), - [0x5C62D151] = typeof(StarGiftUnique), + [0xC62ACA28] = typeof(StarGift), + [0x6411DB89] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x901689EA] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1375,17 +1377,18 @@ namespace TL [0xF93CD45C] = typeof(BotVerification), [0x39D99013] = typeof(StarGiftAttributeModel), [0x13ACFF19] = typeof(StarGiftAttributePattern), - [0x94271762] = typeof(StarGiftAttributeBackdrop), + [0xD93D859C] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0xCAA2F60B] = typeof(Payments_UniqueStarGift), [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0x6056DBA5] = typeof(SavedStarGift), + [0xDFDA0499] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), + [0x2085C238] = typeof(InputSavedStarGiftSlug), [0x84AA3A9C] = typeof(Payments_StarGiftWithdrawalUrl), [0x206AD49E] = null,//PaidReactionPrivacyDefault [0x1F0C1AD9] = typeof(PaidReactionPrivacyAnonymous), @@ -1399,6 +1402,13 @@ namespace TL [0xC69708D3] = typeof(SponsoredPeer), [0xEA32B4B1] = null,//Contacts_SponsoredPeersEmpty [0xEB032884] = typeof(Contacts_SponsoredPeers), + [0x48AAAE3C] = typeof(StarGiftAttributeIdModel), + [0x4A162433] = typeof(StarGiftAttributeIdPattern), + [0x1F01C757] = typeof(StarGiftAttributeIdBackdrop), + [0x2EB1B658] = typeof(StarGiftAttributeCounter), + [0x947A12DF] = typeof(Payments_ResaleStarGifts), + [0xC387C04E] = typeof(Stories_CanSendStoryCount), + [0xE7E82E12] = typeof(PendingSuggestion), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index a19c731..2a71dd9 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: 202 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 203 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 5358471574404a4103c386a9c5bc18c4fec25fcc Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Jun 2025 02:41:06 +0200 Subject: [PATCH 285/336] Fix fields serialization order on KeyboardButtonSimpleWebView --- generator/MTProtoGenerator.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 5cc7719..4fd169d 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -54,7 +54,6 @@ public class MTProtoGenerator : IIncrementalGenerator var tldef = symbol.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); if (tldef == null) continue; var id = (uint)tldef.ConstructorArguments[0].Value; - var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; StringBuilder writeTl = new(), readTL = new(); var ns = symbol.BaseType.ContainingNamespace.ToString(); var name = symbol.BaseType.Name; @@ -105,8 +104,12 @@ public class MTProtoGenerator : IIncrementalGenerator .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); var members = symbol.GetMembers().ToList(); for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) + { + var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; if (inheritBefore) members.InsertRange(0, parent.GetMembers()); else members.AddRange(parent.GetMembers()); + tldef = parent.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); + } foreach (var member in members.OfType()) { if (member.DeclaredAccessibility != Accessibility.Public || member.IsStatic) continue; From d49d620eddc35aff6570879c5e9f0984f669cc4c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:01:52 +0200 Subject: [PATCH 286/336] Fixed possible concurrency issue on msgId/seqno, that could freeze protocol or cause BadMsgNotification (during downloads for example) Thanks goes to @Deeps00009 --- src/Client.cs | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 74e0b7a..222c6f6 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1430,8 +1430,11 @@ namespace WTelegram int seqno; long msgId = DateTime.UtcNow.Ticks + _dcSession.serverTicksOffset - 621355968000000000L; msgId = msgId * 428 + (msgId >> 24) * 25110956; // approximately unixtime*2^32 and divisible by 4 - if (msgId <= _dcSession.lastSentMsgId) msgId = _dcSession.lastSentMsgId += 4; else _dcSession.lastSentMsgId = msgId; - seqno = isContent ? _dcSession.seqno++ * 2 + 1 : _dcSession.seqno * 2; + lock (_session) + { + if (msgId <= _dcSession.lastSentMsgId) msgId = _dcSession.lastSentMsgId += 4; else _dcSession.lastSentMsgId = msgId; + seqno = isContent ? _dcSession.seqno++ * 2 + 1 : _dcSession.seqno * 2; + } return (msgId, seqno); } From 04e043222e7ab7f888727f77c9d6f7bb21c0b314 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:11:14 +0200 Subject: [PATCH 287/336] ParallelTransfers property can configure how many parallel download/upload of file chunks can occur at the same time. Default is 2 (optimal for non-premium accounts), was 10 in previous versions. --- src/Client.cs | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 222c6f6..fa8f430 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -59,6 +59,18 @@ namespace WTelegram public long UserId => _session.UserId; /// Info about the current logged-in user. This is only filled after a successful (re)login, not updated later public User User { get; private set; } + /// Number of parallel transfers operations (uploads/downloads) allowed at the same time. + /// Don't use this property while transfers are ongoing! + public int ParallelTransfers + { + get => _parallelTransfers.CurrentCount; + set + { + int delta = value - _parallelTransfers.CurrentCount; + for (; delta < 0; delta++) _parallelTransfers.Wait(); + if (delta > 0) _parallelTransfers.Release(delta); + } + } private Func _config; private readonly Session _session; @@ -83,7 +95,7 @@ namespace WTelegram private int _reactorReconnects = 0; private const string ConnectionShutDown = "Could not read payload length : Connection shut down"; private const long Ticks5Secs = 5 * TimeSpan.TicksPerSecond; - private readonly SemaphoreSlim _parallelTransfers = new(10); // max parallel part uploads/downloads + private readonly SemaphoreSlim _parallelTransfers = new(2); // max parallel part uploads/downloads private readonly SHA256 _sha256 = SHA256.Create(); private readonly SHA256 _sha256Recv = SHA256.Create(); #if OBFUSCATION @@ -209,7 +221,7 @@ namespace WTelegram if (_tcpClient != null) throw new InvalidOperationException("Cannot switch to HTTP after TCP connection"); _httpClient = httpClient ?? new(); _httpWait = defaultHttpWait; - while (_parallelTransfers.CurrentCount > 1) _parallelTransfers.Wait(); + ParallelTransfers = 1; } /// Disconnect from Telegram (shouldn't be needed in normal usage) From 3ff1200068394c71e5891ed653d1c249d0d241cf Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 26 Jun 2025 22:02:26 +0200 Subject: [PATCH 288/336] Use signed DcId values (improved logs) --- src/Client.cs | 27 +++++++++++++-------------- src/Session.cs | 2 +- src/TL.cs | 4 ++-- 3 files changed, 16 insertions(+), 17 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index fa8f430..40354de 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -325,7 +325,7 @@ namespace WTelegram try { Auth_ExportedAuthorization exported = null; - if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId && altSession.DcID != _dcSession.DcID) + if (_session.UserId != 0 && IsMainDC && altSession.UserId != _session.UserId && Math.Abs(altSession.DcID) != Math.Abs(_dcSession.DcID)) exported = await this.Auth_ExportAuthorization(Math.Abs(dcId)); await altSession.Client.ConnectAsync(); if (exported != null) @@ -345,16 +345,16 @@ namespace WTelegram return altSession.Client; } - private async Task Reactor(Stream stream, CancellationTokenSource cts) + private async Task Reactor(Stream stream, CancellationToken ct) { const int MinBufferSize = 1024; var data = new byte[MinBufferSize]; - while (!cts.IsCancellationRequested) + while (!ct.IsCancellationRequested) { IObject obj = null; try { - if (await stream.FullReadAsync(data, 4, cts.Token) != 4) + if (await stream.FullReadAsync(data, 4, ct) != 4) throw new WTException(ConnectionShutDown); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, 4); @@ -366,7 +366,7 @@ namespace WTelegram data = new byte[payloadLen]; else if (Math.Max(payloadLen, MinBufferSize) < data.Length / 4) data = new byte[Math.Max(payloadLen, MinBufferSize)]; - if (await stream.FullReadAsync(data, payloadLen, cts.Token) != payloadLen) + if (await stream.FullReadAsync(data, payloadLen, ct) != payloadLen) throw new WTException("Could not read frame data : Connection shut down"); #if OBFUSCATION _recvCtr.EncryptDecrypt(data, payloadLen); @@ -375,14 +375,14 @@ namespace WTelegram } catch (Exception ex) // an exception in RecvAsync is always fatal { - if (cts.IsCancellationRequested) return; + if (ct.IsCancellationRequested) return; bool disconnectedAltDC = !IsMainDC && ex is WTException { Message: ConnectionShutDown } or IOException { InnerException: SocketException }; if (disconnectedAltDC) Helpers.Log(3, $"{_dcSession.DcID}>Alt DC disconnected: {ex.Message}"); else Helpers.Log(5, $"{_dcSession.DcID}>An exception occured in the reactor: {ex}"); var oldSemaphore = _sendSemaphore; - await oldSemaphore.WaitAsync(cts.Token); // prevent any sending while we reconnect + await oldSemaphore.WaitAsync(ct); // prevent any sending while we reconnect var reactorError = new ReactorError { Exception = ex }; try { @@ -599,13 +599,13 @@ namespace WTelegram var ctorNb = reader.ReadUInt32(); if (ctorNb == Layer.RpcResultCtor) { - Helpers.Log(1, $" → {"RpcResult",-38} {MsgIdToStamp(msg.msg_id):u}"); + Helpers.Log(1, $" → {"RpcResult",-38} {MsgIdToStamp(msg.msg_id):u}"); msg.body = ReadRpcResult(reader); } else { var obj = msg.body = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) @@ -676,9 +676,9 @@ namespace WTelegram var typeName = result?.GetType().Name; if (MsgIdToStamp(msgId) >= _session.SessionStart) - Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(4, $" → {typeName,-37} for unknown msgId #{(short)msgId.GetHashCode():X4}"); else - Helpers.Log(1, $" → {typeName,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); + Helpers.Log(1, $" → {typeName,-37} for past msgId #{(short)msgId.GetHashCode():X4}"); } return new RpcResult { req_msg_id = msgId, result = result }; } @@ -889,8 +889,7 @@ namespace WTelegram if (MTProxyUrl != null) { #if OBFUSCATION - if (TLConfig?.test_mode == true) dcId += 10000; - if (_dcSession.DataCenter?.flags.HasFlag(DcOption.Flags.media_only) == true) dcId = -dcId; + if (TLConfig?.test_mode == true) dcId += dcId < 0 ? -10000 : 10000; var parms = HttpUtility.ParseQueryString(MTProxyUrl[MTProxyUrl.IndexOf('?')..]); var server = parms["server"]; int port = int.Parse(parms["port"]); @@ -988,7 +987,7 @@ namespace WTelegram #endif await _networkStream.WriteAsync(preamble, 0, preamble.Length, _cts.Token); - _reactorTask = Reactor(_networkStream, _cts); + _reactorTask = Reactor(_networkStream, _cts.Token); } _sendSemaphore.Release(); diff --git a/src/Session.cs b/src/Session.cs index c12d65a..321c319 100644 --- a/src/Session.cs +++ b/src/Session.cs @@ -36,7 +36,7 @@ namespace WTelegram internal long lastSentMsgId; internal bool withoutUpdates; internal Client Client; - internal int DcID => DataCenter?.id ?? 0; + internal int DcID => DataCenter == null ? 0 : DataCenter.flags.HasFlag(TL.DcOption.Flags.media_only) ? -DataCenter.id : DataCenter.id; internal IPEndPoint EndPoint => DataCenter == null ? null : new(IPAddress.Parse(DataCenter.ip_address), DataCenter.port); internal void Renew() { Helpers.Log(3, $"Renewing session on DC {DcID}..."); id = Helpers.RandomLong(); seqno = 0; lastSentMsgId = 0; } public void DisableUpdates(bool disable = true) { if (withoutUpdates != disable) { withoutUpdates = disable; Renew(); } } diff --git a/src/TL.cs b/src/TL.cs index 741bab4..67342ea 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -201,9 +201,9 @@ namespace TL var patchPos = writer.BaseStream.Position; writer.Write(0); // patched below if ((msg.seq_no & 1) != 0) - WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); + WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else - WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); + WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); writer.WriteTLObject(msg.body); writer.BaseStream.Position = patchPos; writer.Write((int)(writer.BaseStream.Length - patchPos - 4)); // patch bytes field From 25990a8477e6e222c832ed3bfb52a6b8154fb8e8 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 29 Jun 2025 16:01:05 +0200 Subject: [PATCH 289/336] Fix Salts management --- src/Client.cs | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 40354de..f834bd2 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -140,6 +140,7 @@ namespace WTelegram TcpHandler = cloneOf.TcpHandler; MTProxyUrl = cloneOf.MTProxyUrl; PingInterval = cloneOf.PingInterval; + MaxAutoReconnects = cloneOf.MaxAutoReconnects; TLConfig = cloneOf.TLConfig; _dcSession = dcSession; } @@ -561,7 +562,7 @@ namespace WTelegram { var keys = _dcSession.Salts.Keys; if (keys[^1] == DateTime.MaxValue) return; // GetFutureSalts ongoing - var now = DateTime.UtcNow.AddTicks(_dcSession.serverTicksOffset); + var now = DateTime.UtcNow.AddTicks(_dcSession.serverTicksOffset - TimeSpan.TicksPerMinute); bool removed = false; for (; keys.Count > 1 && keys[1] < now; _dcSession.OldSalt = _dcSession.Salt, _dcSession.Salt = _dcSession.Salts.Values[0], removed = true) _dcSession.Salts.RemoveAt(0); @@ -742,10 +743,7 @@ namespace WTelegram case MsgsAck msgsAck: break; // we don't do anything with these, for now case BadMsgNotification badMsgNotification: - await _sendSemaphore.WaitAsync(); - bool retryLast = badMsgNotification.bad_msg_id == _dcSession.lastSentMsgId; - var lastSentMsg = _lastSentMsg; - _sendSemaphore.Release(); + bool retryRpcs = true; var logLevel = badMsgNotification.error_code == 48 ? 2 : 4; Helpers.Log(logLevel, $"BadMsgNotification {badMsgNotification.error_code} for msg #{(short)badMsgNotification.bad_msg_id.GetHashCode():X4}"); switch (badMsgNotification.error_code) @@ -760,7 +758,7 @@ namespace WTelegram case 32: // msg_seqno too low (the server has already received a message with a lower msg_id but with either a higher or an equal and odd seqno) case 33: // msg_seqno too high (similarly, there is a message with a higher msg_id but with either a lower or an equal and odd seqno) if (_dcSession.seqno <= 1) - retryLast = false; + retryRpcs = false; else { await ResetAsync(false, false); @@ -775,25 +773,19 @@ namespace WTelegram CheckSalt(); break; default: - retryLast = false; + retryRpcs = false; break; } - if (retryLast) + if (retryRpcs) { - Rpc prevRequest; lock (_pendingRpcs) - _pendingRpcs.TryGetValue(badMsgNotification.bad_msg_id, out prevRequest); - await SendAsync(lastSentMsg, lastSentMsg is not MsgContainer, prevRequest); - lock (_pendingRpcs) - _pendingRpcs.Remove(badMsgNotification.bad_msg_id); - } - else if (PullPendingRequest(badMsgNotification.bad_msg_id) is Rpc rpc) - { - if (_bareRpc?.msgId == badMsgNotification.bad_msg_id) _bareRpc = null; - rpc.tcs.SetException(new WTException($"BadMsgNotification {badMsgNotification.error_code}")); - } - else + { + foreach (var rpc in _pendingRpcs.Values) + rpc.tcs.TrySetResult(new RpcError { error_code = -503, error_message = $"BadMsgNotification {badMsgNotification.error_code}" }); + _pendingRpcs.Clear(); + } RaiseUpdates(badMsgNotification); + } break; default: RaiseUpdates(obj); From fa90e236e704eec061f2942fb613413417d5d506 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 29 Jun 2025 16:42:27 +0200 Subject: [PATCH 290/336] Helpers to download animated photos (DownloadFileAsync + photo.LargestVideoSize) --- src/Client.Helpers.cs | 12 ++++++++++++ src/TL.Xtended.cs | 3 ++- 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index eefcd36..a26210d 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -334,6 +334,18 @@ namespace WTelegram return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, photoSize.FileSize, progress); } + /// Download an animated photo from Telegram into the outputStream + /// The photo to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the animated photo. Use photo.LargestVideoSize to download the largest version of the animated photo + /// (optional) Callback for tracking the progression of the transfer + /// The file type of the photo + public async Task DownloadFileAsync(Photo photo, Stream outputStream, VideoSize videoSize, ProgressCallback progress = null) + { + var fileLocation = photo.ToFileLocation(videoSize); + return await DownloadFileAsync(fileLocation, outputStream, photo.dc_id, videoSize.size, progress); + } + /// Download a document from Telegram into the outputStream /// The document to download /// Stream to write the file content to. This method does not close/dispose the stream diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 30a2c39..630a370 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -348,8 +348,9 @@ namespace TL protected override InputPhoto ToInputPhoto() => new() { id = id, access_hash = access_hash, file_reference = file_reference }; public InputPhotoFileLocation ToFileLocation() => ToFileLocation(LargestPhotoSize); public InputPhotoFileLocation ToFileLocation(PhotoSizeBase photoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = photoSize.Type }; - public InputDocumentFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; + public InputPhotoFileLocation ToFileLocation(VideoSize videoSize) => new() { id = id, access_hash = access_hash, file_reference = file_reference, thumb_size = videoSize.type }; public PhotoSizeBase LargestPhotoSize => sizes.Aggregate((agg, next) => (long)next.Width * next.Height > (long)agg.Width * agg.Height ? next : agg); + public VideoSize LargestVideoSize => video_sizes?.OfType().DefaultIfEmpty().Aggregate((agg, next) => (long)next.w * next.h > (long)agg.w * agg.h ? next : agg); } partial class PhotoSizeBase From 4f7954db6153eae5ead0b547df140c9bae9579a9 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 24 Jun 2025 19:25:30 +0200 Subject: [PATCH 291/336] API Layer 204: Channel DMs (MonoForum), Forum Tabs, Saved peer/dialog stuff... (for the very latest layers, go to https://patreon.com/wizou) --- README.md | 2 +- src/TL.Schema.cs | 106 +++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 164 ++++++++++++++++++++++++++++++------- src/TL.Table.cs | 20 +++-- src/WTelegramClient.csproj | 5 +- 5 files changed, 245 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 557ce41..84117c0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-203-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-204-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 c05334e..0208090 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1074,7 +1074,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0x7482147E)] + [TLDef(0xFE685355)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1119,6 +1119,7 @@ namespace TL [IfFlag(43)] public DateTime subscription_until_date; [IfFlag(45)] public long bot_verification_icon; [IfFlag(46)] public long send_paid_messages_stars; + [IfFlag(50)] public long linked_monoforum_id; [Flags] public enum Flags : uint { @@ -1205,6 +1206,11 @@ namespace TL /// Field has a value has_send_paid_messages_stars = 0x4000, autotranslation = 0x8000, + broadcast_messages_allowed = 0x10000, + monoforum = 0x20000, + /// Field has a value + has_linked_monoforum_id = 0x40000, + forum_tabs = 0x80000, } /// ID of the channel, see here » for more info @@ -2961,10 +2967,16 @@ namespace TL public long stars; } /// See - [TLDef(0xBCD71419)] + [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { + public Flags flags; public long stars; + + [Flags] public enum Flags : uint + { + broadcast_messages_allowed = 0x1, + } } /// See [TLDef(0x2FFE2F7A)] @@ -4650,7 +4662,7 @@ namespace TL public int max_id; } /// Notifies a change of a message draft. See - [TLDef(0x1B49EC6D)] + [TLDef(0xEDFC111E)] public sealed partial class UpdateDraftMessage : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4659,6 +4671,7 @@ namespace TL public Peer peer; /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// The draft public DraftMessageBase draft; @@ -4666,6 +4679,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// Some featured stickers were marked as read See @@ -4812,7 +4827,7 @@ namespace TL [TLDef(0xE511996D)] public sealed partial class UpdateFavedStickers : Update { } /// The specified channel/supergroup messages were read See - [TLDef(0xEA29055D)] + [TLDef(0x25F324F7)] public sealed partial class UpdateChannelReadMessagesContents : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4821,6 +4836,7 @@ namespace TL public long channel_id; /// Forum topic ID. [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// IDs of messages that were read public int[] messages; @@ -4828,6 +4844,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// All contacts were deleted See @@ -4841,18 +4859,21 @@ namespace TL public int available_min_id; } /// The manual unread mark of a chat was changed See - [TLDef(0xE16459C3)] + [TLDef(0xB658F23E)] public sealed partial class UpdateDialogUnreadMark : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The dialog public DialogPeerBase peer; + [IfFlag(1)] public Peer saved_peer_id; [Flags] public enum Flags : uint { /// Was the chat marked or unmarked as read unread = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// The results of a poll have changed See @@ -5332,7 +5353,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } /// New message reactions » are available See - [TLDef(0x5E1B3CB8)] + [TLDef(0x1E297BFA)] public sealed partial class UpdateMessageReactions : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -5343,6 +5364,7 @@ namespace TL public int msg_id; /// Forum topic ID [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public Peer saved_peer_id; /// Reactions public MessageReactions reactions; @@ -5350,6 +5372,8 @@ namespace TL { /// Field has a value has_top_msg_id = 0x1, + /// Field has a value + has_saved_peer_id = 0x2, } } /// The list of installed attachment menu entries » has changed, use Messages_GetAttachMenuBots to fetch the updated list. See @@ -5852,6 +5876,22 @@ namespace TL public byte[][] blocks; public int next_offset; } + /// See + [TLDef(0x77B0E372)] + public sealed partial class UpdateReadMonoForumInbox : Update + { + public long channel_id; + public Peer saved_peer_id; + public int read_max_id; + } + /// See + [TLDef(0xA4A79376)] + public sealed partial class UpdateReadMonoForumOutbox : Update + { + public long channel_id; + public Peer saved_peer_id; + public int read_max_id; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -17484,7 +17524,7 @@ namespace TL /// Contains info about a message or story to reply to. See Derived classes: , public abstract partial class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0x22C0F6D5)] + [TLDef(0xB07038B0)] public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17501,6 +17541,7 @@ namespace TL [IfFlag(3)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; + [IfFlag(5)] public InputPeer monoforum_peer_id; [Flags] public enum Flags : uint { @@ -17514,6 +17555,8 @@ namespace TL has_quote_entities = 0x8, /// Field has a value has_quote_offset = 0x10, + /// Field has a value + has_monoforum_peer_id = 0x20, } } /// Reply to a story. See @@ -17525,6 +17568,12 @@ namespace TL /// ID of the story to reply to. public int story_id; } + /// See + [TLDef(0x69D66C45)] + public sealed partial class InputReplyToMonoForum : InputReplyTo + { + public InputPeer monoforum_peer_id; + } /// Represents a story deep link. See [TLDef(0x3FC9053B)] @@ -18336,9 +18385,17 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Represents a saved message dialog ». See Derived classes: + public abstract partial class SavedDialogBase : IObject + { + /// The dialog + public virtual Peer Peer => default; + /// The latest message ID + public virtual int TopMessage => default; + } /// Represents a saved dialog ». See [TLDef(0xBD87CB6C)] - public sealed partial class SavedDialog : IObject + public sealed partial class SavedDialog : SavedDialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -18352,13 +18409,40 @@ namespace TL /// Is the dialog pinned pinned = 0x4, } + + /// The dialog + public override Peer Peer => peer; + /// The latest message ID + public override int TopMessage => top_message; + } + /// See + [TLDef(0x64407EA7)] + public sealed partial class MonoForumDialog : SavedDialogBase + { + public Flags flags; + public Peer peer; + public int top_message; + public int read_inbox_max_id; + public int read_outbox_max_id; + public int unread_count; + public int unread_reactions_count; + [IfFlag(1)] public DraftMessageBase draft; + + [Flags] public enum Flags : uint + { + has_draft = 0x2, + unread_mark = 0x8, + } + + public override Peer Peer => peer; + public override int TopMessage => top_message; } /// Represents some saved message dialogs ». See Derived classes: , , public abstract partial class Messages_SavedDialogsBase : IObject { /// Saved message dialogs ». - public virtual SavedDialog[] Dialogs => default; + public virtual SavedDialogBase[] Dialogs => default; /// List of last messages from each saved dialog public virtual MessageBase[] Messages => default; /// Mentioned chats @@ -18371,7 +18455,7 @@ namespace TL public partial class Messages_SavedDialogs : Messages_SavedDialogsBase, IPeerResolver { /// Saved message dialogs ». - public SavedDialog[] dialogs; + public SavedDialogBase[] dialogs; /// List of last messages from each saved dialog public MessageBase[] messages; /// Mentioned chats @@ -18380,7 +18464,7 @@ namespace TL public Dictionary users; /// Saved message dialogs ». - public override SavedDialog[] Dialogs => dialogs; + public override SavedDialogBase[] Dialogs => dialogs; /// List of last messages from each saved dialog public override MessageBase[] Messages => messages; /// Mentioned chats diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index e872cc4..2cc521c 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1972,15 +1972,16 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, to_peer = to_peer, top_msg_id = top_msg_id ?? default, + reply_to = reply_to, schedule_date = schedule_date ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, @@ -2978,17 +2979,20 @@ namespace TL /// Manually mark dialog as unread See Possible codes: 400 (details) /// Mark as unread/read /// Dialog - public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, bool unread = false) + public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, InputPeer parent_peer = null, bool unread = false) => client.Invoke(new Messages_MarkDialogUnread { - flags = (Messages_MarkDialogUnread.Flags)(unread ? 0x1 : 0), + flags = (Messages_MarkDialogUnread.Flags)((parent_peer != null ? 0x2 : 0) | (unread ? 0x1 : 0)), + parent_peer = parent_peer, peer = peer, }); /// Get dialogs manually marked as unread See - public static Task Messages_GetDialogUnreadMarks(this Client client) + public static Task Messages_GetDialogUnreadMarks(this Client client, InputPeer parent_peer = null) => client.Invoke(new Messages_GetDialogUnreadMarks { + flags = (Messages_GetDialogUnreadMarks.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, }); /// Clear all drafts. See @@ -3312,12 +3316,13 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin /// Forum topic where to unpin - public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null) + public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_UnpinAllMessages { - flags = (Messages_UnpinAllMessages.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_UnpinAllMessages.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// 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
Delete a chat See Possible codes: 400 (details)
@@ -3691,12 +3696,13 @@ namespace TL /// Maximum number of results to return, see pagination /// Only return reactions for messages up until this message ID /// Only return reactions for messages starting from this message ID - public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null) + public static Task Messages_GetUnreadReactions(this Client client, InputPeer peer, int offset_id = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.Invoke(new Messages_GetUnreadReactions { - flags = (Messages_GetUnreadReactions.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_GetUnreadReactions.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, offset_id = offset_id, add_offset = add_offset, limit = limit, @@ -3707,12 +3713,13 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer /// Mark as read only reactions to messages within the specified forum topic - public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null) + public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_ReadReactions { - flags = (Messages_ReadReactions.Flags)(top_msg_id != null ? 0x1 : 0), + flags = (Messages_ReadReactions.Flags)((top_msg_id != null ? 0x1 : 0) | (saved_peer_id != null ? 0x2 : 0)), peer = peer, top_msg_id = top_msg_id ?? default, + saved_peer_id = saved_peer_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); /// View and search recently sent media.
This method does not support pagination. See Possible codes: 400 (details)
@@ -4088,10 +4095,11 @@ namespace TL /// Offset peer for pagination /// Number of list elements to be returned /// Hash used for caching, for more info click here - public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, bool exclude_pinned = false) + public static Task Messages_GetSavedDialogs(this Client client, DateTime offset_date = default, int offset_id = default, InputPeer offset_peer = null, int limit = int.MaxValue, long hash = default, InputPeer parent_peer = null, bool exclude_pinned = false) => client.Invoke(new Messages_GetSavedDialogs { - flags = (Messages_GetSavedDialogs.Flags)(exclude_pinned ? 0x1 : 0), + flags = (Messages_GetSavedDialogs.Flags)((parent_peer != null ? 0x2 : 0) | (exclude_pinned ? 0x1 : 0)), + parent_peer = parent_peer, offset_date = offset_date, offset_id = offset_id, offset_peer = offset_peer, @@ -4108,9 +4116,11 @@ namespace TL /// If a positive value was transferred, the method will return only messages with IDs less than max_id /// If a positive value was transferred, the method will return only messages with IDs more than min_id /// Result hash - public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default) + public static Task Messages_GetSavedHistory(this Client client, InputPeer peer, int offset_id = default, DateTime offset_date = default, int add_offset = default, int limit = int.MaxValue, int max_id = default, int min_id = default, long hash = default, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedHistory { + flags = (Messages_GetSavedHistory.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, peer = peer, offset_id = offset_id, offset_date = offset_date, @@ -4126,10 +4136,11 @@ namespace TL /// Maximum ID of message to delete /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp - public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, DateTime? min_date = null, DateTime? max_date = null) + public static Task Messages_DeleteSavedHistory(this Client client, InputPeer peer, int max_id = default, InputPeer parent_peer = null, DateTime? min_date = null, DateTime? max_date = null) => client.InvokeAffected(new Messages_DeleteSavedHistory { - flags = (Messages_DeleteSavedHistory.Flags)((min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + flags = (Messages_DeleteSavedHistory.Flags)((parent_peer != null ? 0x1 : 0) | (min_date != null ? 0x4 : 0) | (max_date != null ? 0x8 : 0)), + parent_peer = parent_peer, peer = peer, max_id = max_id, min_date = min_date ?? default, @@ -4496,6 +4507,24 @@ namespace TL id = id, }); + /// See + public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) + => client.Invoke(new Messages_GetSavedDialogsByID + { + flags = (Messages_GetSavedDialogsByID.Flags)(parent_peer != null ? 0x2 : 0), + parent_peer = parent_peer, + ids = ids, + }); + + /// See + public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) + => client.Invoke(new Messages_ReadSavedHistory + { + parent_peer = parent_peer, + peer = peer, + max_id = max_id, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5352,11 +5381,12 @@ namespace TL /// Enable or disable forum functionality in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// Enable or disable forum functionality - public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled) + public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled, bool tabs) => client.Invoke(new Channels_ToggleForum { channel = channel, enabled = enabled, + tabs = tabs, }); /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) @@ -5580,9 +5610,10 @@ namespace TL }); /// See - public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars) + public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars, bool broadcast_messages_allowed = false) => client.Invoke(new Channels_UpdatePaidMessagesPrice { + flags = (Channels_UpdatePaidMessagesPrice.Flags)(broadcast_messages_allowed ? 0x1 : 0), channel = channel, send_paid_messages_stars = send_paid_messages_stars, }); @@ -5595,6 +5626,14 @@ namespace TL enabled = enabled, }); + /// See + public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) + => client.Invoke(new Channels_GetMessageAuthor + { + channel = channel, + id = id, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -9238,7 +9277,7 @@ namespace TL.Methods } } - [TLDef(0xBB9FA475)] + [TLDef(0x38F0188C)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9247,6 +9286,7 @@ namespace TL.Methods public long[] random_id; public InputPeer to_peer; [IfFlag(9)] public int top_msg_id; + [IfFlag(22)] public InputReplyTo reply_to; [IfFlag(10)] public DateTime schedule_date; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; @@ -9268,6 +9308,7 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, + has_reply_to = 0x400000, } } @@ -10131,20 +10172,31 @@ namespace TL.Methods [TLDef(0x1CFF7E08)] public sealed partial class Messages_GetSplitRanges : IMethod { } - [TLDef(0xC286D98F)] + [TLDef(0x8C5006F8)] public sealed partial class Messages_MarkDialogUnread : IMethod { public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public InputDialogPeerBase peer; [Flags] public enum Flags : uint { unread = 0x1, + has_parent_peer = 0x2, } } - [TLDef(0x22E24E22)] - public sealed partial class Messages_GetDialogUnreadMarks : IMethod { } + [TLDef(0x21202222)] + public sealed partial class Messages_GetDialogUnreadMarks : IMethod + { + public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } + } [TLDef(0x7E58EE9C)] public sealed partial class Messages_ClearAllDrafts : IMethod { } @@ -10400,16 +10452,18 @@ namespace TL.Methods public int read_max_id; } - [TLDef(0xEE22B9A8)] + [TLDef(0x062DD747)] public sealed partial class Messages_UnpinAllMessages : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } @@ -10729,12 +10783,13 @@ namespace TL.Methods } } - [TLDef(0x3223495B)] + [TLDef(0xBD7F90AC)] public sealed partial class Messages_GetUnreadReactions : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; public int offset_id; public int add_offset; public int limit; @@ -10744,19 +10799,22 @@ namespace TL.Methods [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } - [TLDef(0x54AA7F8E)] + [TLDef(0x9EC44F93)] public sealed partial class Messages_ReadReactions : IMethod { public Flags flags; public InputPeer peer; [IfFlag(0)] public int top_msg_id; + [IfFlag(1)] public InputPeer saved_peer_id; [Flags] public enum Flags : uint { has_top_msg_id = 0x1, + has_saved_peer_id = 0x2, } } @@ -11056,10 +11114,11 @@ namespace TL.Methods } } - [TLDef(0x5381D21A)] + [TLDef(0x1E91FC99)] public sealed partial class Messages_GetSavedDialogs : IMethod { public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public DateTime offset_date; public int offset_id; public InputPeer offset_peer; @@ -11069,12 +11128,15 @@ namespace TL.Methods [Flags] public enum Flags : uint { exclude_pinned = 0x1, + has_parent_peer = 0x2, } } - [TLDef(0x3D9A414D)] + [TLDef(0x998AB009)] public sealed partial class Messages_GetSavedHistory : IMethod { + public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; public InputPeer peer; public int offset_id; public DateTime offset_date; @@ -11083,12 +11145,18 @@ namespace TL.Methods public int max_id; public int min_id; public long hash; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } } - [TLDef(0x6E98102B)] + [TLDef(0x4DC5085F)] public sealed partial class Messages_DeleteSavedHistory : IMethod { public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; public InputPeer peer; public int max_id; [IfFlag(2)] public DateTime min_date; @@ -11096,6 +11164,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { + has_parent_peer = 0x1, has_min_date = 0x4, has_max_date = 0x8, } @@ -11404,6 +11473,27 @@ namespace TL.Methods } } + [TLDef(0x6F6F9C96)] + public sealed partial class Messages_GetSavedDialogsByID : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; + public InputPeer[] ids; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x2, + } + } + + [TLDef(0xBA4A3B5B)] + public sealed partial class Messages_ReadSavedHistory : IMethod + { + public InputPeer parent_peer; + public InputPeer peer; + public int max_id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12053,11 +12143,12 @@ namespace TL.Methods public InputChannelBase channel; } - [TLDef(0xA4298B29)] + [TLDef(0x3FF75734)] public sealed partial class Channels_ToggleForum : IMethod { public InputChannelBase channel; public bool enabled; + public bool tabs; } [TLDef(0xF40C0224)] @@ -12245,11 +12336,17 @@ namespace TL.Methods public int limit; } - [TLDef(0xFC84653F)] + [TLDef(0x4B12327B)] public sealed partial class Channels_UpdatePaidMessagesPrice : IMethod { + public Flags flags; public InputChannelBase channel; public long send_paid_messages_stars; + + [Flags] public enum Flags : uint + { + broadcast_messages_allowed = 0x1, + } } [TLDef(0x167FC0A1)] @@ -12259,6 +12356,13 @@ namespace TL.Methods public bool enabled; } + [TLDef(0xECE2A0E6)] + public sealed partial class Channels_GetMessageAuthor : IMethod + { + public InputChannelBase channel; + public int id; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 8e52198..9cba0d9 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 = 203; // fetched 14/05/2025 16:07:47 + public const int Version = 204; // fetched 04/06/2025 15:07:47 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -136,7 +136,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0x7482147E] = typeof(Channel), + [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0x52D6806B] = typeof(ChannelFull), @@ -216,7 +216,7 @@ namespace TL [0x4717E8A4] = typeof(MessageActionStarGift), [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), - [0xBCD71419] = typeof(MessageActionPaidMessagesPrice), + [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), @@ -325,7 +325,7 @@ namespace TL [0xE40370A3] = typeof(UpdateEditMessage), [0x691E9052] = typeof(UpdateInlineBotCallbackQuery), [0xB75F99A9] = typeof(UpdateReadChannelOutbox), - [0x1B49EC6D] = typeof(UpdateDraftMessage), + [0xEDFC111E] = typeof(UpdateDraftMessage), [0x571D2742] = typeof(UpdateReadFeaturedStickers), [0x9A422C20] = typeof(UpdateRecentStickers), [0xA229DD06] = typeof(UpdateConfig), @@ -341,10 +341,10 @@ namespace TL [0x46560264] = typeof(UpdateLangPackTooLong), [0x56022F4D] = typeof(UpdateLangPack), [0xE511996D] = typeof(UpdateFavedStickers), - [0xEA29055D] = typeof(UpdateChannelReadMessagesContents), + [0x25F324F7] = typeof(UpdateChannelReadMessagesContents), [0x7084A7BE] = typeof(UpdateContactsReset), [0xB23FC698] = typeof(UpdateChannelAvailableMessages), - [0xE16459C3] = typeof(UpdateDialogUnreadMark), + [0xB658F23E] = typeof(UpdateDialogUnreadMark), [0xACA1657B] = typeof(UpdateMessagePoll), [0x54C01850] = typeof(UpdateChatDefaultBannedRights), [0x19360DC0] = typeof(UpdateFolderPeers), @@ -378,7 +378,7 @@ namespace TL [0x4D712F2E] = typeof(UpdateBotCommands), [0x7063C3DB] = typeof(UpdatePendingJoinRequests), [0x11DFA986] = typeof(UpdateBotChatInviteRequester), - [0x5E1B3CB8] = typeof(UpdateMessageReactions), + [0x1E297BFA] = typeof(UpdateMessageReactions), [0x17B7A20B] = typeof(UpdateAttachMenuBots), [0x1592B79D] = typeof(UpdateWebViewResultSent), [0x14B85813] = typeof(UpdateBotMenuButton), @@ -426,6 +426,8 @@ namespace TL [0x8B725FCE] = typeof(UpdatePaidReactionPrivacy), [0x504AA18F] = typeof(UpdateSentPhoneCode), [0xA477288F] = typeof(UpdateGroupCallChainBlocks), + [0x77B0E372] = typeof(UpdateReadMonoForumInbox), + [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1211,8 +1213,9 @@ namespace TL [0xBD74CF49] = typeof(StoryViewPublicRepost), [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0x22C0F6D5] = typeof(InputReplyToMessage), + [0xB07038B0] = typeof(InputReplyToMessage), [0x5881323A] = typeof(InputReplyToStory), + [0x69D66C45] = typeof(InputReplyToMonoForum), [0x3FC9053B] = typeof(ExportedStoryLink), [0x712E27FD] = typeof(StoriesStealthMode), [0xCFC9E002] = typeof(MediaAreaCoordinates), @@ -1257,6 +1260,7 @@ namespace TL [0xCFCD0F13] = typeof(StoryReactionPublicRepost), [0xAA5F789C] = typeof(Stories_StoryReactionsList), [0xBD87CB6C] = typeof(SavedDialog), + [0x64407EA7] = typeof(MonoForumDialog), [0xF83AE221] = typeof(Messages_SavedDialogs), [0x44BA9DD9] = typeof(Messages_SavedDialogsSlice), [0xC01F6FE8] = typeof(Messages_SavedDialogsNotModified), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 2a71dd9..1c5aa10 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -11,9 +11,10 @@ snupkg true WTelegramClient - 0.0.0 + 0.0.0 + layer.204 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 203 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 204 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From bdcf389ed22655dc4defd0ab452e203aa7f36952 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 8 Jul 2025 19:47:44 +0200 Subject: [PATCH 292/336] API Layer 206: ToDo lists, suggested posts, choose TON vs Stars for gifts/transactions, ... (for the very latest layers, go to https://patreon.com/wizou) --- README.md | 2 +- src/TL.Schema.cs | 356 +++++++++++++++++++++++-------------- src/TL.SchemaFuncs.cs | 264 ++++++++++++++++----------- src/TL.Table.cs | 41 +++-- src/WTelegramClient.csproj | 6 +- 5 files changed, 416 insertions(+), 253 deletions(-) diff --git a/README.md b/README.md index 84117c0..838b958 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-204-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-206-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 0208090..367010b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -507,6 +507,12 @@ namespace TL has_payload = 0x1, } } + /// See + [TLDef(0x9FC55FDE)] + public sealed partial class InputMediaTodo : InputMedia + { + public TodoList todo; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -1394,7 +1400,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0x52D6806B)] + [TLDef(0xE07429DE)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1485,6 +1491,7 @@ namespace TL [IfFlag(42)] public StickerSet emojiset; [IfFlag(49)] public BotVerification bot_verification; [IfFlag(50)] public int stargifts_count; + [IfFlag(53)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { @@ -1594,6 +1601,8 @@ namespace TL has_stargifts_count = 0x40000, stargifts_available = 0x80000, paid_messages_available = 0x100000, + /// Field has a value + has_send_paid_messages_stars = 0x200000, } /// ID of the channel @@ -1739,6 +1748,8 @@ namespace TL public virtual Peer From => default; /// Peer ID, the chat where this message was sent public virtual Peer Peer => default; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ public virtual Peer SavedPeer => default; /// Reply information public virtual MessageReplyHeaderBase ReplyTo => default; /// Date of the message @@ -1771,7 +1782,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xEABCDD4D)] + [TLDef(0x9815CEC8)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1832,6 +1843,7 @@ namespace TL [IfFlag(35)] public FactCheck factcheck; [IfFlag(37)] public DateTime report_delivery_until_date; [IfFlag(38)] public long paid_message_stars; + [IfFlag(39)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -1911,6 +1923,10 @@ namespace TL has_report_delivery_until_date = 0x20, /// Field has a value has_paid_message_stars = 0x40, + /// Field has a value + has_suggested_post = 0x80, + paid_suggested_post_stars = 0x100, + paid_suggested_post_ton = 0x200, } /// ID of the message @@ -1919,6 +1935,8 @@ namespace TL public override Peer From => from_id; /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; + /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ public override Peer SavedPeer => saved_peer_id; /// Reply information public override MessageReplyHeaderBase ReplyTo => reply_to; /// Date of the message @@ -1929,7 +1947,7 @@ namespace TL public override int TtlPeriod => ttl_period; } /// Indicates a service message See - [TLDef(0xD3D28540)] + [TLDef(0x7A800E0A)] public sealed partial class MessageService : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1940,6 +1958,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Sender of service message public Peer peer_id; + [IfFlag(28)] public Peer saved_peer_id; /// Reply (thread) information [IfFlag(3)] public MessageReplyHeaderBase reply_to; /// Message date @@ -1973,6 +1992,8 @@ namespace TL has_reactions = 0x100000, /// Field has a value has_ttl_period = 0x2000000, + /// Field has a value + has_saved_peer_id = 0x10000000, } /// Message ID @@ -1981,6 +2002,7 @@ namespace TL public override Peer From => from_id; /// Sender of service message public override Peer Peer => peer_id; + public override Peer SavedPeer => saved_peer_id; /// Reply (thread) information public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date @@ -2311,6 +2333,19 @@ namespace TL /// Either the paid-for media, or super low resolution media previews if the media wasn't purchased yet, see here » for more info. public MessageExtendedMediaBase[] extended_media; } + /// See + [TLDef(0x8A53B014)] + public sealed partial class MessageMediaToDo : MessageMedia + { + public Flags flags; + public TodoList todo; + [IfFlag(0)] public TodoCompletion[] completions; + + [Flags] public enum Flags : uint + { + has_completions = 0x1, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2996,6 +3031,70 @@ namespace TL video = 0x10, } } + /// See + [TLDef(0xCC7C5C89)] + public sealed partial class MessageActionTodoCompletions : MessageAction + { + public int[] completed; + public int[] incompleted; + } + /// See + [TLDef(0xC7EDBC83)] + public sealed partial class MessageActionTodoAppendTasks : MessageAction + { + public TodoItem[] list; + } + /// See + [TLDef(0xEE7A1596)] + public sealed partial class MessageActionSuggestedPostApproval : MessageAction + { + public Flags flags; + [IfFlag(2)] public string reject_comment; + [IfFlag(3)] public DateTime schedule_date; + [IfFlag(4)] public StarsAmountBase price; + + [Flags] public enum Flags : uint + { + rejected = 0x1, + balance_too_low = 0x2, + has_reject_comment = 0x4, + has_schedule_date = 0x8, + has_price = 0x10, + } + } + /// See + [TLDef(0x95DDCF69)] + public sealed partial class MessageActionSuggestedPostSuccess : MessageAction + { + public StarsAmountBase price; + } + /// See + [TLDef(0x69F916F8)] + public sealed partial class MessageActionSuggestedPostRefund : MessageAction + { + public Flags flags; + + [Flags] public enum Flags : uint + { + payer_initiated = 0x1, + } + } + /// See + [TLDef(0xA8A3C699)] + public sealed partial class MessageActionGiftTon : MessageAction + { + public Flags flags; + public string currency; + public long amount; + public string crypto_currency; + public long crypto_amount; + [IfFlag(0)] public string transaction_id; + + [Flags] public enum Flags : uint + { + has_transaction_id = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -5787,21 +5886,12 @@ namespace TL /// The reaction. public Reaction reaction; } - /// A new channel ad revenue transaction was made, see here » for more info. See - [TLDef(0xDFD961F5)] - public sealed partial class UpdateBroadcastRevenueTransactions : Update - { - /// Channel - public Peer peer; - /// New ad revenue balance. - public BroadcastRevenueBalances balances; - } /// The current account's Telegram Stars balance » has changed. See [TLDef(0x4E80A379)] public sealed partial class UpdateStarsBalance : Update { /// New balance. - public StarsAmount balance; + public StarsAmountBase balance; } /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] @@ -5892,6 +5982,19 @@ namespace TL public Peer saved_peer_id; public int read_max_id; } + /// See + [TLDef(0x9F812B08)] + public sealed partial class UpdateMonoForumNoPaidException : Update + { + public Flags flags; + public long channel_id; + public Peer saved_peer_id; + + [Flags] public enum Flags : uint + { + exception = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7872,6 +7975,9 @@ namespace TL /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } + /// See + [TLDef(0x1CF671A0)] + public sealed partial class InputStickerSetTonGifts : InputStickerSet { } /// Represents a stickerset (stickerpack) See [TLDef(0x2DD14EDC)] @@ -9893,7 +9999,7 @@ namespace TL } } /// Represents a message draft. See - [TLDef(0x2D65321F)] + [TLDef(0x96EAA5EB)] public sealed partial class DraftMessage : DraftMessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9910,6 +10016,7 @@ namespace TL public DateTime date; /// A message effect that should be played as specified here ». [IfFlag(7)] public long effect; + [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9925,6 +10032,8 @@ namespace TL invert_media = 0x40, /// Field has a value has_effect = 0x80, + /// Field has a value + has_suggested_post = 0x100, } } @@ -13444,6 +13553,7 @@ namespace TL edit_stories = 0x8000, /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, + manage_direct_messages = 0x20000, } } @@ -15354,7 +15464,7 @@ namespace TL public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } /// A sponsored message. See - [TLDef(0x4D93A990)] + [TLDef(0x7DBF8673)] public sealed partial class SponsoredMessage : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15381,6 +15491,8 @@ namespace TL [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. [IfFlag(8)] public string additional_info; + [IfFlag(15)] public int min_display_duration; + [IfFlag(15)] public int max_display_duration; [Flags] public enum Flags : uint { @@ -15400,18 +15512,22 @@ namespace TL has_color = 0x2000, /// Field has a value has_media = 0x4000, + /// Fields and have a value + has_min_display_duration = 0x8000, } } /// A set of sponsored messages associated to a channel See /// a value means messages.sponsoredMessagesEmpty - [TLDef(0xC9EE1D87)] + [TLDef(0xFFDA656D)] public sealed partial class Messages_SponsoredMessages : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; + [IfFlag(1)] public int start_delay; + [IfFlag(2)] public int between_delay; /// Sponsored messages public SponsoredMessage[] messages; /// Chats mentioned in the sponsored messages @@ -15423,6 +15539,10 @@ namespace TL { /// Field has a value has_posts_between = 0x1, + /// Field has a value + has_start_delay = 0x2, + /// Field has a value + has_between_delay = 0x4, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -18432,6 +18552,7 @@ namespace TL { has_draft = 0x2, unread_mark = 0x8, + nopaid_messages_exception = 0x10, } public override Peer Peer => peer; @@ -19306,90 +19427,6 @@ namespace TL [TLDef(0xAD798849)] public sealed partial class Channels_SponsoredMessageReportResultReported : Channels_SponsoredMessageReportResult { } - /// Channel revenue ad statistics, see here » for more info. See - [TLDef(0x5407E297)] - public sealed partial class Stats_BroadcastRevenueStats : IObject - { - /// Ad impressions graph - public StatsGraphBase top_hours_graph; - /// Ad revenue graph (in the smallest unit of the cryptocurrency in which revenue is calculated) - public StatsGraphBase revenue_graph; - /// Current balance, current withdrawable balance and overall revenue - public BroadcastRevenueBalances balances; - /// Current conversion rate of the cryptocurrency (not in the smallest unit) in which revenue is calculated to USD - public double usd_rate; - } - - /// Contains the URL to use to withdraw channel ad revenue. See - [TLDef(0xEC659737)] - public sealed partial class Stats_BroadcastRevenueWithdrawalUrl : IObject - { - /// A unique URL to a Fragment page where the user will be able to specify and submit the address of the TON wallet where the funds will be sent. - public string url; - } - - /// A channel ad revenue » transaction. See Derived classes: , , - public abstract partial class BroadcastRevenueTransaction : IObject { } - /// Describes earnings from sponsored messages in a channel in some time frame, see here » for more info. See - [TLDef(0x557E2CC4)] - public sealed partial class BroadcastRevenueTransactionProceeds : BroadcastRevenueTransaction - { - /// Amount in the smallest unit of the cryptocurrency. - public long amount; - /// Start unixtime for the timeframe. - public DateTime from_date; - /// End unixtime for the timeframe. - public DateTime to_date; - } - /// Describes a withdrawal of ad earnings » See - [TLDef(0x5A590978)] - public sealed partial class BroadcastRevenueTransactionWithdrawal : BroadcastRevenueTransaction - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Amount withdrawn - public long amount; - /// Withdrawal date - public DateTime date; - /// Payment provider name - public string provider; - /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain the point in time (Unix timestamp) when the withdrawal was completed successfully. - [IfFlag(1)] public DateTime transaction_date; - /// If neither pending nor failed are set, the transaction was completed successfully, and this field will contain a URL where the withdrawal transaction can be viewed. - [IfFlag(1)] public string transaction_url; - - [Flags] public enum Flags : uint - { - /// Whether the withdrawal is currently pending - pending = 0x1, - /// Fields and have a value - has_transaction_date = 0x2, - /// Whether the withdrawal has failed - failed = 0x4, - } - } - /// Describes a refund for failed withdrawal of ad earnings » See - [TLDef(0x42D30D2E)] - public sealed partial class BroadcastRevenueTransactionRefund : BroadcastRevenueTransaction - { - /// Amount refunded. - public long amount; - /// Date of refund. - public DateTime date; - /// Payment provider name. - public string provider; - } - - /// Channel ad revenue transactions ». See - [TLDef(0x87158466)] - public sealed partial class Stats_BroadcastRevenueTransactions : IObject - { - /// Total number of transactions. - public int count; - /// Transactions - public BroadcastRevenueTransaction[] transactions; - } - /// Reaction notification settings See public enum ReactionNotificationsFrom : uint { @@ -19423,26 +19460,6 @@ namespace TL } } - /// Describes channel ad revenue balances ». See - [TLDef(0xC3FF71E7)] - public sealed partial class BroadcastRevenueBalances : IObject - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Amount of not-yet-withdrawn cryptocurrency. - public long current_balance; - /// Amount of withdrawable cryptocurrency, out of the currently available balance (available_balance <= current_balance). - public long available_balance; - /// Total amount of earned cryptocurrency. - public long overall_revenue; - - [Flags] public enum Flags : uint - { - /// If set, the available balance can be withdrawn ». - withdrawal_enabled = 0x1, - } - } - /// Represents a message effect ». See [TLDef(0x93C3E27E)] public sealed partial class AvailableEffect : IObject @@ -19562,15 +19579,14 @@ namespace TL } /// Represents a Telegram Stars transaction ». See - [TLDef(0xA39FD94A)] + [TLDef(0x13659EB0)] public sealed partial class StarsTransaction : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Transaction ID. public string id; - /// Amount of Stars (negative for outgoing transactions). - public StarsAmount stars; + public StarsAmountBase amount; /// Date of the transaction (unixtime). public DateTime date; /// Source of the incoming transaction, or its recipient for outgoing transactions. @@ -19604,9 +19620,11 @@ namespace TL /// For transactions made by referred users, the peer that received the affiliate commission. [IfFlag(17)] public Peer starref_peer; /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. - [IfFlag(17)] public StarsAmount starref_amount; + [IfFlag(17)] public StarsAmountBase starref_amount; [IfFlag(19)] public int paid_messages; [IfFlag(20)] public int premium_gift_months; + [IfFlag(23)] public DateTime ads_proceeds_from_date; + [IfFlag(23)] public DateTime ads_proceeds_to_date; [Flags] public enum Flags : uint { @@ -19653,6 +19671,8 @@ namespace TL has_premium_gift_months = 0x100000, business_transfer = 0x200000, stargift_resale = 0x400000, + /// Fields and have a value + has_ads_proceeds_from_date = 0x800000, } } @@ -19663,7 +19683,7 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Current Telegram Star balance. - public StarsAmount balance; + public StarsAmountBase balance; /// Info about current Telegram Star subscriptions, only returned when invoking Payments_GetStarsTransactions and Payments_GetStarsSubscriptions. [IfFlag(1)] public StarsSubscription[] subscriptions; /// Offset for pagination of subscriptions: only usable and returned when invoking Payments_GetStarsSubscriptions. @@ -19765,11 +19785,11 @@ namespace TL /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of not-yet-withdrawn Telegram Stars. - public StarsAmount current_balance; + public StarsAmountBase current_balance; /// Amount of withdrawable Telegram Stars. - public StarsAmount available_balance; + public StarsAmountBase available_balance; /// Total amount of earned Telegram Stars. - public StarsAmount overall_revenue; + public StarsAmountBase overall_revenue; /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. [IfFlag(1)] public int next_withdrawal_at; @@ -19783,15 +19803,23 @@ namespace TL } /// Star revenue statistics, see here » for more info. See - [TLDef(0xC92BB73B)] + [TLDef(0x6C207376)] public sealed partial class Payments_StarsRevenueStats : IObject { + public Flags flags; + [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) public StatsGraphBase revenue_graph; /// Current balance, current withdrawable balance and overall earned Telegram Stars public StarsRevenueStatus status; /// Current conversion rate of Telegram Stars to USD public double usd_rate; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_hours_graph = 0x1, + } } /// Contains the URL to use to withdraw Telegram Star revenue. See @@ -20228,7 +20256,7 @@ namespace TL /// Point in time (Unix timestamp) when the affiliate program will be closed (optional, if not set the affiliate program isn't scheduled to be closed) [IfFlag(1)] public DateTime end_date; /// The amount of daily revenue per user in Telegram Stars of the bot that created the affiliate program.
To obtain the approximated revenue per referred user, multiply this value by commission_permille and divide by 1000.
- [IfFlag(2)] public StarsAmount daily_revenue_per_user; + [IfFlag(2)] public StarsAmountBase daily_revenue_per_user; [Flags] public enum Flags : uint { @@ -20305,14 +20333,31 @@ namespace TL } } + ///
Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: + public abstract partial class StarsAmountBase : IObject + { + /// The integer amount of Telegram Stars. + public virtual long Amount => default; + } /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See [TLDef(0xBBB6B4A3)] - public sealed partial class StarsAmount : IObject + public sealed partial class StarsAmount : StarsAmountBase { /// The integer amount of Telegram Stars. public long amount; /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
public int nanos; + + /// The integer amount of Telegram Stars. + public override long Amount => amount; + } + ///
See + [TLDef(0x74AEE3E0)] + public sealed partial class StarsTonAmount : StarsAmountBase + { + public long amount; + + public override long Amount => amount; } /// Found stickers See Derived classes: , @@ -20719,4 +20764,53 @@ namespace TL public TextWithEntities description; public string url; } + + /// See + [TLDef(0xCBA9A52F)] + public sealed partial class TodoItem : IObject + { + public int id; + public TextWithEntities title; + } + + /// See + [TLDef(0x49B92A26)] + public sealed partial class TodoList : IObject + { + public Flags flags; + public TextWithEntities title; + public TodoItem[] list; + + [Flags] public enum Flags : uint + { + others_can_append = 0x1, + others_can_complete = 0x2, + } + } + + /// See + [TLDef(0x4CC120B7)] + public sealed partial class TodoCompletion : IObject + { + public int id; + public long completed_by; + public DateTime date; + } + + /// See + [TLDef(0x0E8E37E5)] + public sealed partial class SuggestedPost : IObject + { + public Flags flags; + [IfFlag(3)] public StarsAmountBase price; + [IfFlag(0)] public DateTime schedule_date; + + [Flags] public enum Flags : uint + { + has_schedule_date = 0x1, + accepted = 0x2, + rejected = 0x4, + has_price = 0x8, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 2cc521c..0845d54 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,18 +1433,21 @@ namespace TL hash = hash, }); - /// See - public static Task Account_AddNoPaidMessagesException(this Client client, InputUserBase user_id, bool refund_charged = false) - => client.Invoke(new Account_AddNoPaidMessagesException + /// See + public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) + => client.Invoke(new Account_GetPaidMessagesRevenue { - flags = (Account_AddNoPaidMessagesException.Flags)(refund_charged ? 0x1 : 0), + flags = (Account_GetPaidMessagesRevenue.Flags)(parent_peer != null ? 0x1 : 0), + parent_peer = parent_peer, user_id = user_id, }); - /// See - public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id) - => client.Invoke(new Account_GetPaidMessagesRevenue + /// See + public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) + => client.Invoke(new Account_ToggleNoPaidMessagesException { + flags = (Account_ToggleNoPaidMessagesException.Flags)((parent_peer != null ? 0x2 : 0) | (refund_charged ? 0x1 : 0) | (require_payment ? 0x4 : 0)), + parent_peer = parent_peer, user_id = user_id, }); @@ -1902,10 +1905,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -1917,6 +1920,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1938,10 +1942,10 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -1954,6 +1958,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Forwards messages by their IDs. See [bots: ✓] Possible codes: 400,403,406,420,500 (details) @@ -1972,10 +1977,10 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -1987,6 +1992,7 @@ namespace TL quick_reply_shortcut = quick_reply_shortcut, video_timestamp = video_timestamp ?? default, allow_paid_stars = allow_paid_stars ?? default, + suggested_post = suggested_post, }); /// Report a new incoming chat for spam, if the of the chat allow us to do that See Possible codes: 400 (details) @@ -2602,16 +2608,17 @@ namespace TL /// Message entities for styled text /// Attached media /// Specifies a message effect » to use for the message. - public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { - flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (effect != null ? 0x80 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), + flags = (Messages_SaveDraft.Flags)((entities != null ? 0x8 : 0) | (reply_to != null ? 0x10 : 0) | (media != null ? 0x20 : 0) | (effect != null ? 0x80 : 0) | (suggested_post != null ? 0x100 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x40 : 0)), reply_to = reply_to, peer = peer, message = message, entities = entities, media = media, effect = effect ?? default, + suggested_post = suggested_post, }); /// Return all message drafts.
Returns all the latest updates related to all chats with drafts. See
@@ -4449,10 +4456,12 @@ namespace TL /// Get a list of sponsored messages for a peer, see here » for more info. See /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty - public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer) + public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) => client.Invoke(new Messages_GetSponsoredMessages { + flags = (Messages_GetSponsoredMessages.Flags)(msg_id != null ? 0x1 : 0), peer = peer, + msg_id = msg_id ?? default, }); /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓] Possible codes: 400 (details) @@ -4525,6 +4534,36 @@ namespace TL max_id = max_id, }); + /// See + public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) + => client.Invoke(new Messages_ToggleTodoCompleted + { + peer = peer, + msg_id = msg_id, + completed = completed, + incompleted = incompleted, + }); + + /// See + public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) + => client.Invoke(new Messages_AppendTodoList + { + peer = peer, + msg_id = msg_id, + list = list, + }); + + /// See + public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) + => client.Invoke(new Messages_ToggleSuggestedPostApproval + { + flags = (Messages_ToggleSuggestedPostApproval.Flags)((schedule_date != null ? 0x1 : 0) | (reject_comment != null ? 0x4 : 0) | (reject ? 0x2 : 0)), + peer = peer, + msg_id = msg_id, + schedule_date = schedule_date ?? default, + reject_comment = reject_comment, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -6103,9 +6142,10 @@ namespace TL /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400 (details) /// Peer of which to get the balance. - public static Task Payments_GetStarsStatus(this Client client, InputPeer peer) + public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus { + flags = (Payments_GetStarsStatus.Flags)(ton ? 0x1 : 0), peer = peer, }); @@ -6117,10 +6157,10 @@ namespace TL /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». /// Maximum number of results to return, see pagination - public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, string subscription_id = null, bool inbound = false, bool outbound = false, bool ascending = false) + public static Task Payments_GetStarsTransactions(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, string subscription_id = null, bool inbound = false, bool outbound = false, bool ascending = false, bool ton = false) => client.Invoke(new Payments_GetStarsTransactions { - flags = (Payments_GetStarsTransactions.Flags)((subscription_id != null ? 0x8 : 0) | (inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0)), + flags = (Payments_GetStarsTransactions.Flags)((subscription_id != null ? 0x8 : 0) | (inbound ? 0x1 : 0) | (outbound ? 0x2 : 0) | (ascending ? 0x4 : 0) | (ton ? 0x10 : 0)), subscription_id = subscription_id, peer = peer, offset = offset, @@ -6150,22 +6190,22 @@ namespace TL /// Get Telegram Star revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors /// Get statistics for the specified bot, channel or ourselves (). - public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false) + public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueStats { - flags = (Payments_GetStarsRevenueStats.Flags)(dark ? 0x1 : 0), + flags = (Payments_GetStarsRevenueStats.Flags)((dark ? 0x1 : 0) | (ton ? 0x2 : 0)), peer = peer, }); /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) /// Channel or bot from which to withdraw funds. - /// Amount of stars to withdraw. /// 2FA password, see here » for more info. - public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, long stars, InputCheckPasswordSRP password) + public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password, long? amount = null, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl { + flags = (Payments_GetStarsRevenueWithdrawalUrl.Flags)((amount != null ? 0x2 : 0) | (ton ? 0x1 : 0)), peer = peer, - stars = stars, + amount = amount ?? default, password = password, }); @@ -6180,9 +6220,10 @@ namespace TL /// Obtain info about Telegram Star transactions » using specific transaction IDs. See Possible codes: 400 (details) /// Channel or bot. /// Transaction IDs. - public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, params InputStarsTransaction[] id) + public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, InputStarsTransaction[] id, bool ton = false) => client.Invoke(new Payments_GetStarsTransactionsByID { + flags = (Payments_GetStarsTransactionsByID.Flags)(ton ? 0x1 : 0), peer = peer, id = id, }); @@ -7119,38 +7160,6 @@ namespace TL limit = limit, }); - /// Get channel ad revenue statistics ». See Possible codes: 400 (details) - /// Whether to enable dark theme for graph colors - /// Get ad revenue stats for the specified channel or bot - public static Task Stats_GetBroadcastRevenueStats(this Client client, InputPeer peer, bool dark = false) - => client.Invoke(new Stats_GetBroadcastRevenueStats - { - flags = (Stats_GetBroadcastRevenueStats.Flags)(dark ? 0x1 : 0), - peer = peer, - }); - - /// Withdraw funds from a channel's ad revenue balance ». See Possible codes: 400 (details) - /// Get ad revenue withdrawal URL for the specified channel or bot - /// 2FA password, see here » for more info. - public static Task Stats_GetBroadcastRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password) - => client.Invoke(new Stats_GetBroadcastRevenueWithdrawalUrl - { - peer = peer, - password = password, - }); - - /// Fetch channel ad revenue transaction history ». See Possible codes: 400 (details) - /// Get ad revenue transactions for the specified channel or bot - /// Offset for pagination - /// Maximum number of results to return, see pagination - public static Task Stats_GetBroadcastRevenueTransactions(this Client client, InputPeer peer, int offset = default, int limit = int.MaxValue) - => client.Invoke(new Stats_GetBroadcastRevenueTransactions - { - peer = peer, - offset = offset, - limit = limit, - }); - /// Export a folder », creating a chat folder deep link ». See Possible codes: 400 (details) /// The folder to export /// An optional name for the link @@ -8814,24 +8823,34 @@ namespace TL.Methods public long hash; } - [TLDef(0x6F688AA7)] - public sealed partial class Account_AddNoPaidMessagesException : IMethod + [TLDef(0x19BA4A67)] + public sealed partial class Account_GetPaidMessagesRevenue : IMethod { public Flags flags; + [IfFlag(0)] public InputPeer parent_peer; + public InputUserBase user_id; + + [Flags] public enum Flags : uint + { + has_parent_peer = 0x1, + } + } + + [TLDef(0xFE2EDA76)] + public sealed partial class Account_ToggleNoPaidMessagesException : IMethod + { + public Flags flags; + [IfFlag(1)] public InputPeer parent_peer; public InputUserBase user_id; [Flags] public enum Flags : uint { refund_charged = 0x1, + has_parent_peer = 0x2, + require_payment = 0x4, } } - [TLDef(0xF1266F38)] - public sealed partial class Account_GetPaidMessagesRevenue : IMethod - { - public InputUserBase user_id; - } - [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9203,7 +9222,7 @@ namespace TL.Methods } } - [TLDef(0xFBF2340A)] + [TLDef(0xFE05DC9A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9218,6 +9237,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9237,10 +9257,11 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, } } - [TLDef(0xA550CD78)] + [TLDef(0xAC55D9C1)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9256,6 +9277,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(22)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9274,10 +9296,11 @@ namespace TL.Methods has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, + has_suggested_post = 0x400000, } } - [TLDef(0x38F0188C)] + [TLDef(0x978928CA)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9292,6 +9315,7 @@ namespace TL.Methods [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(20)] public int video_timestamp; [IfFlag(21)] public long allow_paid_stars; + [IfFlag(23)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9309,6 +9333,7 @@ namespace TL.Methods has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, has_reply_to = 0x400000, + has_suggested_post = 0x800000, } } @@ -9824,7 +9849,7 @@ namespace TL.Methods public InputDialogPeerBase[] peers; } - [TLDef(0xD372C5CE)] + [TLDef(0x54AE308E)] public sealed partial class Messages_SaveDraft : IMethod { public Flags flags; @@ -9834,6 +9859,7 @@ namespace TL.Methods [IfFlag(3)] public MessageEntity[] entities; [IfFlag(5)] public InputMedia media; [IfFlag(7)] public long effect; + [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint { @@ -9843,6 +9869,7 @@ namespace TL.Methods has_media = 0x20, invert_media = 0x40, has_effect = 0x80, + has_suggested_post = 0x100, } } @@ -11416,10 +11443,17 @@ namespace TL.Methods public byte[] option; } - [TLDef(0x9BD2F439)] + [TLDef(0x3D6CE850)] public sealed partial class Messages_GetSponsoredMessages : IMethod { + public Flags flags; public InputPeer peer; + [IfFlag(0)] public int msg_id; + + [Flags] public enum Flags : uint + { + has_msg_id = 0x1, + } } [TLDef(0xF21F7F2F)] @@ -11494,6 +11528,40 @@ namespace TL.Methods public int max_id; } + [TLDef(0xD3E03124)] + public sealed partial class Messages_ToggleTodoCompleted : IMethod + { + public InputPeer peer; + public int msg_id; + public int[] completed; + public int[] incompleted; + } + + [TLDef(0x21A61057)] + public sealed partial class Messages_AppendTodoList : IMethod + { + public InputPeer peer; + public int msg_id; + public TodoItem[] list; + } + + [TLDef(0x8107455C)] + public sealed partial class Messages_ToggleSuggestedPostApproval : IMethod + { + public Flags flags; + public InputPeer peer; + public int msg_id; + [IfFlag(0)] public DateTime schedule_date; + [IfFlag(2)] public string reject_comment; + + [Flags] public enum Flags : uint + { + has_schedule_date = 0x1, + reject = 0x2, + has_reject_comment = 0x4, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12740,10 +12808,16 @@ namespace TL.Methods [TLDef(0xC00EC7D3)] public sealed partial class Payments_GetStarsTopupOptions : IMethod { } - [TLDef(0x104FCFA7)] + [TLDef(0x4EA9B3BF)] public sealed partial class Payments_GetStarsStatus : IMethod { + public Flags flags; public InputPeer peer; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } [TLDef(0x69DA4557)] @@ -12761,6 +12835,7 @@ namespace TL.Methods outbound = 0x2, ascending = 0x4, has_subscription_id = 0x8, + ton = 0x10, } } @@ -12787,15 +12862,23 @@ namespace TL.Methods [Flags] public enum Flags : uint { dark = 0x1, + ton = 0x2, } } - [TLDef(0x13BBE8B3)] + [TLDef(0x2433DC92)] public sealed partial class Payments_GetStarsRevenueWithdrawalUrl : IMethod { + public Flags flags; public InputPeer peer; - public long stars; + [IfFlag(1)] public long amount; public InputCheckPasswordSRP password; + + [Flags] public enum Flags : uint + { + ton = 0x1, + has_amount = 0x2, + } } [TLDef(0xD1D7EFC5)] @@ -12804,11 +12887,17 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0x27842D2E)] + [TLDef(0x2DCA16B8)] public sealed partial class Payments_GetStarsTransactionsByID : IMethod { + public Flags flags; public InputPeer peer; public InputStarsTransaction[] id; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } [TLDef(0xD3C96BC8)] @@ -13660,33 +13749,6 @@ namespace TL.Methods public int limit; } - [TLDef(0xF788EE19)] - public sealed partial class Stats_GetBroadcastRevenueStats : IMethod - { - public Flags flags; - public InputPeer peer; - - [Flags] public enum Flags : uint - { - dark = 0x1, - } - } - - [TLDef(0x9DF4FAAD)] - public sealed partial class Stats_GetBroadcastRevenueWithdrawalUrl : IMethod - { - public InputPeer peer; - public InputCheckPasswordSRP password; - } - - [TLDef(0x70990B6D)] - public sealed partial class Stats_GetBroadcastRevenueTransactions : IMethod - { - public InputPeer peer; - public int offset; - public int limit; - } - [TLDef(0x8472478E)] public sealed partial class Chatlists_ExportChatlistInvite : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9cba0d9..11bbf49 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 = 204; // fetched 04/06/2025 15:07:47 + public const int Version = 206; // fetched 02/07/2025 12:40:29 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -103,6 +103,7 @@ namespace TL [0x89FDD778] = typeof(InputMediaStory), [0xC21B8849] = typeof(InputMediaWebPage), [0xC4103386] = typeof(InputMediaPaidMedia), + [0x9FC55FDE] = typeof(InputMediaTodo), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -139,7 +140,7 @@ namespace TL [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0x52D6806B] = typeof(ChannelFull), + [0xE07429DE] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -148,8 +149,8 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xEABCDD4D] = typeof(Message), - [0xD3D28540] = typeof(MessageService), + [0x9815CEC8] = typeof(Message), + [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), [0x56E0D474] = typeof(MessageMediaGeo), @@ -167,6 +168,7 @@ namespace TL [0xAA073BEB] = typeof(MessageMediaGiveaway), [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), [0xA8852491] = typeof(MessageMediaPaidMedia), + [0x8A53B014] = typeof(MessageMediaToDo), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -218,6 +220,12 @@ namespace TL [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), + [0xCC7C5C89] = typeof(MessageActionTodoCompletions), + [0xC7EDBC83] = typeof(MessageActionTodoAppendTasks), + [0xEE7A1596] = typeof(MessageActionSuggestedPostApproval), + [0x95DDCF69] = typeof(MessageActionSuggestedPostSuccess), + [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), + [0xA8A3C699] = typeof(MessageActionGiftTon), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -418,7 +426,6 @@ namespace TL [0x07DF587C] = typeof(UpdateBotEditBusinessMessage), [0xA02A982E] = typeof(UpdateBotDeleteBusinessMessage), [0x1824E40B] = typeof(UpdateNewStoryReaction), - [0xDFD961F5] = typeof(UpdateBroadcastRevenueTransactions), [0x4E80A379] = typeof(UpdateStarsBalance), [0x1EA2FDA7] = typeof(UpdateBusinessBotCallbackQuery), [0xA584B019] = typeof(UpdateStarsRevenueStatus), @@ -428,6 +435,7 @@ namespace TL [0xA477288F] = typeof(UpdateGroupCallChainBlocks), [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), + [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -565,6 +573,7 @@ namespace TL [0x29D0F5EE] = typeof(InputStickerSetEmojiDefaultStatuses), [0x44C1F8E9] = typeof(InputStickerSetEmojiDefaultTopicIcons), [0x49748553] = typeof(InputStickerSetEmojiChannelDefaultStatuses), + [0x1CF671A0] = typeof(InputStickerSetTonGifts), [0x2DD14EDC] = typeof(StickerSet), [0x6E153F16] = typeof(Messages_StickerSet), [0xD3F924EB] = null,//Messages_StickerSetNotModified @@ -691,7 +700,7 @@ namespace TL [0x70B772A8] = typeof(Contacts_TopPeers), [0xB52C939D] = typeof(Contacts_TopPeersDisabled), [0x1B0C841A] = typeof(DraftMessageEmpty), - [0x2D65321F] = typeof(DraftMessage), + [0x96EAA5EB] = typeof(DraftMessage), [0xC6DC0C66] = typeof(Messages_FeaturedStickersNotModified), [0xBE382906] = typeof(Messages_FeaturedStickers), [0x0B17F890] = null,//Messages_RecentStickersNotModified @@ -1069,8 +1078,8 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), - [0x4D93A990] = typeof(SponsoredMessage), - [0xC9EE1D87] = typeof(Messages_SponsoredMessages), + [0x7DBF8673] = typeof(SponsoredMessage), + [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty [0xC9B0539F] = typeof(SearchResultsCalendarPeriod), [0x147EE23C] = typeof(Messages_SearchResultsCalendar), @@ -1319,14 +1328,7 @@ namespace TL [0x846F9E42] = typeof(Channels_SponsoredMessageReportResultChooseOption), [0x3E3BCF2F] = typeof(Channels_SponsoredMessageReportResultAdsHidden), [0xAD798849] = typeof(Channels_SponsoredMessageReportResultReported), - [0x5407E297] = typeof(Stats_BroadcastRevenueStats), - [0xEC659737] = typeof(Stats_BroadcastRevenueWithdrawalUrl), - [0x557E2CC4] = typeof(BroadcastRevenueTransactionProceeds), - [0x5A590978] = typeof(BroadcastRevenueTransactionWithdrawal), - [0x42D30D2E] = typeof(BroadcastRevenueTransactionRefund), - [0x87158466] = typeof(Stats_BroadcastRevenueTransactions), [0x56E34970] = typeof(ReactionsNotifySettings), - [0xC3FF71E7] = typeof(BroadcastRevenueBalances), [0x93C3E27E] = typeof(AvailableEffect), [0xD1ED9A5B] = null,//Messages_AvailableEffectsNotModified [0xBDDB616E] = typeof(Messages_AvailableEffects), @@ -1340,13 +1342,13 @@ namespace TL [0x60682812] = typeof(StarsTransactionPeerAds), [0xF9677AAD] = typeof(StarsTransactionPeerAPI), [0x0BD915C0] = typeof(StarsTopupOption), - [0xA39FD94A] = typeof(StarsTransaction), + [0x13659EB0] = typeof(StarsTransaction), [0x6C9CE8ED] = typeof(Payments_StarsStatus), [0xE87ACBC0] = typeof(FoundStory), [0xE2DE7737] = typeof(Stories_FoundStories), [0xDE4C5D93] = typeof(GeoPointAddress), [0xFEBE5491] = typeof(StarsRevenueStatus), - [0xC92BB73B] = typeof(Payments_StarsRevenueStats), + [0x6C207376] = typeof(Payments_StarsRevenueStats), [0x1DAB80B7] = typeof(Payments_StarsRevenueWithdrawalUrl), [0x394E7F21] = typeof(Payments_StarsRevenueAdsAccountUrl), [0x206AE6D1] = typeof(InputStarsTransaction), @@ -1375,6 +1377,7 @@ namespace TL [0x98D5EA1D] = typeof(Payments_ConnectedStarRefBots), [0xB4D5D859] = typeof(Payments_SuggestedStarRefBots), [0xBBB6B4A3] = typeof(StarsAmount), + [0x74AEE3E0] = typeof(StarsTonAmount), [0x6010C534] = typeof(Messages_FoundStickersNotModified), [0x82C9E290] = typeof(Messages_FoundStickers), [0xB0CD6617] = typeof(BotVerifierSettings), @@ -1413,6 +1416,10 @@ namespace TL [0x947A12DF] = typeof(Payments_ResaleStarGifts), [0xC387C04E] = typeof(Stories_CanSendStoryCount), [0xE7E82E12] = typeof(PendingSuggestion), + [0xCBA9A52F] = typeof(TodoItem), + [0x49B92A26] = typeof(TodoList), + [0x4CC120B7] = typeof(TodoCompletion), + [0x0E8E37E5] = typeof(SuggestedPost), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 1c5aa10..8024098 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -11,10 +11,10 @@ snupkg true WTelegramClient - 0.0.0 - layer.204 Wizou - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 204 + 0.0.0 + layer.206 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 206 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 52d948af2a01c28a68f6c52262be030bb2f0a1ec Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:49:25 +0200 Subject: [PATCH 293/336] Fix DateTime type of *_at fields --- .github/workflows/release.yml | 9 +++++++++ src/TL.Schema.cs | 14 +++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5d1519e..42fcb35 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -54,3 +54,12 @@ jobs: run: | git tag $VERSION git push --tags + - name: Deployment Notification + env: + JSON: | + { + "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" + } + run: | + curl -X POST -H "Content-Type: application/json" -d "$JSON" ${{ secrets.DEPLOYED_WEBHOOK }} diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 367010b..da22aff 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2970,14 +2970,14 @@ namespace TL { public Flags flags; public StarGiftBase gift; - [IfFlag(3)] public int can_export_at; + [IfFlag(3)] public DateTime can_export_at; [IfFlag(4)] public long transfer_stars; [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; [IfFlag(8)] public long resale_stars; - [IfFlag(9)] public int can_transfer_at; - [IfFlag(10)] public int can_resell_at; + [IfFlag(9)] public DateTime can_transfer_at; + [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint { @@ -19791,7 +19791,7 @@ namespace TL /// Total amount of earned Telegram Stars. public StarsAmountBase overall_revenue; /// Unixtime indicating when will withdrawal be available to the user. If not set, withdrawal can be started now. - [IfFlag(1)] public int next_withdrawal_at; + [IfFlag(1)] public DateTime next_withdrawal_at; [Flags] public enum Flags : uint { @@ -20518,10 +20518,10 @@ namespace TL [IfFlag(11)] public long saved_id; [IfFlag(4)] public long convert_stars; [IfFlag(6)] public long upgrade_stars; - [IfFlag(7)] public int can_export_at; + [IfFlag(7)] public DateTime can_export_at; [IfFlag(8)] public long transfer_stars; - [IfFlag(13)] public int can_transfer_at; - [IfFlag(14)] public int can_resell_at; + [IfFlag(13)] public DateTime can_transfer_at; + [IfFlag(14)] public DateTime can_resell_at; [Flags] public enum Flags : uint { From a3f41330b55c27b7c67de6e37d12d01674c7a88e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 10 Jul 2025 01:50:09 +0200 Subject: [PATCH 294/336] API Layer 207: StarGift.ReleaseBy (that might not be the most recent layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 20 ++++++++++++++++---- src/TL.Table.cs | 8 ++++---- src/WTelegramClient.csproj | 4 ++-- 4 files changed, 23 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index 838b958..089b923 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-206-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-207-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 da22aff..d7f3678 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -20050,9 +20050,10 @@ namespace TL /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; public virtual string Title => default; + public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0xC62ACA28)] + [TLDef(0x7F853C12)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20077,6 +20078,7 @@ namespace TL [IfFlag(3)] public long upgrade_stars; [IfFlag(4)] public long resell_min_stars; [IfFlag(5)] public string title; + [IfFlag(6)] public Peer released_by; [Flags] public enum Flags : uint { @@ -20092,6 +20094,8 @@ namespace TL has_availability_resale = 0x10, /// Field has a value has_title = 0x20, + /// Field has a value + has_released_by = 0x40, } /// Identifier of the gift @@ -20099,9 +20103,10 @@ namespace TL /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; public override string Title => title; + public override Peer ReleasedBy => released_by; } /// See - [TLDef(0x6411DB89)] + [TLDef(0xF63778AE)] public sealed partial class StarGiftUnique : StarGiftBase { public Flags flags; @@ -20117,6 +20122,7 @@ namespace TL public int availability_total; [IfFlag(3)] public string gift_address; [IfFlag(4)] public long resell_stars; + [IfFlag(5)] public Peer released_by; [Flags] public enum Flags : uint { @@ -20125,22 +20131,28 @@ namespace TL has_owner_address = 0x4, has_gift_address = 0x8, has_resell_stars = 0x10, + has_released_by = 0x20, } public override long ID => id; public override int AvailabilityTotal => availability_total; public override string Title => title; + public override Peer ReleasedBy => released_by; } /// Available gifts ». See /// a value means payments.starGiftsNotModified - [TLDef(0x901689EA)] - public sealed partial class Payments_StarGifts : IObject + [TLDef(0x2ED82995)] + public sealed partial class Payments_StarGifts : IObject, IPeerResolver { /// Hash used for caching, for more info click here public int hash; /// List of available gifts. public StarGiftBase[] gifts; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Report menu option See diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 11bbf49..bbb604f 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 = 206; // fetched 02/07/2025 12:40:29 + public const int Version = 207; // fetched 08/07/2025 17:40:58 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1361,10 +1361,10 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0xC62ACA28] = typeof(StarGift), - [0x6411DB89] = typeof(StarGiftUnique), + [0x7F853C12] = typeof(StarGift), + [0xF63778AE] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified - [0x901689EA] = typeof(Payments_StarGifts), + [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), [0xF0E4E0B6] = typeof(ReportResultChooseOption), [0x6F09AC31] = typeof(ReportResultAddComment), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8024098..3d55ae8 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.206 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 206 + layer.207 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 207 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 56ba15bc13405500cd5f29999f6882dec095080f Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 14 Jul 2025 22:27:30 +0200 Subject: [PATCH 295/336] API Layer 209: Reply-to specific ToDo item (that might not be the most recent layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 136 +++++++++++++++++++++++++++++-------- src/TL.SchemaFuncs.cs | 73 ++++++++++---------- src/TL.Table.cs | 6 +- src/WTelegramClient.csproj | 4 +- 5 files changed, 152 insertions(+), 69 deletions(-) diff --git a/README.md b/README.md index 089b923..4da3f32 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-207-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-209-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 d7f3678..281d067 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -163,7 +163,7 @@ namespace TL public InputDocument id; } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract partial class InputMedia : IObject { } /// Photo See @@ -257,7 +257,7 @@ namespace TL has_ttl_seconds = 0x2, /// Field has a value has_thumb = 0x4, - /// Whether to send the file as a video even if it doesn't have an audio track (i.e. if set, the attribute will not be set even for videos without audio) + /// Whether to send the file as a video even if it doesn't have an audio track (i.e. if set, the attribute will not be set even for videos without audio) nosound_video = 0x8, /// Force the media file to be uploaded as document force_file = 0x10, @@ -2012,7 +2012,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2337,17 +2337,19 @@ namespace TL [TLDef(0x8A53B014)] public sealed partial class MessageMediaToDo : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public TodoList todo; [IfFlag(0)] public TodoCompletion[] completions; [Flags] public enum Flags : uint { + /// Field has a value has_completions = 0x1, } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -2968,6 +2970,7 @@ namespace TL [TLDef(0x2E3AE60E)] public sealed partial class MessageActionStarGiftUnique : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; [IfFlag(3)] public DateTime can_export_at; @@ -2984,13 +2987,20 @@ namespace TL upgrade = 0x1, transferred = 0x2, saved = 0x4, + /// Field has a value has_can_export_at = 0x8, + /// Field has a value has_transfer_stars = 0x10, refunded = 0x20, + /// Field has a value has_from_id = 0x40, + /// Fields and have a value has_peer = 0x80, + /// Field has a value has_resale_stars = 0x100, + /// Field has a value has_can_transfer_at = 0x200, + /// Field has a value has_can_resell_at = 0x400, } } @@ -3005,6 +3015,7 @@ namespace TL [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long stars; @@ -3017,6 +3028,7 @@ namespace TL [TLDef(0x2FFE2F7A)] public sealed partial class MessageActionConferenceCall : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long call_id; [IfFlag(2)] public int duration; @@ -3026,7 +3038,9 @@ namespace TL { missed = 0x1, active = 0x2, + /// Field has a value has_duration = 0x4, + /// Field has a value has_other_participants = 0x8, video = 0x10, } @@ -3048,6 +3062,7 @@ namespace TL [TLDef(0xEE7A1596)] public sealed partial class MessageActionSuggestedPostApproval : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(2)] public string reject_comment; [IfFlag(3)] public DateTime schedule_date; @@ -3057,8 +3072,11 @@ namespace TL { rejected = 0x1, balance_too_low = 0x2, + /// Field has a value has_reject_comment = 0x4, + /// Field has a value has_schedule_date = 0x8, + /// Field has a value has_price = 0x10, } } @@ -3072,6 +3090,7 @@ namespace TL [TLDef(0x69F916F8)] public sealed partial class MessageActionSuggestedPostRefund : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -3083,6 +3102,7 @@ namespace TL [TLDef(0xA8A3C699)] public sealed partial class MessageActionGiftTon : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string currency; public long amount; @@ -3092,6 +3112,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_transaction_id = 0x1, } } @@ -3342,7 +3363,7 @@ namespace TL } } - /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , + /// Contains info on a confirmation code message sent via SMS, phone call or Telegram. See Derived classes: , , public abstract partial class Auth_SentCodeBase : IObject { } /// Contains info about a sent verification code. See [TLDef(0x5E002502)] @@ -4197,7 +4218,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -5279,6 +5300,7 @@ namespace TL [TLDef(0x97D64341)] public sealed partial class UpdateGroupCall : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The channel/supergroup where this group call or livestream takes place [IfFlag(0)] public long chat_id; @@ -5986,6 +6008,7 @@ namespace TL [TLDef(0x9F812B08)] public sealed partial class UpdateMonoForumNoPaidException : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long channel_id; public Peer saved_peer_id; @@ -7355,7 +7378,7 @@ namespace TL [IfFlag(2)] public int preload_prefix_size; /// Floating point UNIX timestamp in seconds, indicating the frame of the video that should be used as static preview and thumbnail. [IfFlag(4)] public double video_start_ts; - /// Codec used for the video, i.e. “h264”, “h265”, or “av1” + /// Codec used for the video, i.e. "h264", "h265", or "av1" [IfFlag(5)] public string video_codec; [Flags] public enum Flags : uint @@ -7541,7 +7564,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

+ /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7928,7 +7951,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -10698,7 +10721,7 @@ namespace TL public PageCaption caption; } - /// Why was the phone call discarded? See Derived classes: , , , + /// Why was the phone call discarded? See Derived classes: , , , , public abstract partial class PhoneCallDiscardReason : IObject { } /// The phone call was missed See [TLDef(0x85E42301)] @@ -11897,7 +11920,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -14166,7 +14189,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , + /// Webpage attributes See Derived classes: , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -14851,7 +14874,7 @@ namespace TL /// Reply information See Derived classes: , public abstract partial class MessageReplyHeaderBase : IObject { } /// Message replies and thread information See - [TLDef(0xAFBC09DB)] + [TLDef(0x6917560B)] public sealed partial class MessageReplyHeader : MessageReplyHeaderBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14872,6 +14895,7 @@ namespace TL [IfFlag(7)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(10)] public int quote_offset; + [IfFlag(11)] public int todo_item_id; [Flags] public enum Flags : uint { @@ -14897,6 +14921,8 @@ namespace TL quote = 0x200, /// Field has a value has_quote_offset = 0x400, + /// Field has a value + has_todo_item_id = 0x800, } } /// Represents a reply to a story See @@ -15053,7 +15079,7 @@ namespace TL public override long AccessHash => access_hash; } - /// Indicates a group call See Derived classes: + /// Indicates a group call See Derived classes: , , public abstract partial class InputGroupCallBase : IObject { } /// Points to a specific group call See [TLDef(0xD8AA840F)] @@ -16054,7 +16080,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , + /// An invoice See Derived classes: , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16120,6 +16146,7 @@ namespace TL [TLDef(0x4D818D5D)] public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputSavedStarGift stargift; @@ -16139,6 +16166,7 @@ namespace TL [TLDef(0xDABAB2EF)] public sealed partial class InputInvoicePremiumGiftStars : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputUserBase user_id; public int months; @@ -16146,6 +16174,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_message = 0x1, } } @@ -16214,7 +16243,7 @@ namespace TL public Dictionary users; } - /// Info about a Telegram Premium purchase See Derived classes: , , , , , , + /// Info about a Telegram Premium purchase See Derived classes: , , , , , , , public abstract partial class InputStorePaymentPurpose : IObject { } /// Info about a Telegram Premium purchase See [TLDef(0xA6751E66)] @@ -16373,6 +16402,7 @@ namespace TL [TLDef(0x9BB2636D)] public sealed partial class InputStorePaymentAuthCode : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string phone_number; public string phone_code_hash; @@ -16395,7 +16425,7 @@ namespace TL public string title; } - /// Emoji status See Derived classes: , + /// Emoji status See Derived classes: , , /// a value means emojiStatusEmpty public abstract partial class EmojiStatusBase : IObject { @@ -16405,6 +16435,7 @@ namespace TL [TLDef(0xE7FF068A)] public sealed partial class EmojiStatus : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Custom emoji document ID public long document_id; @@ -16422,6 +16453,7 @@ namespace TL [TLDef(0x7184603B)] public sealed partial class EmojiStatusCollectible : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; public long document_id; @@ -16436,6 +16468,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_until = 0x1, } @@ -16445,12 +16478,14 @@ namespace TL [TLDef(0x07141DBF)] public sealed partial class InputEmojiStatusCollectible : EmojiStatusBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint { + /// Field has a value has_until = 0x1, } @@ -17641,10 +17676,10 @@ namespace TL public Dictionary users; } - /// Contains info about a message or story to reply to. See Derived classes: , + /// Contains info about a message or story to reply to. See Derived classes: , , public abstract partial class InputReplyTo : IObject { } /// Reply to a message. See - [TLDef(0xB07038B0)] + [TLDef(0x869FBE10)] public sealed partial class InputReplyToMessage : InputReplyTo { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17662,6 +17697,7 @@ namespace TL /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; [IfFlag(5)] public InputPeer monoforum_peer_id; + [IfFlag(6)] public int todo_item_id; [Flags] public enum Flags : uint { @@ -17677,6 +17713,8 @@ namespace TL has_quote_offset = 0x10, /// Field has a value has_monoforum_peer_id = 0x20, + /// Field has a value + has_todo_item_id = 0x40, } } /// Reply to a story. See @@ -17749,7 +17787,7 @@ namespace TL } } - /// Represents a story media area » See Derived classes: , , , , , , , + /// Represents a story media area » See Derived classes: , , , , , , , , public abstract partial class MediaArea : IObject { } /// Represents a location tag attached to a story, with additional venue information. See [TLDef(0xBE82DB9C)] @@ -18505,7 +18543,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Represents a saved message dialog ». See Derived classes: + /// Represents a saved message dialog ». See Derived classes: , public abstract partial class SavedDialogBase : IObject { /// The dialog @@ -18539,6 +18577,7 @@ namespace TL [TLDef(0x64407EA7)] public sealed partial class MonoForumDialog : SavedDialogBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int top_message; @@ -18550,6 +18589,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_draft = 0x2, unread_mark = 0x8, nopaid_messages_exception = 0x10, @@ -19806,6 +19846,7 @@ namespace TL [TLDef(0x6C207376)] public sealed partial class Payments_StarsRevenueStats : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) @@ -20042,7 +20083,7 @@ namespace TL } } - /// Represents a star gift, see here » for more info. See Derived classes: + /// Represents a star gift, see here » for more info. See Derived classes: , public abstract partial class StarGiftBase : IObject { /// Identifier of the gift @@ -20109,6 +20150,7 @@ namespace TL [TLDef(0xF63778AE)] public sealed partial class StarGiftUnique : StarGiftBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long id; public string title; @@ -20126,11 +20168,17 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_owner_id = 0x1, + /// Field has a value has_owner_name = 0x2, + /// Field has a value has_owner_address = 0x4, + /// Field has a value has_gift_address = 0x8, + /// Field has a value has_resell_stars = 0x10, + /// Field has a value has_released_by = 0x20, } @@ -20345,7 +20393,7 @@ namespace TL } } - /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: + /// Describes a real (i.e. possibly decimal) amount of Telegram Stars. See Derived classes: , public abstract partial class StarsAmountBase : IObject { /// The integer amount of Telegram Stars. @@ -20413,6 +20461,7 @@ namespace TL [TLDef(0xB0CD6617)] public sealed partial class BotVerifierSettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long icon; public string company; @@ -20420,6 +20469,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_custom_description = 0x1, can_modify_custom_description = 0x2, } @@ -20434,7 +20484,7 @@ namespace TL public string description; } - /// See + /// See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } /// See [TLDef(0x39D99013)] @@ -20468,6 +20518,7 @@ namespace TL [TLDef(0xE0BFF26C)] public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public Peer sender_id; public Peer recipient_id; @@ -20476,7 +20527,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sender_id = 0x1, + /// Field has a value has_message = 0x2, } } @@ -20521,6 +20574,7 @@ namespace TL [TLDef(0xDFDA0499)] public sealed partial class SavedStarGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public Peer from_id; public DateTime date; @@ -20538,19 +20592,29 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_from_id = 0x2, + /// Field has a value has_message = 0x4, + /// Field has a value has_msg_id = 0x8, + /// Field has a value has_convert_stars = 0x10, unsaved = 0x20, + /// Field has a value has_upgrade_stars = 0x40, + /// Field has a value has_can_export_at = 0x80, + /// Field has a value has_transfer_stars = 0x100, refunded = 0x200, can_upgrade = 0x400, + /// Field has a value has_saved_id = 0x800, pinned_to_top = 0x1000, + /// Field has a value has_can_transfer_at = 0x2000, + /// Field has a value has_can_resell_at = 0x4000, } } @@ -20559,6 +20623,7 @@ namespace TL [TLDef(0x95F389B1)] public sealed partial class Payments_SavedStarGifts : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; [IfFlag(1)] public bool chat_notifications_enabled; @@ -20569,14 +20634,16 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, + /// Field has a value has_chat_notifications_enabled = 0x2, } /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } /// See [TLDef(0x69279795)] @@ -20605,7 +20672,7 @@ namespace TL public string url; } - /// See + /// See Derived classes: , /// a value means paidReactionPrivacyDefault public abstract partial class PaidReactionPrivacy : IObject { } /// See @@ -20625,7 +20692,7 @@ namespace TL public long stars_amount; } - /// See + /// See Derived classes: , /// a value means requirementToContactEmpty public abstract partial class RequirementToContact : IObject { } /// See @@ -20642,6 +20709,7 @@ namespace TL [TLDef(0xA0624CF7)] public sealed partial class BusinessBotRights : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -20667,6 +20735,7 @@ namespace TL [TLDef(0x71F276C4)] public sealed partial class DisallowedGiftsSettings : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [Flags] public enum Flags : uint @@ -20682,6 +20751,7 @@ namespace TL [TLDef(0xC69708D3)] public sealed partial class SponsoredPeer : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public byte[] random_id; public Peer peer; @@ -20690,7 +20760,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_sponsor_info = 0x1, + /// Field has a value has_additional_info = 0x2, } } @@ -20707,7 +20779,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , , public abstract partial class StarGiftAttributeId : IObject { } /// See [TLDef(0x48AAAE3C)] @@ -20740,6 +20812,7 @@ namespace TL [TLDef(0x947A12DF)] public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int count; public StarGiftBase[] gifts; @@ -20752,8 +20825,11 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, + /// Fields and have a value has_attributes = 0x2, + /// Field has a value has_counters = 0x4, } /// returns a or for the given Peer @@ -20789,6 +20865,7 @@ namespace TL [TLDef(0x49B92A26)] public sealed partial class TodoList : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public TextWithEntities title; public TodoItem[] list; @@ -20813,15 +20890,18 @@ namespace TL [TLDef(0x0E8E37E5)] public sealed partial class SuggestedPost : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public StarsAmountBase price; [IfFlag(0)] public DateTime schedule_date; [Flags] public enum Flags : uint { + /// Field has a value has_schedule_date = 0x1, accepted = 0x2, rejected = 0x4, + /// Field has a value has_price = 0x8, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 0845d54..6c1c3b5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1425,7 +1425,7 @@ namespace TL settings = settings, }); - /// See + /// See [bots: ✓] /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) => client.Invoke(new Account_GetPaidMessagesRevenue { @@ -1442,7 +1442,7 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) => client.Invoke(new Account_ToggleNoPaidMessagesException { @@ -1477,7 +1477,7 @@ namespace TL errors = errors, }); - /// See + /// See [bots: ✓] public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact { @@ -1733,7 +1733,7 @@ namespace TL { }); - /// See + /// See [bots: ✓] /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -4389,12 +4389,12 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). /// Unique client message ID required to prevent message resending You can use - /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction { @@ -4507,7 +4507,7 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -4516,7 +4516,7 @@ namespace TL id = id, }); - /// See + /// See [bots: ✓] public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4525,7 +4525,7 @@ namespace TL ids = ids, }); - /// See + /// See [bots: ✓] public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4534,7 +4534,7 @@ namespace TL max_id = max_id, }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4544,7 +4544,7 @@ namespace TL incompleted = incompleted, }); - /// See + /// See [bots: ✓] public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4553,7 +4553,7 @@ namespace TL list = list, }); - /// See + /// See [bots: ✓] public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -5648,7 +5648,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars, bool broadcast_messages_allowed = false) => client.Invoke(new Channels_UpdatePaidMessagesPrice { @@ -5657,7 +5657,7 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See + /// See [bots: ✓] public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5665,7 +5665,7 @@ namespace TL enabled = enabled, }); - /// See + /// See [bots: ✓] public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -5967,7 +5967,7 @@ namespace TL duration_months = duration_months ?? default, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Bots_SetCustomVerification(this Client client, InputPeer peer, InputUserBase bot = null, string custom_description = null, bool enabled = false) => client.Invoke(new Bots_SetCustomVerification { @@ -5977,7 +5977,7 @@ namespace TL custom_description = custom_description, }); - /// See + /// See Possible codes: 400 (details) public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetBotRecommendations { @@ -6384,7 +6384,7 @@ namespace TL gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_UpgradeStarGift(this Client client, InputSavedStarGift stargift, bool keep_original_details = false) => client.Invoke(new Payments_UpgradeStarGift { @@ -6392,7 +6392,7 @@ namespace TL stargift = stargift, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_TransferStarGift(this Client client, InputSavedStarGift stargift, InputPeer to_id) => client.Invoke(new Payments_TransferStarGift { @@ -6400,14 +6400,15 @@ namespace TL to_id = to_id, }); - /// See + /// See [bots: ✓] public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) => client.Invoke(new Payments_GetSavedStarGifts { @@ -6417,14 +6418,14 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See + /// See [bots: ✓] public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6432,7 +6433,7 @@ namespace TL password = password, }); - /// See + /// See [bots: ✓] public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6440,7 +6441,7 @@ namespace TL peer = peer, }); - /// See + /// See [bots: ✓] public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6448,14 +6449,15 @@ namespace TL stargift = stargift, }); - /// See + /// See [bots: ✓] public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts { @@ -6467,7 +6469,7 @@ namespace TL limit = limit, }); - /// See + /// See [bots: ✓] public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6962,7 +6964,7 @@ namespace TL file = file, }); - /// See + /// See [bots: ✓] public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { @@ -6973,7 +6975,7 @@ namespace TL params_ = params_, }); - /// See + /// See [bots: ✓] public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -6983,7 +6985,7 @@ namespace TL block = block, }); - /// See + /// See [bots: ✓] public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -6991,7 +6993,7 @@ namespace TL block = block, }); - /// See + /// See [bots: ✓] public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7000,14 +7002,15 @@ namespace TL user_id = user_id, }); - /// See + /// See [bots: ✓] public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See + /// See [bots: ✓] + /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index bbb604f..cf405eb 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 = 207; // fetched 08/07/2025 17:40:58 + public const int Version = 209; // fetched 14/07/2025 20:10:02 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -1039,7 +1039,7 @@ namespace TL [0x455B853D] = typeof(MessageViews), [0xB6C4F543] = typeof(Messages_MessageViews), [0xA6341782] = typeof(Messages_DiscussionMessage), - [0xAFBC09DB] = typeof(MessageReplyHeader), + [0x6917560B] = typeof(MessageReplyHeader), [0x0E5AF939] = typeof(MessageReplyStoryHeader), [0x83D60FC2] = typeof(MessageReplies), [0xE8FD8014] = typeof(PeerBlocked), @@ -1222,7 +1222,7 @@ namespace TL [0xBD74CF49] = typeof(StoryViewPublicRepost), [0x59D78FC5] = typeof(Stories_StoryViewsList), [0xDE9EED1D] = typeof(Stories_StoryViews), - [0xB07038B0] = typeof(InputReplyToMessage), + [0x869FBE10] = typeof(InputReplyToMessage), [0x5881323A] = typeof(InputReplyToStory), [0x69D66C45] = typeof(InputReplyToMonoForum), [0x3FC9053B] = typeof(ExportedStoryLink), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 3d55ae8..8ab7179 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.207 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 207 + layer.209 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 209 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From a8fa32dfd5bc558dffcb5728f77022a33f7c8998 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 18 Jul 2025 02:28:43 +0200 Subject: [PATCH 296/336] Support single-quote arguments in HTML --- src/Services.cs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index d62b877..bb536d2 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -401,6 +401,7 @@ namespace TL case "u": case "ins": ProcessEntity(); break; case "s": case "strike": case "del": ProcessEntity(); break; case "span class=\"tg-spoiler\"": + case "span class='tg-spoiler'": case "span" when closing: case "tg-spoiler": ProcessEntity(); break; case "code": ProcessEntity(); break; @@ -420,7 +421,8 @@ namespace TL prevEntity.length = offset - prevEntity.offset; } } - else if (tag.StartsWith("a href=\"") && tag[^1] == '"') + else if ((tag[^1] == '"' && tag.StartsWith("a href=\"")) + || (tag[^1] == '\'' && tag.StartsWith("a href='"))) { tag = HttpUtility.HtmlDecode(tag[8..^1]); if (tag.StartsWith("tg://user?id=") && long.TryParse(tag[13..], out var user_id) && users?.GetValueOrDefault(user_id)?.access_hash is long hash) @@ -428,12 +430,13 @@ namespace TL else entities.Add(new MessageEntityTextUrl { offset = offset, length = -1, url = tag }); } - else if (tag.StartsWith("code class=\"language-") && tag[^1] == '"') + else if ((tag[^1] == '"' && tag.StartsWith("code class=\"language-")) + || (tag[^1] == '\'' && tag.StartsWith("code class='language-"))) { if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; } - else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji id=\""))) + else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='"))) entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[(tag.IndexOf('=') + 2)..^1]) }); break; } From e9543a690b1a332727d8ac1d054b59c48a3efe07 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 25 Jul 2025 01:03:30 +0200 Subject: [PATCH 297/336] Examples for download abort, and uploading streamable video (fix #325, thx @patelriki13) --- .github/workflows/telegram-api.yml | 3 ++- EXAMPLES.md | 37 +++++++++++++++++++++++++++++- 2 files changed, 38 insertions(+), 2 deletions(-) diff --git a/.github/workflows/telegram-api.yml b/.github/workflows/telegram-api.yml index 9a69fd9..efd921a 100644 --- a/.github/workflows/telegram-api.yml +++ b/.github/workflows/telegram-api.yml @@ -12,7 +12,7 @@ jobs: if: contains(github.event.issue.labels.*.name, 'telegram api') runs-on: ubuntu-latest steps: - - uses: dessant/support-requests@v3.0.0 + - uses: dessant/support-requests@v4 with: support-label: 'telegram api' issue-comment: > @@ -26,3 +26,4 @@ jobs: If the above links didn't answer your problem, [click here to ask your question on **StackOverflow**](https://stackoverflow.com/questions/ask?tags=c%23+wtelegramclient+telegram-api) so the whole community can help and benefit. close-issue: true + issue-close-reason: 'not planned' diff --git a/EXAMPLES.md b/EXAMPLES.md index e32e10d..ac2daf1 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -210,7 +210,7 @@ that simplifies the download of a photo/document/file once you get a reference t See [Examples/Program_DownloadSavedMedia.cs](https://github.com/wiz0u/WTelegramClient/blob/master/Examples/Program_DownloadSavedMedia.cs?ts=4#L28) that download all media files you forward to yourself (Saved Messages) -_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument._ +_Note: To abort an ongoing download, you can throw an exception via the `progress` callback argument. Example: `(t,s) => ct.ThrowIfCancellationRequested()`_ ## Upload a media file and post it with caption to a chat @@ -224,6 +224,41 @@ var inputFile = await client.UploadFileAsync(Filepath); await client.SendMediaAsync(peer, "Here is the photo", inputFile); ``` + +## Upload a streamable video with optional custom thumbnail +```csharp +var chats = await client.Messages_GetAllChats(); +InputPeer peer = chats.chats[1234567890]; // the chat we want +const string videoPath = @"C:\...\video.mp4"; +const string thumbnailPath = @"C:\...\thumbnail.jpg"; + +// Extract video information using FFMpegCore or similar library +var mediaInfo = await FFmpeg.GetMediaInfo(videoPath); +var videoStream = mediaInfo.VideoStreams.FirstOrDefault(); +int width = videoStream?.Width ?? 0; +int height = videoStream?.Height ?? 0; +int duration = (int)mediaInfo.Duration.TotalSeconds; + +// Upload video file +var inputFile = await Client.UploadFileAsync(videoPath); + +// Prepare InputMedia structure with video attributes +var media = new InputMediaUploadedDocument(inputFile, "video/mp4", + new DocumentAttributeVideo { w = width, h = height, duration = duration, + flags = DocumentAttributeVideo.Flags.supports_streaming }); +if (thumbnailPath != null) +{ + // upload custom thumbnail and complete InputMedia structure + var inputThumb = await client.UploadFileAsync(thumbnailPath); + media.thumb = inputThumb; + media.flags |= InputMediaUploadedDocument.Flags.has_thumb; +} + +// Send the media message +await client.SendMessageAsync(peer, "caption", media); +``` +*Note: This example requires FFMpegCore NuGet package for video metadata extraction. You can also manually set width, height, and duration if you know the video properties.* + ## Send a grouped media album using photos from various sources ```csharp From 30a982b0ac16d1f1f637d0675b46eef6e4421412 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 25 Jul 2025 17:01:58 +0200 Subject: [PATCH 298/336] API Layer 210: user's Stars Rating, StarGift collections management & more characteristics... (that might not be the most recent layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 63 +++++++++++++++++-- src/TL.SchemaFuncs.cs | 122 ++++++++++++++++++++++++++++++++++--- src/TL.Table.cs | 13 ++-- src/WTelegramClient.csproj | 4 +- 5 files changed, 185 insertions(+), 19 deletions(-) diff --git a/README.md b/README.md index 4da3f32..a89d3b9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-209-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-210-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 281d067..c887407 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -898,7 +898,7 @@ namespace TL has_color = 0x100, /// Field has a value has_profile_color = 0x200, - /// If set, we can only write to this user if they have already sent some messages to us, if we are subscribed to Telegram Premium, or if they're a mutual contact (.mutual_contact).
All the secondary conditions listed above must be checked separately to verify whether we can still write to the user, even if this flag is set (i.e. a mutual contact will have this flag set even if we can still write to them, and so on...); to avoid doing these extra checks if we haven't yet cached all the required information (for example while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked instead, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user; alternatively, the .contact_require_premium flag contains the same (fully checked, i.e. it's not just a copy of this flag) info returned by Users_GetIsPremiumRequiredToContact.
To set this flag for ourselves invoke Account_SetGlobalPrivacySettings, setting the settings.new_noncontact_peers_require_premium flag.
+ /// See here for more info on this flag ». contact_require_premium = 0x400, /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, @@ -3742,7 +3742,7 @@ namespace TL } /// Extended user info See - [TLDef(0x99E78045)] + [TLDef(0x29DE80BE)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3808,6 +3808,7 @@ namespace TL [IfFlag(44)] public BotVerification bot_verification; [IfFlag(46)] public long send_paid_messages_stars; [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; + [IfFlag(49)] public StarsRating stars_rating; [Flags] public enum Flags : uint { @@ -3900,6 +3901,8 @@ namespace TL /// Field has a value has_disallowed_gifts = 0x8000, display_gifts_button = 0x10000, + /// Field has a value + has_stars_rating = 0x20000, } } @@ -14719,6 +14722,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// If configured, specifies the number of stars users must pay us to send us a message, see here » for more info on paid messages. [IfFlag(5)] public long noncontact_peers_paid_stars; [IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts; @@ -14732,7 +14736,7 @@ namespace TL keep_archived_folders = 0x4, /// If this flag is set, the key will also apply to the ability to use Messages_GetOutboxReadDate on messages sent to us.
Meaning, users that cannot see our exact last online date due to the current value of the key will receive a 403 USER_PRIVACY_RESTRICTED error when invoking Messages_GetOutboxReadDate to fetch the exact read date of a message they sent to us.
The .read_dates_private flag will be set for users that have this flag enabled.
hide_read_marks = 0x8, - /// If set, only users that have a premium account, are in our contact list, or already have a private chat with us can write to us; a 403 PRIVACY_PREMIUM_REQUIRED error will be emitted otherwise.
The .contact_require_premium flag will be set for users that have this flag enabled.
To check whether we can write to a user with this flag enabled, if we haven't yet cached all the required information (for example we don't have the or history of all users while displaying the chat list in the sharing UI) the Users_GetIsPremiumRequiredToContact method may be invoked, passing the list of users currently visible in the UI, returning a list of booleans that directly specify whether we can or cannot write to each user.
This option may be enabled by both non-Premium and Premium users only if the new_noncontact_peers_require_premium_without_ownpremium client configuration flag » is equal to true, otherwise it may be enabled only by Premium users and non-Premium users will receive a PREMIUM_ACCOUNT_REQUIRED error when trying to enable this flag.
+ /// See here for more info on this flag ». new_noncontact_peers_require_premium = 0x10, /// Field has a value has_noncontact_peers_paid_stars = 0x20, @@ -20094,7 +20098,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x7F853C12)] + [TLDef(0x00BCFF5B)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20120,6 +20124,8 @@ namespace TL [IfFlag(4)] public long resell_min_stars; [IfFlag(5)] public string title; [IfFlag(6)] public Peer released_by; + [IfFlag(8)] public int per_user_total; + [IfFlag(8)] public int per_user_remains; [Flags] public enum Flags : uint { @@ -20137,6 +20143,8 @@ namespace TL has_title = 0x20, /// Field has a value has_released_by = 0x40, + require_premium = 0x80, + limited_per_user = 0x100, } /// Identifier of the gift @@ -20180,6 +20188,7 @@ namespace TL has_resell_stars = 0x10, /// Field has a value has_released_by = 0x20, + require_premium = 0x40, } public override long ID => id; @@ -20571,7 +20580,7 @@ namespace TL } /// See - [TLDef(0xDFDA0499)] + [TLDef(0x1EA646DF)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20588,6 +20597,7 @@ namespace TL [IfFlag(8)] public long transfer_stars; [IfFlag(13)] public DateTime can_transfer_at; [IfFlag(14)] public DateTime can_resell_at; + [IfFlag(15)] public int[] collection_id; [Flags] public enum Flags : uint { @@ -20616,6 +20626,8 @@ namespace TL has_can_transfer_at = 0x2000, /// Field has a value has_can_resell_at = 0x4000, + /// Field has a value + has_collection_id = 0x8000, } } @@ -20905,4 +20917,45 @@ namespace TL has_price = 0x8, } } + + /// See + [TLDef(0x1B0E4F07)] + public sealed partial class StarsRating : IObject + { + public Flags flags; + public int level; + public long current_level_stars; + public long stars; + [IfFlag(0)] public long next_level_stars; + + [Flags] public enum Flags : uint + { + has_next_level_stars = 0x1, + } + } + + /// See + [TLDef(0x9D6B13B0)] + public sealed partial class StarGiftCollection : IObject + { + public Flags flags; + public int collection_id; + public string title; + [IfFlag(0)] public DocumentBase icon; + public int gifts_count; + public long hash; + + [Flags] public enum Flags : uint + { + has_icon = 0x1, + } + } + + /// See + /// a value means payments.starGiftCollectionsNotModified + [TLDef(0x8A2932F3)] + public sealed partial class Payments_StarGiftCollections : IObject + { + public StarGiftCollection[] collections; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 6c1c3b5..a066365 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,7 +1433,9 @@ namespace TL hash = hash, }); - /// See [bots: ✓] + /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See [bots: ✓] + /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel. + /// The user that paid to send us messages. public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) => client.Invoke(new Account_GetPaidMessagesRevenue { @@ -1442,7 +1444,11 @@ namespace TL user_id = user_id, }); - /// See [bots: ✓] + /// Allow a user to send us messages without paying if paid messages » are enabled. See [bots: ✓] + /// If set and require_payment is not set, refunds the amounts the user has already paid us to send us messages (directly or via a monoforum). + /// Allow or disallow a user to send us messages without paying. + /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). + /// The user to exempt or unexempt. public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) => client.Invoke(new Account_ToggleNoPaidMessagesException { @@ -4659,7 +4665,7 @@ namespace TL /// Upload a custom profile picture for a contact, or suggest a new profile picture to a contact. See Possible codes: 400 (details) /// If set, will send a service message to user_id, suggesting them to use the specified profile picture; otherwise, will set a personal profile picture for the user (only visible to the current user). - /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply deleted the service message with Messages_DeleteMessages). + /// If set, removes a previously set personal profile picture (does not affect suggested profile pictures, to remove them simply delete the service message with Messages_DeleteMessages). /// The contact /// Profile photo /// Animated profile picture video @@ -5648,7 +5654,10 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓] + /// Only usable for channels, enables or disables the associated monoforum aka direct messages. + /// Pass the supergroup ID for supergroups and the ID of the channel to modify the setting in the associated monoforum. + /// Specifies the required amount of Telegram Stars users must pay to send messages to the supergroup or monoforum. public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars, bool broadcast_messages_allowed = false) => client.Invoke(new Channels_UpdatePaidMessagesPrice { @@ -6409,11 +6418,12 @@ namespace TL /// See [bots: ✓] /// Maximum number of results to return, see pagination - public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) + public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) => client.Invoke(new Payments_GetSavedStarGifts { - flags = (Payments_GetSavedStarGifts.Flags)((exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)), + flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)), peer = peer, + collection_id = collection_id ?? default, offset = offset, limit = limit, }); @@ -6477,6 +6487,53 @@ namespace TL resell_stars = resell_stars, }); + /// See + public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift) + => client.Invoke(new Payments_CreateStarGiftCollection + { + peer = peer, + title = title, + stargift = stargift, + }); + + /// See + public static Task Payments_UpdateStarGiftCollection(this Client client, InputPeer peer, int collection_id, string title = null, InputSavedStarGift[] delete_stargift = null, InputSavedStarGift[] add_stargift = null, InputSavedStarGift[] order = null) + => client.Invoke(new Payments_UpdateStarGiftCollection + { + flags = (Payments_UpdateStarGiftCollection.Flags)((title != null ? 0x1 : 0) | (delete_stargift != null ? 0x2 : 0) | (add_stargift != null ? 0x4 : 0) | (order != null ? 0x8 : 0)), + peer = peer, + collection_id = collection_id, + title = title, + delete_stargift = delete_stargift, + add_stargift = add_stargift, + order = order, + }); + + /// See + public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order) + => client.Invoke(new Payments_ReorderStarGiftCollections + { + peer = peer, + order = order, + }); + + /// See + public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id) + => client.Invoke(new Payments_DeleteStarGiftCollection + { + peer = peer, + collection_id = collection_id, + }); + + /// See + /// a null value means payments.starGiftCollectionsNotModified + public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default) + => client.Invoke(new Payments_GetStarGiftCollections + { + peer = peer, + hash = hash, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -13077,11 +13134,12 @@ namespace TL.Methods public string slug; } - [TLDef(0x23830DE9)] + [TLDef(0xA319E569)] public sealed partial class Payments_GetSavedStarGifts : IMethod { public Flags flags; public InputPeer peer; + [IfFlag(6)] public int collection_id; public string offset; public int limit; @@ -13093,6 +13151,7 @@ namespace TL.Methods exclude_limited = 0x8, exclude_unique = 0x10, sort_by_value = 0x20, + has_collection_id = 0x40, } } @@ -13160,6 +13219,55 @@ namespace TL.Methods public long resell_stars; } + [TLDef(0x1F4A0E87)] + public sealed partial class Payments_CreateStarGiftCollection : IMethod + { + public InputPeer peer; + public string title; + public InputSavedStarGift[] stargift; + } + + [TLDef(0x4FDDBEE7)] + public sealed partial class Payments_UpdateStarGiftCollection : IMethod + { + public Flags flags; + public InputPeer peer; + public int collection_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public InputSavedStarGift[] delete_stargift; + [IfFlag(2)] public InputSavedStarGift[] add_stargift; + [IfFlag(3)] public InputSavedStarGift[] order; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_delete_stargift = 0x2, + has_add_stargift = 0x4, + has_order = 0x8, + } + } + + [TLDef(0xC32AF4CC)] + public sealed partial class Payments_ReorderStarGiftCollections : IMethod + { + public InputPeer peer; + public int[] order; + } + + [TLDef(0xAD5648E8)] + public sealed partial class Payments_DeleteStarGiftCollection : IMethod + { + public InputPeer peer; + public int collection_id; + } + + [TLDef(0x981B91DD)] + public sealed partial class Payments_GetStarGiftCollections : IMethod + { + public InputPeer peer; + public long hash; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index cf405eb..6745b43 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 = 209; // fetched 14/07/2025 20:10:02 + public const int Version = 210; // fetched 25/07/2025 14:54:33 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -254,7 +254,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x99E78045] = typeof(UserFull), + [0x29DE80BE] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -1361,7 +1361,7 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x7F853C12] = typeof(StarGift), + [0x00BCFF5B] = typeof(StarGift), [0xF63778AE] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), @@ -1391,7 +1391,7 @@ namespace TL [0x315A4974] = typeof(Users_UsersSlice), [0xCAA2F60B] = typeof(Payments_UniqueStarGift), [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0xDFDA0499] = typeof(SavedStarGift), + [0x1EA646DF] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1420,6 +1420,10 @@ namespace TL [0x49B92A26] = typeof(TodoList), [0x4CC120B7] = typeof(TodoCompletion), [0x0E8E37E5] = typeof(SuggestedPost), + [0x1B0E4F07] = typeof(StarsRating), + [0x9D6B13B0] = typeof(StarGiftCollection), + [0xA0BA4F17] = null,//Payments_StarGiftCollectionsNotModified + [0x8A2932F3] = typeof(Payments_StarGiftCollections), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1553,6 +1557,7 @@ namespace TL [typeof(PaidReactionPrivacy)] = 0x206AD49E, //paidReactionPrivacyDefault [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty + [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8ab7179..d786b10 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.209 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 209 + layer.210 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 210 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From d9e4b7cc0f653476ffa599203f1dee118fb8d480 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Aug 2025 00:17:12 +0200 Subject: [PATCH 299/336] CollectUsersChats: don't update usernames from min info (thx @riniba) --- src/Services.cs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index bb536d2..a83eed6 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -29,7 +29,9 @@ namespace TL if (!user.flags.HasFlag(User.Flags.min) || !_users.TryGetValue(user.id, out var prevUser) || prevUser.flags.HasFlag(User.Flags.min)) _users[user.id] = user; else - { // update previously full user from min user: + { // update previously full user from min user: + // see https://github.com/tdlib/td/blob/master/td/telegram/UserManager.cpp#L2689 + // and https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/data/data_session.cpp#L515 const User.Flags updated_flags = (User.Flags)0x5DAFE000; const User.Flags2 updated_flags2 = (User.Flags2)0x711; // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo @@ -53,7 +55,7 @@ namespace TL if (user.lang_code != null) prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated - prevUser.usernames = user.usernames; // tdlib: not updated ; tdesktop: updated + //prevUser.usernames = user.usernames; // tdlib/tdesktop: not updated if (user.stories_max_id > 0) prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated prevUser.color = user.color; // tdlib/tdesktop: updated From 7faa3873f8255cdc38488b86ca932d8e46d8337e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 1 Aug 2025 00:49:57 +0200 Subject: [PATCH 300/336] API Layer 211: Stories Albums, user's pending Stars Rating, SearchPosts + Check Flood, ... (that might not be the most recent API layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 122 ++++++++++++++++++---- src/TL.SchemaFuncs.cs | 204 +++++++++++++++++++++++++++++++++---- src/TL.Table.cs | 20 ++-- src/WTelegramClient.csproj | 4 +- 5 files changed, 303 insertions(+), 49 deletions(-) diff --git a/README.md b/README.md index a89d3b9..8bb243f 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-210-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-211-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 c887407..21e4c2b 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -818,6 +818,7 @@ namespace TL /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; [IfFlag(46)] public long bot_verification_icon; + /// If set, the user has enabled paid messages », we might need to pay the specified amount of Stars to send them messages, depending on the configured exceptions: check .send_paid_messages_stars or Users_GetRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow. [IfFlag(47)] public long send_paid_messages_stars; [Flags] public enum Flags : uint @@ -1124,6 +1125,7 @@ namespace TL /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; [IfFlag(45)] public long bot_verification_icon; + /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). [IfFlag(46)] public long send_paid_messages_stars; [IfFlag(50)] public long linked_monoforum_id; @@ -1491,6 +1493,7 @@ namespace TL [IfFlag(42)] public StickerSet emojiset; [IfFlag(49)] public BotVerification bot_verification; [IfFlag(50)] public int stargifts_count; + /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; [Flags] public enum Flags : uint @@ -1841,7 +1844,9 @@ namespace TL [IfFlag(34)] public long effect; /// Represents a fact-check ». [IfFlag(35)] public FactCheck factcheck; + /// Used for Telegram Gateway verification messages: if set and the current unixtime is bigger than the specified unixtime, invoke Messages_ReportMessagesDelivery passing the ID and the peer of this message as soon as it is received by the client (optionally batching requests for the same peer). [IfFlag(37)] public DateTime report_delivery_until_date; + /// The amount of stars the sender has paid to send the message, see here » for more info. [IfFlag(38)] public long paid_message_stars; [IfFlag(39)] public SuggestedPost suggested_post; @@ -1965,6 +1970,7 @@ namespace TL public DateTime date; /// Event connected with the service message public MessageAction action; + /// Reactions ». [IfFlag(20)] public MessageReactions reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. [IfFlag(25)] public int ttl_period; @@ -1981,6 +1987,7 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, + /// Whether you can react to this messages ». reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, @@ -2007,6 +2014,7 @@ namespace TL public override MessageReplyHeaderBase ReplyTo => reply_to; /// Message date public override DateTime Date => date; + /// Reactions ». public override MessageReactions Reactions => reactions; /// Time To Live of the message, once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. public override int TtlPeriod => ttl_period; @@ -2967,7 +2975,7 @@ namespace TL } } /// See - [TLDef(0x2E3AE60E)] + [TLDef(0x34F762F3)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2978,7 +2986,7 @@ namespace TL [IfFlag(6)] public Peer from_id; [IfFlag(7)] public Peer peer; [IfFlag(7)] public long saved_id; - [IfFlag(8)] public long resale_stars; + [IfFlag(8)] public StarsAmountBase resale_amount; [IfFlag(9)] public DateTime can_transfer_at; [IfFlag(10)] public DateTime can_resell_at; @@ -2996,8 +3004,8 @@ namespace TL has_from_id = 0x40, /// Fields and have a value has_peer = 0x80, - /// Field has a value - has_resale_stars = 0x100, + /// Field has a value + has_resale_amount = 0x100, /// Field has a value has_can_transfer_at = 0x200, /// Field has a value @@ -3596,6 +3604,7 @@ namespace TL [IfFlag(13)] public long business_bot_id; /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; + /// All users that must pay us » to send us private messages will have this flag set only for us, containing the amount of required stars, see here » for more info on paid messages. [IfFlag(14)] public long charge_paid_message_stars; [IfFlag(15)] public string registration_month; [IfFlag(16)] public string phone_country; @@ -3742,7 +3751,7 @@ namespace TL } /// Extended user info See - [TLDef(0x29DE80BE)] + [TLDef(0x7E63CE1F)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3806,9 +3815,12 @@ namespace TL /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; [IfFlag(44)] public BotVerification bot_verification; + /// If set and bigger than 0, this user has enabled paid messages » and we must pay the specified amount of Stars to send messages to them, see here » for the full flow.
If set and equal to 0, the user requires payment in general but we were exempted from paying for any of the reasons specified in the docs ».
[IfFlag(46)] public long send_paid_messages_stars; [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; [IfFlag(49)] public StarsRating stars_rating; + [IfFlag(50)] public StarsRating stars_my_pending_rating; + [IfFlag(50)] public DateTime stars_my_pending_rating_date; [Flags] public enum Flags : uint { @@ -3903,6 +3915,8 @@ namespace TL display_gifts_button = 0x10000, /// Field has a value has_stars_rating = 0x20000, + /// Fields and have a value + has_stars_my_pending_rating = 0x40000, } } @@ -4056,7 +4070,7 @@ namespace TL public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See - [TLDef(0x3A54685E)] + [TLDef(0x762B263D)] public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4067,6 +4081,7 @@ namespace TL [IfFlag(0)] public int next_rate; /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}.
[IfFlag(2)] public int offset_id_offset; + [IfFlag(3)] public SearchPostsFlood search_flood; [Flags] public enum Flags : uint { @@ -4076,6 +4091,8 @@ namespace TL inexact = 0x2, /// Field has a value has_offset_id_offset = 0x4, + /// Field has a value + has_search_flood = 0x8, } } ///
Channel messages See @@ -7163,7 +7180,7 @@ namespace TL Birthday = 0xD65A11CC, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0xE1732341, - ///See + ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0xBDC597B4, } @@ -7194,7 +7211,7 @@ namespace TL Birthday = 0x2000A518, ///Whether received gifts will be automatically displayed on our profile StarGiftsAutoSave = 0x2CA4FDF8, - ///See + ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0x17D348D2, } @@ -7230,14 +7247,14 @@ namespace TL [TLDef(0x840649CF)] public sealed partial class InputPrivacyValueAllowChatParticipants : InputPrivacyRule { - /// Allowed chat IDs + /// Allowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0xE94F0F86)] public sealed partial class InputPrivacyValueDisallowChatParticipants : InputPrivacyRule { - /// Disallowed chat IDs + /// Disallowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Allow only close friends » See @@ -7285,14 +7302,14 @@ namespace TL [TLDef(0x6B134E8E)] public sealed partial class PrivacyValueAllowChatParticipants : PrivacyRule { - /// Allowed chats + /// Allowed chat IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Disallow only participants of certain chats See [TLDef(0x41C87565)] public sealed partial class PrivacyValueDisallowChatParticipants : PrivacyRule { - /// Disallowed chats + /// Disallowed chats IDs (either a or a supergroup ID, verbatim the way it is received in the constructor (i.e. unlike with bot API IDs, here group and supergroup IDs should be treated in the same way)). public long[] chats; } /// Allow only close friends » See @@ -14255,6 +14272,12 @@ namespace TL { public StarGiftBase gift; } + /// See + [TLDef(0x31CAD303)] + public sealed partial class WebPageAttributeStarGiftCollection : WebPageAttribute + { + public DocumentBase[] icons; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -16190,11 +16213,17 @@ namespace TL public long stars; } /// See - [TLDef(0x63CBC38C)] + [TLDef(0xC39F5324)] public sealed partial class InputInvoiceStarGiftResale : InputInvoice { + public Flags flags; public string slug; public InputPeer to_id; + + [Flags] public enum Flags : uint + { + ton = 0x1, + } } /// Exported invoice deep link See @@ -17433,7 +17462,7 @@ namespace TL public override int ID => id; } /// Represents a story. See - [TLDef(0x79B26A24)] + [TLDef(0xEDF164F1)] public sealed partial class StoryItem : StoryItemBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17462,6 +17491,7 @@ namespace TL [IfFlag(3)] public StoryViews views; /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; + [IfFlag(19)] public int[] albums; [Flags] public enum Flags : uint { @@ -17499,6 +17529,8 @@ namespace TL has_fwd_from = 0x20000, /// Field has a value has_from_id = 0x40000, + /// Field has a value + has_albums = 0x80000, } /// ID of the story. @@ -20155,7 +20187,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// See - [TLDef(0xF63778AE)] + [TLDef(0x3A274D50)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20171,7 +20203,7 @@ namespace TL public int availability_issued; public int availability_total; [IfFlag(3)] public string gift_address; - [IfFlag(4)] public long resell_stars; + [IfFlag(4)] public StarsAmountBase[] resell_amount; [IfFlag(5)] public Peer released_by; [Flags] public enum Flags : uint @@ -20184,11 +20216,12 @@ namespace TL has_owner_address = 0x4, /// Field has a value has_gift_address = 0x8, - /// Field has a value - has_resell_stars = 0x10, + /// Field has a value + has_resell_amount = 0x10, /// Field has a value has_released_by = 0x20, require_premium = 0x40, + resale_ton_only = 0x80, } public override long ID => id; @@ -20697,23 +20730,25 @@ namespace TL public InputPeer peer; } - /// See + /// Total number of non-refunded Telegram Stars a user has spent on sending us messages either directly or through a channel, see here » for more info on paid messages. See [TLDef(0x1E109708)] public sealed partial class Account_PaidMessagesRevenue : IObject { + /// Amount in Stars. public long stars_amount; } - /// See Derived classes: , + /// Specifies a requirement that must be satisfied in order to contact a user. See Derived classes: , /// a value means requirementToContactEmpty public abstract partial class RequirementToContact : IObject { } - /// See + /// This user requires us to buy a Premium subscription in order to contact them. See [TLDef(0xE581E4E9)] public sealed partial class RequirementToContactPremium : RequirementToContact { } - /// See + /// This user requires us to pay the specified amount of Telegram Stars to send them a message, see here » for the full flow. See [TLDef(0xB4F67E93)] public sealed partial class RequirementToContactPaidMessages : RequirementToContact { + /// The required amount of Telegram Stars. public long stars_amount; } @@ -20958,4 +20993,47 @@ namespace TL { public StarGiftCollection[] collections; } + + /// See + [TLDef(0x9325705A)] + public sealed partial class StoryAlbum : IObject + { + public Flags flags; + public int album_id; + public string title; + [IfFlag(0)] public PhotoBase icon_photo; + [IfFlag(1)] public DocumentBase icon_video; + + [Flags] public enum Flags : uint + { + has_icon_photo = 0x1, + has_icon_video = 0x2, + } + } + + /// See + /// a value means stories.albumsNotModified + [TLDef(0xC3987A3A)] + public sealed partial class Stories_Albums : IObject + { + public long hash; + public StoryAlbum[] albums; + } + + /// See + [TLDef(0x3E0B5B6A)] + public sealed partial class SearchPostsFlood : IObject + { + public Flags flags; + public int total_daily; + public int remains; + [IfFlag(1)] public int wait_till; + public long stars_amount; + + [Flags] public enum Flags : uint + { + query_is_free = 0x1, + has_wait_till = 0x2, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index a066365..c10d6f0 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See [bots: ✓] + /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See [bots: ✓] /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel. /// The user that paid to send us messages. public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) @@ -1446,7 +1446,7 @@ namespace TL /// Allow a user to send us messages without paying if paid messages » are enabled. See [bots: ✓] /// If set and require_payment is not set, refunds the amounts the user has already paid us to send us messages (directly or via a monoforum). - /// Allow or disallow a user to send us messages without paying. + /// If set, requires the user to pay in order to send us messages (can only be used by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption).
If not set, allows the user to send us messages without paying (can be used by both monoforums and users). /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). /// The user to exempt or unexempt. public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) @@ -1483,7 +1483,8 @@ namespace TL errors = errors, }); - /// See [bots: ✓] + /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See [bots: ✓] + /// Users to check. public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact { @@ -1911,6 +1912,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { @@ -1948,6 +1950,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { @@ -1983,6 +1986,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { @@ -2496,6 +2500,7 @@ namespace TL /// Scheduled message date for scheduled messages /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendInlineBotResult(this Client client, InputPeer peer, long random_id, long query_id, string id, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool hide_via = false) => client.Invoke(new Messages_SendInlineBotResult { @@ -2945,6 +2950,7 @@ namespace TL /// Send this message as the specified peer /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. + /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. public static Task Messages_SendMultiMedia(this Client client, InputPeer peer, InputSingleMedia[] multi_media, InputReplyTo reply_to = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMultiMedia { @@ -4513,7 +4519,8 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) + /// Used for Telegram Gateway verification messages »: indicate to the server that one or more s were received by the client, if requested by the .report_delivery_until_date flag or the equivalent flag in push notifications. See Possible codes: 400 (details) + /// If set, public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -5644,14 +5651,17 @@ namespace TL /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination - public static Task Channels_SearchPosts(this Client client, string hashtag, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue) + public static Task Channels_SearchPosts(this Client client, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, string hashtag = null, string query = null, long? allow_paid_stars = null) => client.Invoke(new Channels_SearchPosts { + flags = (Channels_SearchPosts.Flags)((hashtag != null ? 0x1 : 0) | (query != null ? 0x2 : 0) | (allow_paid_stars != null ? 0x4 : 0)), hashtag = hashtag, + query = query, offset_rate = offset_rate, offset_peer = offset_peer, offset_id = offset_id, limit = limit, + allow_paid_stars = allow_paid_stars ?? default, }); /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓] @@ -5682,6 +5692,14 @@ namespace TL id = id, }); + /// See + public static Task Channels_CheckSearchPostsFlood(this Client client, string query = null) + => client.Invoke(new Channels_CheckSearchPostsFlood + { + flags = (Channels_CheckSearchPostsFlood.Flags)(query != null ? 0x1 : 0), + query = query, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -5976,7 +5994,11 @@ namespace TL duration_months = duration_months ?? default, }); - /// See [bots: ✓] Possible codes: 400 (details) + /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400 (details) + /// If set, adds the verification; otherwise removes verification. + /// Must not be set if invoked by a bot, must be set to the ID of an owned bot if invoked by a user. + /// The peer to verify + /// Custom description for the verification, the UTF-8 length limit for this field is contained in bot_verification_description_length_limit ».
If not set, Was verified by organization "organization_name" will be used as description. public static Task Bots_SetCustomVerification(this Client client, InputPeer peer, InputUserBase bot = null, string custom_description = null, bool enabled = false) => client.Invoke(new Bots_SetCustomVerification { @@ -5986,7 +6008,8 @@ namespace TL custom_description = custom_description, }); - /// See Possible codes: 400 (details) + /// Obtain a list of similarly themed bots, selected based on similarities in their subscriber bases, see here » for more info. See Possible codes: 400 (details) + /// The method will return bots related to the passed bot. public static Task Bots_GetBotRecommendations(this Client client, InputUserBase bot) => client.Invoke(new Bots_GetBotRecommendations { @@ -6480,11 +6503,11 @@ namespace TL }); /// See [bots: ✓] - public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, long resell_stars) + public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { stargift = stargift, - resell_stars = resell_stars, + resell_amount = resell_amount, }); /// See @@ -7021,7 +7044,14 @@ namespace TL file = file, }); - /// See [bots: ✓] + /// Create and optionally join a new conference call. See [bots: ✓] + /// If set, mute our microphone when joining the call (can only be used if join is set). + /// If set, our video stream is disabled (can only be used if join is set). + /// If set, also join the call, otherwise just create the call link. + /// Unique client message ID required to prevent creation of duplicate group calls. + /// Public key (can only be used if join is set). + /// Initial blockchain block (can only be used if join is set). + /// Parameters from tgcalls (can only be used if join is set). public static Task Phone_CreateConferenceCall(this Client client, int random_id, Int256? public_key = null, byte[] block = null, DataJSON params_ = null, bool muted = false, bool video_stopped = false, bool join = false) => client.Invoke(new Phone_CreateConferenceCall { @@ -7349,10 +7379,10 @@ namespace TL /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. - public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) + public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, int[] albums = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { - flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (fwd_from_id != null ? 0x40 : 0) | (fwd_from_story != null ? 0x40 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (fwd_modified ? 0x80 : 0)), + flags = (Stories_SendStory.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (period != null ? 0x8 : 0) | (media_areas != null ? 0x20 : 0) | (fwd_from_id != null ? 0x40 : 0) | (fwd_from_story != null ? 0x40 : 0) | (albums != null ? 0x100 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (fwd_modified ? 0x80 : 0)), peer = peer, media = media, media_areas = media_areas, @@ -7363,6 +7393,7 @@ namespace TL period = period ?? default, fwd_from_id = fwd_from_id, fwd_from_story = fwd_from_story ?? default, + albums = albums, }); /// Edit an uploaded story See Possible codes: 400 (details) @@ -7641,6 +7672,63 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) + => client.Invoke(new Stories_CreateAlbum + { + peer = peer, + title = title, + stories = stories, + }); + + /// See + public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) + => client.Invoke(new Stories_UpdateAlbum + { + flags = (Stories_UpdateAlbum.Flags)((title != null ? 0x1 : 0) | (delete_stories != null ? 0x2 : 0) | (add_stories != null ? 0x4 : 0) | (order != null ? 0x8 : 0)), + peer = peer, + album_id = album_id, + title = title, + delete_stories = delete_stories, + add_stories = add_stories, + order = order, + }); + + /// See + public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) + => client.Invoke(new Stories_ReorderAlbums + { + peer = peer, + order = order, + }); + + /// See + public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) + => client.Invoke(new Stories_DeleteAlbum + { + peer = peer, + album_id = album_id, + }); + + /// See + /// a null value means stories.albumsNotModified + public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) + => client.Invoke(new Stories_GetAlbums + { + peer = peer, + hash = hash, + }); + + /// See + public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) + => client.Invoke(new Stories_GetAlbumStories + { + peer = peer, + album_id = album_id, + offset = offset, + limit = limit, + }); + /// Obtains info about the boosts that were applied to a certain channel or supergroup (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel/supergroup » /// The channel/supergroup @@ -12454,14 +12542,24 @@ namespace TL.Methods public bool restricted; } - [TLDef(0xD19F987B)] + [TLDef(0xF2C4F24D)] public sealed partial class Channels_SearchPosts : IMethod { - public string hashtag; + public Flags flags; + [IfFlag(0)] public string hashtag; + [IfFlag(1)] public string query; public int offset_rate; public InputPeer offset_peer; public int offset_id; public int limit; + [IfFlag(2)] public long allow_paid_stars; + + [Flags] public enum Flags : uint + { + has_hashtag = 0x1, + has_query = 0x2, + has_allow_paid_stars = 0x4, + } } [TLDef(0x4B12327B)] @@ -12491,6 +12589,18 @@ namespace TL.Methods public int id; } + [TLDef(0x22567115)] + public sealed partial class Channels_CheckSearchPostsFlood : IMethod + { + public Flags flags; + [IfFlag(0)] public string query; + + [Flags] public enum Flags : uint + { + has_query = 0x1, + } + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13212,11 +13322,11 @@ namespace TL.Methods } } - [TLDef(0x3BAEA4E1)] + [TLDef(0xEDBE6CCB)] public sealed partial class Payments_UpdateStarGiftPrice : IMethod { public InputSavedStarGift stargift; - public long resell_stars; + public StarsAmountBase resell_amount; } [TLDef(0x1F4A0E87)] @@ -13948,7 +14058,7 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0xE4E6694B)] + [TLDef(0x737FC2EC)] public sealed partial class Stories_SendStory : IMethod { public Flags flags; @@ -13962,6 +14072,7 @@ namespace TL.Methods [IfFlag(3)] public int period; [IfFlag(6)] public InputPeer fwd_from_id; [IfFlag(6)] public int fwd_from_story; + [IfFlag(8)] public int[] albums; [Flags] public enum Flags : uint { @@ -13973,6 +14084,7 @@ namespace TL.Methods has_media_areas = 0x20, has_fwd_from_id = 0x40, fwd_modified = 0x80, + has_albums = 0x100, } } @@ -14205,6 +14317,64 @@ namespace TL.Methods } } + [TLDef(0xA36396E5)] + public sealed partial class Stories_CreateAlbum : IMethod + { + public InputPeer peer; + public string title; + public int[] stories; + } + + [TLDef(0x5E5259B6)] + public sealed partial class Stories_UpdateAlbum : IMethod + { + public Flags flags; + public InputPeer peer; + public int album_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public int[] delete_stories; + [IfFlag(2)] public int[] add_stories; + [IfFlag(3)] public int[] order; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_delete_stories = 0x2, + has_add_stories = 0x4, + has_order = 0x8, + } + } + + [TLDef(0x8535FBD9)] + public sealed partial class Stories_ReorderAlbums : IMethod + { + public InputPeer peer; + public int[] order; + } + + [TLDef(0x8D3456D0)] + public sealed partial class Stories_DeleteAlbum : IMethod + { + public InputPeer peer; + public int album_id; + } + + [TLDef(0x25B3EAC7)] + public sealed partial class Stories_GetAlbums : IMethod + { + public InputPeer peer; + public long hash; + } + + [TLDef(0xAC806D61)] + public sealed partial class Stories_GetAlbumStories : IMethod + { + public InputPeer peer; + public int album_id; + public int offset; + public int limit; + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 6745b43..3479f87 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 = 210; // fetched 25/07/2025 14:54:33 + public const int Version = 211; // fetched 31/07/2025 22:39:04 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -216,7 +216,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0x4717E8A4] = typeof(MessageActionStarGift), - [0x2E3AE60E] = typeof(MessageActionStarGiftUnique), + [0x34F762F3] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -254,7 +254,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x29DE80BE] = typeof(UserFull), + [0x7E63CE1F] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -267,7 +267,7 @@ namespace TL [0x71E094F3] = typeof(Messages_DialogsSlice), [0xF0E3E596] = typeof(Messages_DialogsNotModified), [0x8C718E87] = typeof(Messages_Messages), - [0x3A54685E] = typeof(Messages_MessagesSlice), + [0x762B263D] = typeof(Messages_MessagesSlice), [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), @@ -1008,6 +1008,7 @@ namespace TL [0x2E94C3E7] = typeof(WebPageAttributeStory), [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), + [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1128,7 +1129,7 @@ namespace TL [0x4A5F5BD9] = typeof(InputInvoiceStarGiftTransfer), [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), - [0x63CBC38C] = typeof(InputInvoiceStarGiftResale), + [0xC39F5324] = typeof(InputInvoiceStarGiftResale), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1213,7 +1214,7 @@ namespace TL [0x8D595CD6] = typeof(StoryViews), [0x51E6EE4F] = typeof(StoryItemDeleted), [0xFFADC913] = typeof(StoryItemSkipped), - [0x79B26A24] = typeof(StoryItem), + [0xEDF164F1] = typeof(StoryItem), [0x1158FE3E] = typeof(Stories_AllStoriesNotModified), [0x6EFC5E81] = typeof(Stories_AllStories), [0x63C3DD0A] = typeof(Stories_Stories), @@ -1362,7 +1363,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x00BCFF5B] = typeof(StarGift), - [0xF63778AE] = typeof(StarGiftUnique), + [0x3A274D50] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1424,6 +1425,10 @@ namespace TL [0x9D6B13B0] = typeof(StarGiftCollection), [0xA0BA4F17] = null,//Payments_StarGiftCollectionsNotModified [0x8A2932F3] = typeof(Payments_StarGiftCollections), + [0x9325705A] = typeof(StoryAlbum), + [0x564EDAEB] = null,//Stories_AlbumsNotModified + [0xC3987A3A] = typeof(Stories_Albums), + [0x3E0B5B6A] = typeof(SearchPostsFlood), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1558,6 +1563,7 @@ namespace TL [typeof(RequirementToContact)] = 0x050A9839, //requirementToContactEmpty [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified + [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index d786b10..ed47ea1 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.210 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 210 + layer.211 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 211 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From e16e39bfba401cc916b10cf2b92259ecf611dff3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 9 Aug 2025 02:43:43 +0200 Subject: [PATCH 301/336] Avoid using obsolete DataCenter info on alt-DC connect --- .github/workflows/dev.yml | 2 +- .github/workflows/release.yml | 2 +- src/Client.cs | 20 +++++++++++++++----- 3 files changed, 17 insertions(+), 7 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index a30001c..222fc7a 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -46,7 +46,7 @@ jobs: env: JSON: | { - "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "status": "success", "complete": true, "commitMessage": ${{ toJSON(env.RELEASE_NOTES) }}, "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" } run: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 42fcb35..052eafb 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -58,7 +58,7 @@ jobs: env: JSON: | { - "status": "success", "complete": true, "commitMessage": ${{ toJSON(github.event.head_commit.message) }}, + "status": "success", "complete": true, "commitMessage": ${{ toJSON(env.RELEASE_NOTES) }}, "message": "{ \"commitId\": \"${{ github.sha }}\", \"buildNumber\": \"${{ env.VERSION }}\", \"repoName\": \"${{ github.repository }}\"}" } run: | diff --git a/src/Client.cs b/src/Client.cs index f834bd2..2b302fe 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -277,9 +277,8 @@ namespace WTelegram private Session.DCSession GetOrCreateDCSession(int dcId, DcOption.Flags flags) { - if (_session.DCSessions.TryGetValue(dcId, out var dcSession) && dcSession.AuthKey != null) - if (dcSession.Client != null || dcSession.DataCenter.flags == flags) - return dcSession; // if we have already a session with this DC and we are connected or it is a perfect match, use it + if (_session.DCSessions.TryGetValue(dcId, out var dcSession) && dcSession.Client != null) + return dcSession; // we have already a connected session with this DC, use it if (dcSession == null && _session.DCSessions.TryGetValue(-dcId, out dcSession) && dcSession.AuthKey != null) { // we have already negociated an AuthKey with this DC @@ -295,9 +294,10 @@ namespace WTelegram dcId = Math.Abs(dcId); } var dcOptions = GetDcOptions(Math.Abs(dcId), flags); - var dcOption = dcOptions.FirstOrDefault() ?? throw new WTException($"Could not find adequate dc_option for DC {dcId}"); + var dcOption = dcOptions.FirstOrDefault(); dcSession ??= new(); // create new session only if not already existing - dcSession.DataCenter = dcOption; + if (dcOption != null) dcSession.DataCenter = dcOption; + else if (dcSession.DataCenter == null) throw new WTException($"Could not find adequate dc_option for DC {dcId}"); return _session.DCSessions[dcId] = dcSession; } @@ -1630,6 +1630,16 @@ namespace WTelegram got503 = true; goto retry; } + else if (code == 401 && message == "SESSION_REVOKED" && !IsMainDC) // need to renegociate alt-DC auth + { + lock (_session) + { + _session.DCSessions.Remove(_dcSession.DcID); + if (_session.MainDC != -_dcSession.DcID) _session.DCSessions.Remove(-_dcSession.DcID); + _session.Save(); + } + await DisposeAsync(); + } else if (code == 400 && message == "CONNECTION_NOT_INITED") { await InitConnection(); From 5f411d45f983bb7acd570f2cf01e0eb27ba46791 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 16 Aug 2025 13:01:43 +0200 Subject: [PATCH 302/336] API Layer 211.2: StarsTransaction flag posts_search --- src/TL.Schema.cs | 73 ++++++++++++++--- src/TL.SchemaFuncs.cs | 186 +++++++++++++++++++++--------------------- src/TL.Table.cs | 2 +- 3 files changed, 157 insertions(+), 104 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 21e4c2b..299c969 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2945,10 +2945,14 @@ namespace TL [IfFlag(1)] public TextWithEntities message; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
[IfFlag(4)] public long convert_stars; + /// If set, this gift was upgraded to a collectible gift, and the corresponding is available at the specified message ID. [IfFlag(5)] public int upgrade_msg_id; [IfFlag(8)] public long upgrade_stars; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(11)] public Peer from_id; + /// Receiver of the gift. [IfFlag(12)] public Peer peer; + /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; [Flags] public enum Flags : uint @@ -2963,10 +2967,13 @@ namespace TL converted = 0x8, /// Field has a value has_convert_stars = 0x10, + /// This gift was upgraded to a collectible gift ». upgraded = 0x20, /// Field has a value has_upgrade_stars = 0x100, + /// This gift is not available anymore because a request to refund the payment related to this gift was made, and the money was returned. refunded = 0x200, + /// If set, this gift can be upgraded to a collectible gift; can only be set for the receiver of a gift. can_upgrade = 0x400, /// Field has a value has_from_id = 0x800, @@ -2974,31 +2981,42 @@ namespace TL has_peer = 0x1000, } } - /// See + /// A gift » was upgraded to a collectible gift ». See [TLDef(0x34F762F3)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The collectible gift. public StarGiftBase gift; [IfFlag(3)] public DateTime can_export_at; + /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(4)] public long transfer_stars; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(6)] public Peer from_id; + /// Receiver of the gift. [IfFlag(7)] public Peer peer; + /// For channel gifts, ID to use in s. [IfFlag(7)] public long saved_id; [IfFlag(8)] public StarsAmountBase resale_amount; + /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(9)] public DateTime can_transfer_at; + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint { + /// If set, this collectible was upgraded » to a collectible gift from a previously received or sent (depending on the out flag of the containing ) non-collectible gift. upgrade = 0x1, + /// If set, this collectible was transferred (either to the current user or by the current user to the other user in the private chat, depending on the out flag of the containing ). transferred = 0x2, + /// If set, this gift is visible on the user or channel's profile page; can only be set for the receiver of a gift. saved = 0x4, /// Field has a value has_can_export_at = 0x8, /// Field has a value has_transfer_stars = 0x10, + /// This gift was upgraded to a collectible gift » and then re-downgraded to a regular gift because a request to refund the payment related to the upgrade was made, and the money was returned. refunded = 0x20, /// Field has a value has_from_id = 0x40, @@ -7584,7 +7602,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset

+ /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset
- telegram_story_album
- telegram_collection

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -19749,6 +19767,7 @@ namespace TL stargift_resale = 0x400000, /// Fields and have a value has_ads_proceeds_from_date = 0x800000, + posts_search = 0x1000000, } } @@ -20186,12 +20205,13 @@ namespace TL public override string Title => title; public override Peer ReleasedBy => released_by; } - /// See + /// Represents a collectible star gift, see here » for more info. See [TLDef(0x3A274D50)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Identifier of the gift. public long id; public string title; public string slug; @@ -20224,6 +20244,7 @@ namespace TL resale_ton_only = 0x80, } + /// Identifier of the gift. public override long ID => id; public override int AvailabilityTotal => availability_total; public override string Title => title; @@ -20526,45 +20547,62 @@ namespace TL public string description; } - /// See Derived classes: , , , + /// An attribute of a collectible gift ». See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } - /// See + /// The model of a collectible gift ». See [TLDef(0x39D99013)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + /// Name of the model public string name; + /// The sticker representing the upgraded gift public DocumentBase document; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// A sticker applied on the backdrop of a collectible gift » using a repeating pattern. See [TLDef(0x13ACFF19)] public sealed partial class StarGiftAttributePattern : StarGiftAttribute { + /// Name of the symbol public string name; + /// The symbol public DocumentBase document; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// The backdrop of a collectible gift ». See [TLDef(0xD93D859C)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { + /// Name of the backdrop public string name; + /// Unique ID of the backdrop public int backdrop_id; + /// Color of the center of the backdrop in RGB24 format. public int center_color; + /// Color of the edges of the backdrop in RGB24 format. public int edge_color; + /// Color of the applied on the backdrop in RGB24 format. public int pattern_color; + /// Color of the text on the backdrop in RGB24 format. public int text_color; + /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. public int rarity_permille; } - /// See + /// Info about the sender, receiver and message attached to the original gift », before it was upgraded to a collectible gift ». See [TLDef(0xE0BFF26C)] public sealed partial class StarGiftAttributeOriginalDetails : StarGiftAttribute { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Original sender of the gift, absent if the gift was private. [IfFlag(0)] public Peer sender_id; + /// Original receiver of the gift. public Peer recipient_id; + /// When was the gift sent. public DateTime date; + /// Original message attached to the gift, if present. [IfFlag(1)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -20576,10 +20614,11 @@ namespace TL } } - /// See + /// A preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See [TLDef(0x167BD90B)] public sealed partial class Payments_StarGiftUpgradePreview : IObject { + /// Possible gift attributes public StarGiftAttribute[] sample_attributes; } @@ -20690,17 +20729,20 @@ namespace TL /// See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } - /// See + /// A gift received in a private chat with another user. See [TLDef(0x69279795)] public sealed partial class InputSavedStarGiftUser : InputSavedStarGift { + /// ID of the with the with the gift. public int msg_id; } - /// See + /// A gift received by a channel we own. See [TLDef(0xF101AA7F)] public sealed partial class InputSavedStarGiftChat : InputSavedStarGift { + /// The channel. public InputPeer peer; + /// ID of the gift, must be the saved_id of a /. public long saved_id; } /// See @@ -20957,6 +20999,7 @@ namespace TL [TLDef(0x1B0E4F07)] public sealed partial class StarsRating : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int level; public long current_level_stars; @@ -20965,6 +21008,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_next_level_stars = 0x1, } } @@ -20973,6 +21017,7 @@ namespace TL [TLDef(0x9D6B13B0)] public sealed partial class StarGiftCollection : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int collection_id; public string title; @@ -20982,6 +21027,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon = 0x1, } } @@ -20998,6 +21044,7 @@ namespace TL [TLDef(0x9325705A)] public sealed partial class StoryAlbum : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int album_id; public string title; @@ -21006,7 +21053,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_icon_photo = 0x1, + /// Field has a value has_icon_video = 0x2, } } @@ -21024,6 +21073,7 @@ namespace TL [TLDef(0x3E0B5B6A)] public sealed partial class SearchPostsFlood : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int total_daily; public int remains; @@ -21033,6 +21083,7 @@ namespace TL [Flags] public enum Flags : uint { query_is_free = 0x1, + /// Field has a value has_wait_till = 0x2, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c10d6f0..9ea3dd5 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: 400,403,406 (details) + /// Invoke the specified query using the specified API layer See Possible codes: -504,400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -212,7 +212,7 @@ namespace TL bytes = bytes, }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: 400 (details) + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: -504,400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents @@ -298,7 +298,7 @@ namespace TL except_auth_keys = except_auth_keys, }); - /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: -504,400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user @@ -452,7 +452,7 @@ namespace TL about = about, }); - /// Updates online user status. See + /// Updates online user status. See Possible codes: -504 (details) /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1425,7 +1425,7 @@ namespace TL settings = settings, }); - /// See [bots: ✓] + /// See /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1433,7 +1433,7 @@ namespace TL hash = hash, }); - /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See [bots: ✓] + /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See Possible codes: 400 (details) /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel. /// The user that paid to send us messages. public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) @@ -1444,9 +1444,9 @@ namespace TL user_id = user_id, }); - /// Allow a user to send us messages without paying if paid messages » are enabled. See [bots: ✓] + /// Allow a user to send us messages without paying if paid messages » are enabled. See Possible codes: 400 (details) /// If set and require_payment is not set, refunds the amounts the user has already paid us to send us messages (directly or via a monoforum). - /// If set, requires the user to pay in order to send us messages (can only be used by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption).
If not set, allows the user to send us messages without paying (can be used by both monoforums and users). + /// If set, requires the user to pay in order to send us messages.
Can only be set by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption.
If not set, allows the user to send us messages without paying (can be unset by both monoforums and users). /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). /// The user to exempt or unexempt. public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) @@ -1457,7 +1457,7 @@ namespace TL user_id = user_id, }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1465,7 +1465,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: -504,400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1483,7 +1483,7 @@ namespace TL errors = errors, }); - /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See [bots: ✓] + /// Check whether we can write to the specified users, used to implement bulk checks for Premium-only messages » and paid messages ». See /// Users to check. public static Task Users_GetRequirementsToContact(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetRequirementsToContact @@ -1580,7 +1580,7 @@ namespace TL limit = limit, }); - /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: -504,400 (details) /// @username to resolve /// Referrer ID from referral links ». public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) @@ -1740,7 +1740,7 @@ namespace TL { }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -1748,7 +1748,7 @@ namespace TL 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: ✓]
+ /// 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: ✓] Possible codes: -504 (details)
/// Message ID list public static Task Messages_GetMessages(this Client client, params InputMessage[] id) => client.Invoke(new Messages_GetMessages @@ -1756,7 +1756,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: 400,403 (details) + /// Returns the current user dialog list. See Possible codes: -504,400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1776,7 +1776,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: -504,400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1880,7 +1880,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: -504,400,403,406 (details) /// Target user or group /// Topic ID /// Type of action @@ -1893,7 +1893,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,404,406,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: -504,400,403,404,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1931,7 +1931,7 @@ namespace TL suggested_post = suggested_post, }); - /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: -504,400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -2095,7 +2095,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,406,500 (details) + /// Creates a new chat. See Possible codes: 400,403,500 (details) /// List of user IDs to be invited /// Chat name /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. @@ -2118,7 +2118,7 @@ namespace TL random_length = random_length, }); - /// Sends a request to start a secret chat to the user. See Possible codes: 400 (details) + /// Sends a request to start a secret chat to the user. See Possible codes: 400,403 (details) /// User ID /// Unique client request ID required to prevent resending. This also doubles as the chat ID. /// A = g ^ a mod p, see Wikipedia @@ -2288,7 +2288,7 @@ namespace TL subscription_pricing = subscription_pricing, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: -504,400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2347,7 +2347,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: -504,400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2602,7 +2602,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: 400,406 (details) + /// Get dialog info of specified peers See Possible codes: -504,400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2846,7 +2846,7 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: -504,400,403 (details) /// Whether the media will be used only in the specified business connection », and not directly by the bot. /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » @@ -2891,7 +2891,7 @@ namespace TL unfave = unfave, }); - /// Get unread messages where we were mentioned See Possible codes: 400 (details) + /// Get unread messages where we were mentioned See Possible codes: -504,400 (details) /// Peer where to look for mentions /// If set, considers only messages within the specified forum topic /// Offsets for pagination, for more info click here @@ -2912,7 +2912,7 @@ namespace TL min_id = min_id, }); - /// Mark mentions as read See Possible codes: 400 (details) + /// Mark mentions as read See Possible codes: -504,400 (details) /// Dialog /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) @@ -3692,7 +3692,7 @@ namespace TL reaction = reaction, }); - /// Translate a given text. See Possible codes: 400,500 (details) + /// Translate a given text. See Possible codes: 400,406,500 (details) /// If the text is a chat message, the peer ID /// A list of message IDs to translate /// A list of styled messages to translate @@ -4192,7 +4192,7 @@ namespace TL order = order, }); - /// Fetch the full list of saved message tags created by the user. See + /// Fetch the full list of saved message tags created by the user. See Possible codes: 400 (details) /// If set, returns tags only used in the specified saved message dialog. /// Hash used for caching, for more info click here. /// a null value means messages.savedReactionTagsNotModified @@ -4436,7 +4436,7 @@ namespace TL { }); - /// Mark a specific sponsored message » as read See + /// Mark a specific sponsored message » as read See Possible codes: -504 (details) /// The ad's unique ID. public static Task Messages_ViewSponsoredMessage(this Client client, byte[] random_id) => client.Invoke(new Messages_ViewSponsoredMessage @@ -4465,7 +4465,7 @@ namespace TL option = option, }); - /// Get a list of sponsored messages for a peer, see here » for more info. See + /// Get a list of sponsored messages for a peer, see here » for more info. See Possible codes: 400 (details) /// The currently open channel/bot. /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) @@ -4529,7 +4529,7 @@ namespace TL id = id, }); - /// See [bots: ✓] + /// See public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4538,7 +4538,7 @@ namespace TL ids = ids, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4547,7 +4547,7 @@ namespace TL max_id = max_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4557,7 +4557,7 @@ namespace TL incompleted = incompleted, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4566,7 +4566,7 @@ namespace TL list = list, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -4577,13 +4577,13 @@ namespace TL reject_comment = reject_comment, }); - /// Returns a current state of updates. See [bots: ✓] + /// Returns a current state of updates. See [bots: ✓] Possible codes: -504 (details) public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState { }); - /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) + /// Get new updates. See [bots: ✓] Possible codes: -504,400,403,500 (details) /// PTS, see updates. /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 @@ -4602,7 +4602,7 @@ namespace TL qts_limit = qts_limit ?? default, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: -504,400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -4742,7 +4742,7 @@ namespace TL limit = limit, }); - /// Download a CDN file. See Possible codes: 400 (details) + /// Download a CDN file. See Possible codes: 400,404 (details) /// File token /// Offset of chunk to download /// Length of chunk to download @@ -4764,7 +4764,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: 400 (details) + /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: -504,400 (details) /// File /// Offset from which to start getting hashes public static Task Upload_GetCdnFileHashes(this Client client, byte[] file_token, long offset = default) @@ -4784,7 +4784,7 @@ namespace TL offset = offset, }); - /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) + /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: -504,400,403 (details) public static Task Help_GetConfig(this Client client) => client.Invoke(new Help_GetConfig { @@ -4827,7 +4827,7 @@ namespace TL message = message, }); - /// Get configuration for CDN file downloads. See [bots: ✓] + /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: -504 (details) public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { @@ -4986,7 +4986,7 @@ namespace TL hash = hash, }); - /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) + /// Mark channel/supergroup history as read See Possible codes: -504,400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -4996,7 +4996,7 @@ namespace TL max_id = max_id, }); - /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406 (details) + /// Delete messages in a channel/supergroup See [bots: ✓] Possible codes: 400,403,406,420 (details) /// Channel/supergroup /// IDs of messages to delete public static Task Channels_DeleteMessages(this Client client, InputChannelBase channel, params int[] id) @@ -5018,7 +5018,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: -504,400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -5028,7 +5028,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: -504,400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -5055,7 +5055,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: -504,400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -5063,7 +5063,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: -504,400,403,406 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -5071,7 +5071,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) + /// Create a supergroup/channel. See Possible codes: 400,403,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -5146,7 +5146,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: 400,406 (details) + /// Join a channel/supergroup See Possible codes: -504,400,406,420 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -5289,7 +5289,7 @@ namespace TL enabled = enabled, }); - /// Get a list of channels/supergroups we left, requires a takeout session, see here » for more info. See Possible codes: 403 (details) + /// Get a list of channels/supergroups we left, requires a takeout session, see here » for more info. See Possible codes: 400,403 (details) /// Offset for pagination public static Task Channels_GetLeftChannels(this Client client, int offset = default) => client.Invoke(new Channels_GetLeftChannels @@ -5520,7 +5520,7 @@ namespace TL pinned = pinned, }); - /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400 (details) + /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) /// Forum /// Topic ID public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) @@ -5596,7 +5596,7 @@ namespace TL enabled = enabled, }); - /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) + /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: -504,400 (details) /// The method will return channels related to the passed channel. If not set, the method will returns channels related to channels the user has joined. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations @@ -5645,7 +5645,7 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See + /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See Possible codes: 420 (details) /// The hashtag to search, without the # character. /// Initially 0, then set to the next_rate parameter of messages.messagesSlice /// Offsets for pagination, for more info click here @@ -5664,7 +5664,7 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Enable or disable paid messages » in this supergroup or monoforum. See [bots: ✓] + /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) /// Only usable for channels, enables or disables the associated monoforum aka direct messages. /// Pass the supergroup ID for supergroups and the ID of the channel to modify the setting in the associated monoforum. /// Specifies the required amount of Telegram Stars users must pay to send messages to the supergroup or monoforum. @@ -5676,7 +5676,7 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5684,7 +5684,7 @@ namespace TL enabled = enabled, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -6016,7 +6016,7 @@ namespace TL bot = bot, }); - /// Get a payment form See Possible codes: 400 (details) + /// Get a payment form See Possible codes: 400,403,406 (details) /// Invoice /// Theme parameters » public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) @@ -6172,7 +6172,7 @@ namespace TL { }); - /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400 (details) + /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400,403 (details) /// Peer of which to get the balance. public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus @@ -6199,7 +6199,7 @@ namespace TL limit = limit, }); - /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400 (details) + /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400,403,406 (details) /// Payment form ID /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) @@ -6409,7 +6409,8 @@ namespace TL link = link, }); - /// See + /// Obtain a preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See Possible codes: 400 (details) + /// The gift to upgrade. public static Task Payments_GetStarGiftUpgradePreview(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftUpgradePreview { @@ -6432,14 +6433,14 @@ namespace TL to_id = to_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) => client.Invoke(new Payments_GetSavedStarGifts @@ -6451,14 +6452,14 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6466,7 +6467,7 @@ namespace TL password = password, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6474,7 +6475,7 @@ namespace TL peer = peer, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6482,14 +6483,14 @@ namespace TL stargift = stargift, }); - /// See [bots: ✓] + /// See Possible codes: 406 (details) public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See [bots: ✓] + /// See Possible codes: -504,400 (details) /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -6502,7 +6503,7 @@ namespace TL limit = limit, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6510,7 +6511,7 @@ namespace TL resell_amount = resell_amount, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CreateStarGiftCollection { @@ -6519,7 +6520,7 @@ namespace TL stargift = stargift, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_UpdateStarGiftCollection(this Client client, InputPeer peer, int collection_id, string title = null, InputSavedStarGift[] delete_stargift = null, InputSavedStarGift[] add_stargift = null, InputSavedStarGift[] order = null) => client.Invoke(new Payments_UpdateStarGiftCollection { @@ -6532,7 +6533,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Payments_ReorderStarGiftCollections { @@ -6540,7 +6541,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id) => client.Invoke(new Payments_DeleteStarGiftCollection { @@ -6548,7 +6549,7 @@ namespace TL collection_id = collection_id, }); - /// See + /// See Possible codes: 400 (details) /// a null value means payments.starGiftCollectionsNotModified public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Payments_GetStarGiftCollections @@ -6693,7 +6694,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403 (details) + /// Start a telegram phone call See Possible codes: 400,403,500 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -7044,7 +7045,7 @@ namespace TL file = file, }); - /// Create and optionally join a new conference call. See [bots: ✓] + /// Create and optionally join a new conference call. See /// If set, mute our microphone when joining the call (can only be used if join is set). /// If set, our video stream is disabled (can only be used if join is set). /// If set, also join the call, otherwise just create the call link. @@ -7062,7 +7063,7 @@ namespace TL params_ = params_, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -7072,7 +7073,7 @@ namespace TL block = block, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -7080,7 +7081,7 @@ namespace TL block = block, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7089,14 +7090,14 @@ namespace TL user_id = user_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See [bots: ✓] + /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks @@ -7417,7 +7418,7 @@ namespace TL privacy_rules = privacy_rules, }); - /// Deletes some posted stories. See Possible codes: 400 (details) + /// Deletes some posted stories. See Possible codes: 400,403 (details) /// Channel/user from where to delete stories. /// IDs of stories to delete. public static Task Stories_DeleteStories(this Client client, InputPeer peer, params int[] id) @@ -7532,7 +7533,7 @@ namespace TL limit = limit, }); - /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: 400 (details) + /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: -504,400 (details) /// Peer whose stories should be fetched /// Story IDs public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) @@ -7672,7 +7673,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) => client.Invoke(new Stories_CreateAlbum { @@ -7681,7 +7682,7 @@ namespace TL stories = stories, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) => client.Invoke(new Stories_UpdateAlbum { @@ -7694,7 +7695,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Stories_ReorderAlbums { @@ -7702,7 +7703,7 @@ namespace TL order = order, }); - /// See + /// See Possible codes: 400 (details) public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) => client.Invoke(new Stories_DeleteAlbum { @@ -7710,7 +7711,7 @@ namespace TL album_id = album_id, }); - /// See + /// See Possible codes: 400 (details) /// a null value means stories.albumsNotModified public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Stories_GetAlbums @@ -7719,7 +7720,8 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetAlbumStories { @@ -7760,7 +7762,7 @@ namespace TL peer = peer, }); - /// Gets the current number of boosts of a channel/supergroup. See Possible codes: 400 (details) + /// Gets the current number of boosts of a channel/supergroup. See Possible codes: -504,400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3479f87..3be9440 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 = 211; // fetched 31/07/2025 22:39:04 + public const int Version = 211; // fetched 16/08/2025 00:21:53 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; From a9bbdb9fc47fccdb3108cab6e23a50fa5824a80c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:06:30 +0200 Subject: [PATCH 303/336] Try to improve diagnostics/handling of weird email login case (#331) --- src/Client.Helpers.cs | 3 ++- src/Client.cs | 5 ++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index a26210d..bdfb48f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -36,9 +36,10 @@ namespace WTelegram var client = await GetClientForDC(-_dcSession.DcID, true); using (stream) { + const long SMALL_FILE_MAX_SIZE = 10 << 20; bool hasLength = stream.CanSeek; long transmitted = 0, length = hasLength ? stream.Length : -1; - bool isBig = !hasLength || length >= 10 * 1024 * 1024; + bool isBig = !hasLength || length > SMALL_FILE_MAX_SIZE; int file_total_parts = hasLength ? (int)((length - 1) / FilePartSize) + 1 : -1; long file_id = Helpers.RandomLong(); int file_part = 0, read; diff --git a/src/Client.cs b/src/Client.cs index 2b302fe..08b6207 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1238,10 +1238,13 @@ namespace WTelegram if (verified is Account_EmailVerifiedLogin verifiedLogin) // (it should always be) sentCodeBase = verifiedLogin.sent_code; } + RaiseUpdates(sentCodeBase); } resent: if (sentCodeBase is Auth_SentCodeSuccess success) authorization = success.authorization; + else if (sentCodeBase is Auth_SentCodePaymentRequired paymentRequired) + throw new WTException("Auth_SentCodePaymentRequired unsupported"); else if (sentCodeBase is Auth_SentCode sentCode) { phone_code_hash = sentCode.phone_code_hash; @@ -1410,7 +1413,7 @@ namespace WTelegram public User LoginAlreadyDone(Auth_AuthorizationBase authorization) { if (authorization is not Auth_Authorization { user: User self }) - throw new WTException("Failed to get Authorization: " + authorization.GetType().Name); + throw new WTException("Failed to get Authorization: " + authorization?.GetType().Name); _session.UserId = _dcSession.UserId = self.id; lock (_session) _session.Save(); RaiseUpdates(self); From eb52dccfa75387445c9743e65e07ffa3c0159644 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 27 Aug 2025 00:18:34 +0200 Subject: [PATCH 304/336] Helper OpenChat to monitor a group/channel without joining (#333) --- src/Client.Helpers.cs | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index bdfb48f..3cc888f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -13,7 +13,6 @@ namespace WTelegram { partial class Client { - #region Client TL Helpers /// Used to indicate progression of file download/upload /// transmitted bytes /// total size of file in bytes, or 0 if unknown @@ -910,6 +909,28 @@ namespace WTelegram } return chat; } - #endregion + + /// Receive updates for a given group/channel until cancellation is requested. + /// Group/channel to monitor without joining + /// Cancel token to stop the monitoring + /// After cancelling, you may still receive updates for a few more seconds + public async void OpenChat(InputChannel channel, CancellationToken ct) + { + var cts = CancellationTokenSource.CreateLinkedTokenSource(_cts.Token, ct); + try + { + while (!cts.IsCancellationRequested) + { + var diff = await this.Updates_GetChannelDifference(channel, null, 1, 1, true); + var timeout = diff.Timeout * 1000; + await Task.Delay(timeout != 0 ? timeout : 30000, cts.Token); + } + } + catch (Exception ex) + { + if (!cts.IsCancellationRequested) + Console.WriteLine($"An exception occured for OpenChat {channel.channel_id}: {ex.Message}"); + } + } } } From 253249e06aec175aac1f4dd3223272f09f782718 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 1 Sep 2025 13:37:41 +0200 Subject: [PATCH 305/336] API Layer 214: ChatTheme, main ProfileTab, user saved music, some StarGift & Store Payment stuff... (that might not be the most recent API layer. check https://patreon.com/wizou for the latest layers) --- README.md | 2 +- src/TL.Schema.cs | 233 ++++++++++++++++++++++++++++++++++--- src/TL.SchemaFuncs.cs | 159 +++++++++++++++++++++++-- src/TL.Table.cs | 42 +++++-- src/WTelegramClient.csproj | 4 +- 5 files changed, 398 insertions(+), 42 deletions(-) diff --git a/README.md b/README.md index 8bb243f..d085aeb 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-211-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-214-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 299c969..08737fd 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1402,7 +1402,7 @@ namespace TL public override int ReactionsLimit => reactions_limit; } /// Full info about a channel, supergroup or gigagroup. See - [TLDef(0xE07429DE)] + [TLDef(0xE4E0B29D)] public sealed partial class ChannelFull : ChatFullBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1495,6 +1495,7 @@ namespace TL [IfFlag(50)] public int stargifts_count; /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; + [IfFlag(54)] public ProfileTab main_tab; [Flags] public enum Flags : uint { @@ -1606,6 +1607,8 @@ namespace TL paid_messages_available = 0x100000, /// Field has a value has_send_paid_messages_stars = 0x200000, + /// Field has a value + has_main_tab = 0x400000, } /// ID of the channel @@ -2646,11 +2649,10 @@ namespace TL public DateTime schedule_date; } /// The chat theme was changed See - [TLDef(0xAA786345)] + [TLDef(0xB91BBD3A)] public sealed partial class MessageActionSetChatTheme : MessageAction { - /// The emoji that identifies a chat theme - public string emoticon; + public ChatThemeBase theme; } /// A user was accepted into the group by an admin See [TLDef(0xEBBCA3CB)] @@ -2934,7 +2936,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0x4717E8A4)] + [TLDef(0xF24DE7FA)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2954,6 +2956,8 @@ namespace TL [IfFlag(12)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; + [IfFlag(14)] public string prepaid_upgrade_hash; + [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint { @@ -2979,6 +2983,12 @@ namespace TL has_from_id = 0x800, /// Fields and have a value has_peer = 0x1000, + prepaid_upgrade = 0x2000, + /// Field has a value + has_prepaid_upgrade_hash = 0x4000, + /// Field has a value + has_gift_msg_id = 0x8000, + upgrade_separate = 0x10000, } } /// A gift » was upgraded to a collectible gift ». See @@ -3028,6 +3038,7 @@ namespace TL has_can_transfer_at = 0x200, /// Field has a value has_can_resell_at = 0x400, + prepaid_upgrade = 0x800, } } /// See @@ -3422,11 +3433,13 @@ namespace TL public Auth_AuthorizationBase authorization; } /// See - [TLDef(0xD7CEF980)] + [TLDef(0xD7A2FCF9)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { public string store_product; public string phone_code_hash; + public string support_email_address; + public string support_email_subject; } /// Object contains info on user authorization. See Derived classes: , @@ -3769,7 +3782,7 @@ namespace TL } /// Extended user info See - [TLDef(0x7E63CE1F)] + [TLDef(0xC577B5AD)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3800,8 +3813,7 @@ namespace TL [IfFlag(11)] public int folder_id; /// Time To Live of all messages in this chat; once a message is this many seconds old, it must be deleted. [IfFlag(14)] public int ttl_period; - /// Emoji associated with chat theme - [IfFlag(15)] public string theme_emoticon; + [IfFlag(15)] public ChatThemeBase theme; /// Anonymized text to be shown instead of the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; /// A suggested set of administrator rights for the bot, to be shown when adding the bot as admin to a group, see here for more info on how to handle them ». @@ -3839,6 +3851,8 @@ namespace TL [IfFlag(49)] public StarsRating stars_rating; [IfFlag(50)] public StarsRating stars_my_pending_rating; [IfFlag(50)] public DateTime stars_my_pending_rating_date; + [IfFlag(52)] public ProfileTab main_tab; + [IfFlag(53)] public DocumentBase saved_music; [Flags] public enum Flags : uint { @@ -3866,8 +3880,8 @@ namespace TL video_calls_available = 0x2000, /// Field has a value has_ttl_period = 0x4000, - /// Field has a value - has_theme_emoticon = 0x8000, + /// Field has a value + has_theme = 0x8000, /// Field has a value has_private_forward_name = 0x10000, /// Field has a value @@ -3935,6 +3949,10 @@ namespace TL has_stars_rating = 0x20000, /// Fields and have a value has_stars_my_pending_rating = 0x40000, + /// Field has a value + has_main_tab = 0x100000, + /// Field has a value + has_saved_music = 0x200000, } } @@ -15534,6 +15552,42 @@ namespace TL [TLDef(0xE926D63E)] public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } + /// See + public abstract partial class ChatThemeBase : IObject { } + /// See + [TLDef(0xC3DFFC04)] + public sealed partial class ChatTheme : ChatThemeBase + { + public string emoticon; + } + /// See + [TLDef(0x3458F9C8)] + public sealed partial class ChatThemeUniqueGift : ChatThemeBase + { + public StarGiftBase gift; + public ThemeSettings[] theme_settings; + } + + /// See + /// a value means account.chatThemesNotModified + [TLDef(0x16484857)] + public sealed partial class Account_ChatThemes : IObject, IPeerResolver + { + public Flags flags; + public long hash; + public ChatThemeBase[] themes; + public Dictionary chats; + public Dictionary users; + [IfFlag(0)] public int next_offset; + + [Flags] public enum Flags : uint + { + has_next_offset = 0x1, + } + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + /// A sponsored message. See [TLDef(0x7DBF8673)] public sealed partial class SponsoredMessage : IObject @@ -16243,6 +16297,13 @@ namespace TL ton = 0x1, } } + /// See + [TLDef(0x9A0B48B8)] + public sealed partial class InputInvoiceStarGiftPrepaidUpgrade : InputInvoice + { + public InputPeer peer; + public string hash; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -16385,15 +16446,23 @@ namespace TL } } /// Used to top up the Telegram Stars balance of the current account. See - [TLDef(0xDDDD0F56)] + [TLDef(0xF9A2A6CB)] public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { + public Flags flags; /// Amount of stars to topup public long stars; /// Three-letter ISO 4217 currency code public string currency; /// Total price 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 amount; + [IfFlag(0)] public InputPeer spend_purpose_peer; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_spend_purpose_peer = 0x1, + } } /// Used to gift Telegram Stars to a friend. See [TLDef(0x1D741EF7)] @@ -19768,6 +19837,7 @@ namespace TL /// Fields and have a value has_ads_proceeds_from_date = 0x800000, posts_search = 0x1000000, + stargift_prepaid_upgrade = 0x2000000, } } @@ -20149,7 +20219,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x00BCFF5B)] + [TLDef(0x80AC53C3)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20177,6 +20247,7 @@ namespace TL [IfFlag(6)] public Peer released_by; [IfFlag(8)] public int per_user_total; [IfFlag(8)] public int per_user_remains; + [IfFlag(9)] public DateTime locked_until_date; [Flags] public enum Flags : uint { @@ -20196,6 +20267,8 @@ namespace TL has_released_by = 0x40, require_premium = 0x80, limited_per_user = 0x100, + /// Field has a value + has_locked_until_date = 0x200, } /// Identifier of the gift @@ -20206,13 +20279,14 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x3A274D50)] + [TLDef(0x1BEFE865)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the gift. public long id; + public long gift_id; public string title; public string slug; public int num; @@ -20225,6 +20299,9 @@ namespace TL [IfFlag(3)] public string gift_address; [IfFlag(4)] public StarsAmountBase[] resell_amount; [IfFlag(5)] public Peer released_by; + [IfFlag(8)] public long value_amount; + [IfFlag(8)] public string value_currency; + [IfFlag(10)] public Peer theme_peer; [Flags] public enum Flags : uint { @@ -20242,6 +20319,11 @@ namespace TL has_released_by = 0x20, require_premium = 0x40, resale_ton_only = 0x80, + /// Fields and have a value + has_value_amount = 0x100, + theme_available = 0x200, + /// Field has a value + has_theme_peer = 0x400, } /// Identifier of the gift. @@ -20636,23 +20718,29 @@ namespace TL } /// See - [TLDef(0xCAA2F60B)] - public sealed partial class Payments_UniqueStarGift : IObject + [TLDef(0x416C56E8)] + public sealed partial class Payments_UniqueStarGift : IObject, IPeerResolver { public StarGiftBase gift; + public Dictionary chats; public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0xB53E8B21)] - public sealed partial class Messages_WebPagePreview : IObject + [TLDef(0x8C9A88AC)] + public sealed partial class Messages_WebPagePreview : IObject, IPeerResolver { public MessageMedia media; + public Dictionary chats; public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0x1EA646DF)] + [TLDef(0x19A9B572)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20670,6 +20758,7 @@ namespace TL [IfFlag(13)] public DateTime can_transfer_at; [IfFlag(14)] public DateTime can_resell_at; [IfFlag(15)] public int[] collection_id; + [IfFlag(16)] public string prepaid_upgrade_hash; [Flags] public enum Flags : uint { @@ -20700,6 +20789,9 @@ namespace TL has_can_resell_at = 0x4000, /// Field has a value has_collection_id = 0x8000, + /// Field has a value + has_prepaid_upgrade_hash = 0x10000, + upgrade_separate = 0x20000, } } @@ -21087,4 +21179,107 @@ namespace TL has_wait_till = 0x2, } } + + /// See + [TLDef(0x512FE446)] + public sealed partial class Payments_UniqueStarGiftValueInfo : IObject + { + public Flags flags; + public string currency; + public long value; + public DateTime initial_sale_date; + public long initial_sale_stars; + public long initial_sale_price; + [IfFlag(0)] public DateTime last_sale_date; + [IfFlag(0)] public long last_sale_price; + [IfFlag(2)] public long floor_price; + [IfFlag(3)] public long average_price; + [IfFlag(4)] public int listed_count; + [IfFlag(5)] public int fragment_listed_count; + [IfFlag(5)] public string fragment_listed_url; + + [Flags] public enum Flags : uint + { + has_last_sale_date = 0x1, + last_sale_on_fragment = 0x2, + has_floor_price = 0x4, + has_average_price = 0x8, + has_listed_count = 0x10, + has_fragment_listed_count = 0x20, + value_is_average = 0x40, + } + } + + /// See + public enum ProfileTab : uint + { + ///See + Posts = 0xB98CD696, + ///See + Gifts = 0x4D4BD46A, + ///See + Media = 0x72C64955, + ///See + Files = 0xAB339C00, + ///See + Music = 0x9F27D26E, + ///See + Voice = 0xE477092E, + ///See + Links = 0xD3656499, + ///See + Gifs = 0xA2C0F695, + } + + /// See + public abstract partial class Users_SavedMusicBase : IObject { } + /// See + [TLDef(0xE3878AA4)] + public sealed partial class Users_SavedMusicNotModified : Users_SavedMusicBase + { + public int count; + } + /// See + [TLDef(0x34A2F297)] + public sealed partial class Users_SavedMusic : Users_SavedMusicBase + { + public int count; + public DocumentBase[] documents; + } + + /// See + /// a value means account.savedMusicIdsNotModified + [TLDef(0x998D6636)] + public sealed partial class Account_SavedMusicIds : IObject + { + public long[] ids; + } + + /// See + public abstract partial class Payments_CheckCanSendGiftResult : IObject { } + /// See + [TLDef(0x374FA7AD)] + public sealed partial class Payments_CheckCanSendGiftResultOk : Payments_CheckCanSendGiftResult { } + /// See + [TLDef(0xD5E58274)] + public sealed partial class Payments_CheckCanSendGiftResultFail : Payments_CheckCanSendGiftResult + { + public TextWithEntities reason; + } + + /// See + /// a value means inputChatThemeEmpty + public abstract partial class InputChatThemeBase : IObject { } + /// See + [TLDef(0xC93DE95C)] + public sealed partial class InputChatTheme : InputChatThemeBase + { + public string emoticon; + } + /// See + [TLDef(0x87E5DFE4)] + public sealed partial class InputChatThemeUniqueGift : InputChatThemeBase + { + public string slug; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9ea3dd5..804263a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -1457,6 +1457,40 @@ namespace TL user_id = user_id, }); + /// See + public static Task Account_SetMainProfileTab(this Client client, ProfileTab tab) + => client.Invoke(new Account_SetMainProfileTab + { + tab = tab, + }); + + /// See + public static Task Account_SaveMusic(this Client client, InputDocument id, InputDocument after_id = null, bool unsave = false) + => client.Invoke(new Account_SaveMusic + { + flags = (Account_SaveMusic.Flags)((after_id != null ? 0x2 : 0) | (unsave ? 0x1 : 0)), + id = id, + after_id = after_id, + }); + + /// See + /// a null value means account.savedMusicIdsNotModified + public static Task Account_GetSavedMusicIds(this Client client, long hash = default) + => client.Invoke(new Account_GetSavedMusicIds + { + hash = hash, + }); + + /// See + /// a null value means account.chatThemesNotModified + public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Account_GetUniqueGiftChatThemes + { + offset = offset, + limit = limit, + hash = hash, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -1491,6 +1525,24 @@ namespace TL id = id, }); + /// See + public static Task Users_GetSavedMusic(this Client client, InputUserBase id, int offset = default, int limit = int.MaxValue, long hash = default) + => client.Invoke(new Users_GetSavedMusic + { + id = id, + offset = offset, + limit = limit, + hash = hash, + }); + + /// See + public static Task Users_GetSavedMusicByID(this Client client, InputUserBase id, params InputDocument[] documents) + => client.Invoke(new Users_GetSavedMusicByID + { + id = id, + documents = documents, + }); + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash used for caching, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -3522,12 +3574,11 @@ namespace TL /// Change the chat theme of a certain chat See Possible codes: 400 (details) /// Private chat where to change theme - /// Emoji, identifying a specific chat theme; a list of chat themes can be fetched using Account_GetChatThemes - public static Task Messages_SetChatTheme(this Client client, InputPeer peer, string emoticon) + public static Task Messages_SetChatTheme(this Client client, InputPeer peer, InputChatThemeBase theme) => client.Invoke(new Messages_SetChatTheme { peer = peer, - emoticon = emoticon, + theme = theme, }); /// Get which users read a specific message: only available for groups and supergroups with less than chat_read_mark_size_threshold members, read receipts will be stored for chat_read_mark_expire_period seconds after the message was sent, see client configuration for more info ». See Possible codes: 400 (details) @@ -5700,6 +5751,14 @@ namespace TL query = query, }); + /// See + public static Task Channels_SetMainProfileTab(this Client client, InputChannelBase channel, ProfileTab tab) + => client.Invoke(new Channels_SetMainProfileTab + { + channel = channel, + tab = tab, + }); + /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) /// The method name /// JSON-serialized method parameters @@ -6442,10 +6501,10 @@ namespace TL /// See Possible codes: 400 (details) /// Maximum number of results to return, see pagination - public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_limited = false, bool exclude_unique = false, bool sort_by_value = false) + public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false) => client.Invoke(new Payments_GetSavedStarGifts { - flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_limited ? 0x8 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0)), + flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0)), peer = peer, collection_id = collection_id ?? default, offset = offset, @@ -6558,6 +6617,20 @@ namespace TL hash = hash, }); + /// See + public static Task Payments_GetUniqueStarGiftValueInfo(this Client client, string slug) + => client.Invoke(new Payments_GetUniqueStarGiftValueInfo + { + slug = slug, + }); + + /// See + public static Task Payments_CheckCanSendGift(this Client client, long gift_id) + => client.Invoke(new Payments_CheckCanSendGift + { + gift_id = gift_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -9001,6 +9074,40 @@ namespace TL.Methods } } + [TLDef(0x5DEE78B0)] + public sealed partial class Account_SetMainProfileTab : IMethod + { + public ProfileTab tab; + } + + [TLDef(0xB26732A9)] + public sealed partial class Account_SaveMusic : IMethod + { + public Flags flags; + public InputDocument id; + [IfFlag(1)] public InputDocument after_id; + + [Flags] public enum Flags : uint + { + unsave = 0x1, + has_after_id = 0x2, + } + } + + [TLDef(0xE09D5FAF)] + public sealed partial class Account_GetSavedMusicIds : IMethod + { + public long hash; + } + + [TLDef(0xFE74EF9F)] + public sealed partial class Account_GetUniqueGiftChatThemes : IMethod + { + public int offset; + public int limit; + public long hash; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9026,6 +9133,22 @@ namespace TL.Methods public InputUserBase[] id; } + [TLDef(0x788D7FE3)] + public sealed partial class Users_GetSavedMusic : IMethod + { + public InputUserBase id; + public int offset; + public int limit; + public long hash; + } + + [TLDef(0x7573A4E9)] + public sealed partial class Users_GetSavedMusicByID : IMethod + { + public InputUserBase id; + public InputDocument[] documents; + } + [TLDef(0x7ADC669D)] public sealed partial class Contacts_GetContactIDs : IMethod { @@ -10789,11 +10912,11 @@ namespace TL.Methods public InputPeer peer; } - [TLDef(0xE63BE13F)] + [TLDef(0x081202C9)] public sealed partial class Messages_SetChatTheme : IMethod { public InputPeer peer; - public string emoticon; + public InputChatThemeBase theme; } [TLDef(0x31C1C44F)] @@ -12603,6 +12726,13 @@ namespace TL.Methods } } + [TLDef(0x3583FCB1)] + public sealed partial class Channels_SetMainProfileTab : IMethod + { + public InputChannelBase channel; + public ProfileTab tab; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13260,10 +13390,11 @@ namespace TL.Methods exclude_unsaved = 0x1, exclude_saved = 0x2, exclude_unlimited = 0x4, - exclude_limited = 0x8, exclude_unique = 0x10, sort_by_value = 0x20, has_collection_id = 0x40, + exclude_upgradable = 0x80, + exclude_unupgradable = 0x100, } } @@ -13380,6 +13511,18 @@ namespace TL.Methods public long hash; } + [TLDef(0x4365AF6B)] + public sealed partial class Payments_GetUniqueStarGiftValueInfo : IMethod + { + public string slug; + } + + [TLDef(0xC0C4EDC9)] + public sealed partial class Payments_CheckCanSendGift : IMethod + { + public long gift_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 3be9440..00b0355 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 = 211; // fetched 16/08/2025 00:21:53 + public const int Version = 214; // fetched 01/09/2025 11:20:56 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -140,7 +140,7 @@ namespace TL [0xFE685355] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), - [0xE07429DE] = typeof(ChannelFull), + [0xE4E0B29D] = typeof(ChannelFull), [0xC02D4007] = typeof(ChatParticipant), [0xE46BCEE4] = typeof(ChatParticipantCreator), [0xA0933F5B] = typeof(ChatParticipantAdmin), @@ -197,7 +197,7 @@ namespace TL [0x502F92F7] = typeof(MessageActionInviteToGroupCall), [0x3C134D7B] = typeof(MessageActionSetMessagesTTL), [0xB3A07661] = typeof(MessageActionGroupCallScheduled), - [0xAA786345] = typeof(MessageActionSetChatTheme), + [0xB91BBD3A] = typeof(MessageActionSetChatTheme), [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), @@ -215,7 +215,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0x4717E8A4] = typeof(MessageActionStarGift), + [0xF24DE7FA] = typeof(MessageActionStarGift), [0x34F762F3] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -240,7 +240,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), - [0xD7CEF980] = typeof(Auth_SentCodePaymentRequired), + [0xD7A2FCF9] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -254,7 +254,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0x7E63CE1F] = typeof(UserFull), + [0xC577B5AD] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -1079,6 +1079,10 @@ namespace TL [0xE3779861] = typeof(Account_ResetPasswordFailedWait), [0xE9EFFC7D] = typeof(Account_ResetPasswordRequestedWait), [0xE926D63E] = typeof(Account_ResetPasswordOk), + [0xC3DFFC04] = typeof(ChatTheme), + [0x3458F9C8] = typeof(ChatThemeUniqueGift), + [0xE011E1C4] = null,//Account_ChatThemesNotModified + [0x16484857] = typeof(Account_ChatThemes), [0x7DBF8673] = typeof(SponsoredMessage), [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty @@ -1130,6 +1134,7 @@ namespace TL [0xDABAB2EF] = typeof(InputInvoicePremiumGiftStars), [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), [0xC39F5324] = typeof(InputInvoiceStarGiftResale), + [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1137,7 +1142,7 @@ namespace TL [0x616F7FE8] = typeof(InputStorePaymentGiftPremium), [0xFB790393] = typeof(InputStorePaymentPremiumGiftCode), [0x160544CA] = typeof(InputStorePaymentPremiumGiveaway), - [0xDDDD0F56] = typeof(InputStorePaymentStarsTopup), + [0xF9A2A6CB] = typeof(InputStorePaymentStarsTopup), [0x1D741EF7] = typeof(InputStorePaymentStarsGift), [0x751F08FA] = typeof(InputStorePaymentStarsGiveaway), [0x9BB2636D] = typeof(InputStorePaymentAuthCode), @@ -1362,8 +1367,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x00BCFF5B] = typeof(StarGift), - [0x3A274D50] = typeof(StarGiftUnique), + [0x80AC53C3] = typeof(StarGift), + [0x1BEFE865] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1390,9 +1395,9 @@ namespace TL [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), - [0xCAA2F60B] = typeof(Payments_UniqueStarGift), - [0xB53E8B21] = typeof(Messages_WebPagePreview), - [0x1EA646DF] = typeof(SavedStarGift), + [0x416C56E8] = typeof(Payments_UniqueStarGift), + [0x8C9A88AC] = typeof(Messages_WebPagePreview), + [0x19A9B572] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1429,6 +1434,16 @@ namespace TL [0x564EDAEB] = null,//Stories_AlbumsNotModified [0xC3987A3A] = typeof(Stories_Albums), [0x3E0B5B6A] = typeof(SearchPostsFlood), + [0x512FE446] = typeof(Payments_UniqueStarGiftValueInfo), + [0xE3878AA4] = typeof(Users_SavedMusicNotModified), + [0x34A2F297] = typeof(Users_SavedMusic), + [0x4FC81D6E] = null,//Account_SavedMusicIdsNotModified + [0x998D6636] = typeof(Account_SavedMusicIds), + [0x374FA7AD] = typeof(Payments_CheckCanSendGiftResultOk), + [0xD5E58274] = typeof(Payments_CheckCanSendGiftResultFail), + [0x83268483] = null,//InputChatThemeEmpty + [0xC93DE95C] = typeof(InputChatTheme), + [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1548,6 +1563,7 @@ namespace TL [typeof(ChatReactions)] = 0xEAFC32BC, //chatReactionsNone [typeof(Messages_Reactions)] = 0xB06FDBDF, //messages.reactionsNotModified // from TL.Secret: + [typeof(Account_ChatThemes)] = 0xE011E1C4, //account.chatThemesNotModified [typeof(EmojiStatusBase)] = 0x2DE11AAE, //emojiStatusEmpty [typeof(EmojiList)] = 0x481EADFA, //emojiListNotModified [typeof(Messages_EmojiGroups)] = 0x6FB4AD87, //messages.emojiGroupsNotModified @@ -1564,6 +1580,8 @@ namespace TL [typeof(Contacts_SponsoredPeers)] = 0xEA32B4B1, //contacts.sponsoredPeersEmpty [typeof(Payments_StarGiftCollections)] = 0xA0BA4F17, //payments.starGiftCollectionsNotModified [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified + [typeof(Account_SavedMusicIds)] = 0x4FC81D6E, //account.savedMusicIdsNotModified + [typeof(InputChatThemeBase)] = 0x83268483, //inputChatThemeEmpty [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index ed47ea1..6fd580b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.211 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 211 + layer.214 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 214 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 4578dea3a37f98767f48f1f362128969b6ccd198 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 21 Sep 2025 01:55:11 +0200 Subject: [PATCH 306/336] HtmlToEntities tolerate unclosed &.. html entities --- src/Services.cs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index a83eed6..4b8cd9d 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -378,15 +378,15 @@ namespace TL end = offset + 1; if (end < sb.Length && sb[end] == '#') end++; while (end < sb.Length && sb[end] is >= 'a' and <= 'z' or >= 'A' and <= 'Z' or >= '0' and <= '9') end++; - if (end >= sb.Length || sb[end] != ';') break; - var html = HttpUtility.HtmlDecode(sb.ToString(offset, end - offset + 1)); + var html = HttpUtility.HtmlDecode(end >= sb.Length || sb[end] != ';' + ? sb.ToString(offset, end - offset) + ";" : sb.ToString(offset, ++end - offset)); if (html.Length == 1) { sb[offset] = html[0]; - sb.Remove(++offset, end - offset + 1); + sb.Remove(++offset, end - offset); } else - offset = end + 1; + offset = end; } else if (c == '<') { From 3f1036a559b0739b278c1d44a2a8562d1b36a63e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 25 Sep 2025 02:04:16 +0200 Subject: [PATCH 307/336] Fix #335 GetAllDialogs infinite loop when last dialogs' messages are unavailable --- README.md | 2 +- src/Client.Helpers.cs | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index d085aeb..5bf0849 100644 --- a/README.md +++ b/README.md @@ -8,7 +8,7 @@ This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. -Library was developed solely by one unemployed guy. [Donations are welcome](https://buymeacoffee.com/wizou). +Library was developed solely by one unemployed guy. [Donations](https://buymeacoffee.com/wizou) or [Patreon memberships are welcome](https://patreon.com/wizou). This ReadMe is a **quick but important tutorial** to learn the fundamentals about this library. Please read it all. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 3cc888f..2dd3c59 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -535,18 +535,20 @@ namespace WTelegram case Messages_DialogsSlice mds: var dialogList = new List(); var messageList = new List(); - while (dialogs.Dialogs.Length != 0) + int skip = 0; + while (dialogs.Dialogs.Length > skip) { - dialogList.AddRange(dialogs.Dialogs); + dialogList.AddRange(skip == 0 ? dialogs.Dialogs : dialogs.Dialogs[skip..]); messageList.AddRange(dialogs.Messages); + skip = 0; int last = dialogs.Dialogs.Length - 1; var lastDialog = dialogs.Dialogs[last]; + retryDate: var lastPeer = dialogs.UserOrChat(lastDialog).ToInputPeer(); var lastMsgId = lastDialog.TopMessage; - retryDate: var lastDate = dialogs.Messages.LastOrDefault(m => m.Peer.ID == lastDialog.Peer.ID && m.ID == lastDialog.TopMessage)?.Date ?? default; if (lastDate == default) - if (--last < 0) break; else { lastDialog = dialogs.Dialogs[last]; goto retryDate; } + if (--last < 0) break; else { ++skip; lastDialog = dialogs.Dialogs[last]; goto retryDate; } dialogs = await this.Messages_GetDialogs(lastDate, lastMsgId, lastPeer, folder_id: folder_id); if (dialogs is not Messages_Dialogs md) break; foreach (var (key, value) in md.chats) mds.chats[key] = value; From 610d059b4ce57401e66d0fff16187c782661650e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 3 Oct 2025 13:09:33 +0200 Subject: [PATCH 308/336] Fix: Messages_Search helper parameter name --- src/Client.Helpers.cs | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 2dd3c59..e205579 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -94,19 +94,19 @@ namespace WTelegram /// Search messages in chat with filter and text See /// See for a list of possible filter types /// User or chat, histories with which are searched, or constructor for global search - /// Text search request + /// Text search request /// Only return messages starting from the specified message ID /// Number of results to return - public Task Messages_Search(InputPeer peer, string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() - => this.Messages_Search(peer, text, new T(), offset_id: offset_id, limit: limit); + public Task Messages_Search(InputPeer peer, string q = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() + => this.Messages_Search(peer, q, new T(), offset_id: offset_id, limit: limit); /// Search messages globally with filter and text See /// See for a list of possible filter types - /// Text search request + /// Query /// Only return messages starting from the specified message ID /// Number of results to return - public Task Messages_SearchGlobal(string text = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() - => this.Messages_SearchGlobal(text, new T(), offset_id: offset_id, limit: limit); + public Task Messages_SearchGlobal(string q = null, int offset_id = 0, int limit = int.MaxValue) where T : MessagesFilter, new() + => this.Messages_SearchGlobal(q, new T(), offset_id: offset_id, limit: limit); /// Helper method to send a media message more easily /// Destination of message (chat group, channel, user chat, etc..) From a5323eaa8647fec4d3b4f0896ea62c3cd473c6fe Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 6 Oct 2025 18:34:25 +0200 Subject: [PATCH 309/336] api doc --- src/TL.Schema.cs | 728 ++++++++++++++++++++++++++++++++---------- src/TL.SchemaFuncs.cs | 470 ++++++++++++++++++--------- src/TL.Secret.cs | 31 +- 3 files changed, 900 insertions(+), 329 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 08737fd..16411b9 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -244,7 +244,9 @@ namespace TL public DocumentAttribute[] attributes; /// Attached stickers [IfFlag(0)] public InputDocument[] stickers; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(6)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(7)] public int video_timestamp; /// Time to live in seconds of self-destructing document [IfFlag(1)] public int ttl_seconds; @@ -277,7 +279,9 @@ namespace TL public Flags flags; /// The document to be forwarded. public InputDocument id; + /// Custom video cover. [IfFlag(3)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(4)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(0)] public int ttl_seconds; @@ -344,7 +348,9 @@ namespace TL public string url; /// Self-destruct time to live of document [IfFlag(0)] public int ttl_seconds; + /// Custom video cover. [IfFlag(2)] public InputPhoto video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(3)] public int video_timestamp; [Flags] public enum Flags : uint @@ -507,10 +513,11 @@ namespace TL has_payload = 0x1, } } - /// See + /// Creates a todo list ». See [TLDef(0x9FC55FDE)] public sealed partial class InputMediaTodo : InputMedia { + /// The todo list. public TodoList todo; } @@ -582,7 +589,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash value from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; } @@ -598,7 +605,7 @@ namespace TL public int local_id; /// Check sum to access the file public long secret; - /// File reference + /// File reference public byte[] file_reference; } /// Location of encrypted secret chat file. See @@ -618,7 +625,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; /// Thumbnail size to download the thumbnail public string thumb_size; @@ -643,7 +650,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
Photo's access hash, obtained from the object
public long access_hash; - /// File reference + /// File reference public byte[] file_reference; /// The to download: must be set to the type field of the desired PhotoSize object of the public string thumb_size; @@ -781,7 +788,7 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the user, see here » for more info. + /// ID of the user, see here » for more info and the available ID range. public long id; /// Access hash of the user, see here » for more info.
If this flag is set, when updating the local peer database, generate a virtual flag called min_access_hash, which is:
- Set to true if min is set AND
-- The phone flag is not set OR
-- The phone flag is set and the associated phone number string is non-empty
- Set to false otherwise.

Then, apply both access_hash and min_access_hash to the local database if:
- min_access_hash is false OR
- min_access_hash is true AND
-- There is no locally cached object for this user OR
-- There is no access_hash in the local cache OR
-- The cached object's min_access_hash is also true

If the final merged object stored to the database has the min_access_hash field set to true, the related access_hash is only suitable to use in inputPeerPhotoFileLocation », to directly download the profile pictures of users, everywhere else a inputPeer*FromMessage constructor will have to be generated as specified here ».
Bots can also use min access hashes in some conditions, by passing 0 instead of the min access hash.
[IfFlag(0)] public long access_hash; @@ -817,6 +824,7 @@ namespace TL [IfFlag(41)] public PeerColor profile_color; /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; + /// Describes a bot verification icon ». [IfFlag(46)] public long bot_verification_icon; /// If set, the user has enabled paid messages », we might need to pay the specified amount of Stars to send them messages, depending on the configured exceptions: check .send_paid_messages_stars or Users_GetRequirementsToContact to see if the currently logged in user actually has to pay or not, see here » for the full flow. [IfFlag(47)] public long send_paid_messages_stars; @@ -901,7 +909,7 @@ namespace TL has_profile_color = 0x200, /// See here for more info on this flag ». contact_require_premium = 0x400, - /// Whether this bot can be connected to a user as specified here ». + /// Whether this bot can be connected to a user as specified here ». bot_business = 0x800, /// Field has a value has_bot_active_users = 0x1000, @@ -999,7 +1007,7 @@ namespace TL /// Object defines a group. See Derived classes: , , , , public abstract partial class ChatBase : IObject { - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public virtual long ID => default; /// Title public virtual string Title => default; @@ -1020,7 +1028,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public long id; /// Title public string title; @@ -1061,7 +1069,7 @@ namespace TL noforwards = 0x2000000, } - /// ID of the group, see here » for more info + /// ID of the group, see here » for more info and the available ID range. public override long ID => id; /// Title public override string Title => title; @@ -1088,7 +1096,7 @@ namespace TL public Flags flags; /// Extra bits of information, use flags2.HasFlag(...) to test for those public Flags2 flags2; - /// ID of the channel, see here » for more info + /// ID of the channel, see here » for more info and the available ID range. public long id; /// Access hash, see here » for more info [IfFlag(13)] public long access_hash; @@ -1124,9 +1132,11 @@ namespace TL [IfFlag(42)] public int level; /// Expiration date of the Telegram Star subscription » the current user has bought to gain access to this channel. [IfFlag(43)] public DateTime subscription_until_date; + /// Describes a bot verification icon ». [IfFlag(45)] public long bot_verification_icon; - /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). + /// If set, this supergroup or monoforum has enabled paid messages », we might need to pay the specified amount of Stars to send messages to it, depending on the configured exceptions: check .send_paid_messages_stars to see if the currently logged in user actually has to pay or not, see here » for the full flow (only set for the monoforum, not the associated channel). [IfFlag(46)] public long send_paid_messages_stars; + /// For channels with associated monoforums, the monoforum ID. For Monoforums, the ID of the associated channel. [IfFlag(50)] public long linked_monoforum_id; [Flags] public enum Flags : uint @@ -1213,15 +1223,19 @@ namespace TL has_bot_verification_icon = 0x2000, /// Field has a value has_send_paid_messages_stars = 0x4000, + /// If set, autotranslation was enabled for all users by the admin of the channel, as specified here ». autotranslation = 0x8000, + /// If set, this channel has an associated monoforum », and its ID is specified in the linked_monoforum_id flag. broadcast_messages_allowed = 0x10000, + /// If set, this is a monoforum », and the ID of the associated channel is specified in the linked_monoforum_id. monoforum = 0x20000, /// Field has a value has_linked_monoforum_id = 0x40000, + /// If set, enables the tabbed forum UI ». forum_tabs = 0x80000, } - /// ID of the channel, see here » for more info + /// ID of the channel, see here » for more info and the available ID range. public override long ID => id; /// Title public override string Title => title; @@ -1491,10 +1505,13 @@ namespace TL [IfFlag(41)] public int boosts_unrestrict; /// Custom emoji stickerset associated to the current supergroup, set using Channels_SetEmojiStickers after reaching the appropriate boost level, see here » for more info. [IfFlag(42)] public StickerSet emojiset; + /// Bot verification icon [IfFlag(49)] public BotVerification bot_verification; + /// Admins with .post_messages rights will see the total number of received gifts, everyone else will see the number of gifts added to the channel's profile. [IfFlag(50)] public int stargifts_count; - /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
+ /// If set and bigger than 0, this supergroup, monoforum or the monoforum associated to this channel has enabled paid messages » and we must pay the specified amount of Stars to send messages to it, see here » for the full flow.
This flag will be set both for the monoforum and for of the associated channel).
If set and equal to 0, the monoforum requires payment in general but we were exempted from paying.
[IfFlag(53)] public long send_paid_messages_stars; + /// The main tab for the channel's profile, see here » for more info. [IfFlag(54)] public ProfileTab main_tab; [Flags] public enum Flags : uint @@ -1603,7 +1620,9 @@ namespace TL has_bot_verification = 0x20000, /// Field has a value has_stargifts_count = 0x40000, + /// If set, users may send Gifts » to this channel. stargifts_available = 0x80000, + /// If set, admins may enable enable paid messages » in this supergroup. paid_messages_available = 0x100000, /// Field has a value has_send_paid_messages_stars = 0x200000, @@ -1754,7 +1773,7 @@ namespace TL public virtual Peer From => default; /// Peer ID, the chat where this message was sent public virtual Peer Peer => default; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
public virtual Peer SavedPeer => default; /// Reply information public virtual MessageReplyHeaderBase ReplyTo => default; @@ -1803,13 +1822,13 @@ namespace TL [IfFlag(29)] public int from_boosts_applied; /// Peer ID, the chat where this message was sent public Peer peer_id; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
[IfFlag(28)] public Peer saved_peer_id; /// Info about forwarded messages [IfFlag(2)] public MessageFwdHeader fwd_from; /// ID of the inline bot that generated the message [IfFlag(11)] public long via_bot_id; - /// Whether the message was sent by the business bot specified in via_bot_id on behalf of the user. + /// Whether the message was sent by the business bot specified in via_bot_id on behalf of the user. [IfFlag(32)] public long via_business_bot_id; /// Reply information [IfFlag(3)] public MessageReplyHeaderBase reply_to; @@ -1851,6 +1870,7 @@ namespace TL [IfFlag(37)] public DateTime report_delivery_until_date; /// The amount of stars the sender has paid to send the message, see here » for more info. [IfFlag(38)] public long paid_message_stars; + /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint @@ -1933,7 +1953,9 @@ namespace TL has_paid_message_stars = 0x40, /// Field has a value has_suggested_post = 0x80, + /// Set if this is a suggested channel post » that was paid using Telegram Stars. paid_suggested_post_stars = 0x100, + /// Set if this is a suggested channel post » that was paid using Toncoins. paid_suggested_post_ton = 0x200, } @@ -1943,7 +1965,7 @@ namespace TL public override Peer From => from_id; /// Peer ID, the chat where this message was sent public override Peer Peer => peer_id; - /// Messages fetched from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
+ /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
public override Peer SavedPeer => saved_peer_id; /// Reply information public override MessageReplyHeaderBase ReplyTo => reply_to; @@ -1966,6 +1988,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Sender of service message public Peer peer_id; + /// Will only be set for service messages within a monoforum topic »: peer will be equal to the ID of the monoforum and the saved_peer_id flag will be set to the ID of a topic. [IfFlag(28)] public Peer saved_peer_id; /// Reply (thread) information [IfFlag(3)] public MessageReplyHeaderBase reply_to; @@ -1990,7 +2013,7 @@ namespace TL media_unread = 0x20, /// Field has a value has_from_id = 0x100, - /// Whether you can react to this messages ». + /// Whether you can react to this message ». reactions_are_possible = 0x200, /// Whether the message is silent silent = 0x2000, @@ -2012,6 +2035,7 @@ namespace TL public override Peer From => from_id; /// Sender of service message public override Peer Peer => peer_id; + /// Will only be set for service messages within a monoforum topic »: peer will be equal to the ID of the monoforum and the saved_peer_id flag will be set to the ID of a topic. public override Peer SavedPeer => saved_peer_id; /// Reply (thread) information public override MessageReplyHeaderBase ReplyTo => reply_to; @@ -2082,7 +2106,9 @@ namespace TL [IfFlag(0)] public DocumentBase document; /// Videos only, contains alternative qualities of the video. [IfFlag(5)] public DocumentBase[] alt_documents; + /// Custom video cover. [IfFlag(9)] public PhotoBase video_cover; + /// Start playing the video at the specified timestamp (seconds). [IfFlag(10)] public int video_timestamp; /// Time to live of self-destructing document [IfFlag(2)] public int ttl_seconds; @@ -2344,13 +2370,15 @@ namespace TL /// Either the paid-for media, or super low resolution media previews if the media wasn't purchased yet, see here » for more info. public MessageExtendedMediaBase[] extended_media; } - /// See + /// Represents a todo list ». See [TLDef(0x8A53B014)] public sealed partial class MessageMediaToDo : MessageMedia { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The todo list. public TodoList todo; + /// Completed items. [IfFlag(0)] public TodoCompletion[] completions; [Flags] public enum Flags : uint @@ -2652,6 +2680,7 @@ namespace TL [TLDef(0xB91BBD3A)] public sealed partial class MessageActionSetChatTheme : MessageAction { + /// The new chat theme. public ChatThemeBase theme; } /// A user was accepted into the group by an admin See @@ -2681,7 +2710,7 @@ namespace TL public string currency; /// Price of the gift 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 amount; - /// Duration of the gifted Telegram Premium subscription + /// Duration of the gifted Telegram Premium subscription. public int months; /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; @@ -2949,6 +2978,7 @@ namespace TL [IfFlag(4)] public long convert_stars; /// If set, this gift was upgraded to a collectible gift, and the corresponding is available at the specified message ID. [IfFlag(5)] public int upgrade_msg_id; + /// The number of Telegram Stars the user can pay to convert the gift into a collectible gift ». [IfFlag(8)] public long upgrade_stars; /// Sender of the gift (unset for anonymous gifts). [IfFlag(11)] public Peer from_id; @@ -2956,7 +2986,9 @@ namespace TL [IfFlag(12)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(12)] public long saved_id; + /// Hash to prepay for a gift upgrade separately ». [IfFlag(14)] public string prepaid_upgrade_hash; + /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (valid for everyone, since all messages across all private chats with users share the same message ID sequence, and for channels the service message will already be sent to the channel, that will contain the service message with the original gift). [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint @@ -2965,7 +2997,7 @@ namespace TL name_hidden = 0x1, /// Field has a value has_message = 0x2, - /// Whether this gift was added to the destination user's profile (may be toggled using Payments_SaveStarGift and fetched using Payments_GetUserStarGifts) + /// Whether this gift was added to the destination user's profile (may be toggled using Payments_SaveStarGift and fetched using Payments_GetSavedStarGifts) saved = 0x4, /// Whether this gift was converted to Telegram Stars and cannot be displayed on the profile anymore. converted = 0x8, @@ -2983,11 +3015,13 @@ namespace TL has_from_id = 0x800, /// Fields and have a value has_peer = 0x1000, + /// The sender has already pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x2000, /// Field has a value has_prepaid_upgrade_hash = 0x4000, /// Field has a value has_gift_msg_id = 0x8000, + /// This service message is the notification of a separate pre-payment for the upgrade of a gift we own. upgrade_separate = 0x10000, } } @@ -2999,6 +3033,7 @@ namespace TL public Flags flags; /// The collectible gift. public StarGiftBase gift; + /// If set, indicates that the current gift can't be exported to the TON blockchain » yet: the owner will be able to export it at the specified unixtime. [IfFlag(3)] public DateTime can_export_at; /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(4)] public long transfer_stars; @@ -3008,10 +3043,11 @@ namespace TL [IfFlag(7)] public Peer peer; /// For channel gifts, ID to use in s. [IfFlag(7)] public long saved_id; + /// Resale price of the gift. [IfFlag(8)] public StarsAmountBase resale_amount; /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(9)] public DateTime can_transfer_at; - /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [Flags] public enum Flags : uint @@ -3038,76 +3074,95 @@ namespace TL has_can_transfer_at = 0x200, /// Field has a value has_can_resell_at = 0x400, + /// The sender has pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x800, } } - /// See + /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See [TLDef(0xAC1F1FCD)] public sealed partial class MessageActionPaidMessagesRefunded : MessageAction { + /// Number of paid messages affected by the refund. public int count; + /// Number of refunded stars. public long stars; } - /// See + /// The price of paid messages » in this chat was changed. See [TLDef(0x84B88578)] public sealed partial class MessageActionPaidMessagesPrice : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The new price in Telegram Stars, can be 0 if messages are now free. public long stars; [Flags] public enum Flags : uint { + /// Can only be set for channels, if set indicates that direct messages were enabled », otherwise indicates that direct messages were disabled; the price of paid messages is related to the price of direct messages (aka those sent to the associated monoforum). broadcast_messages_allowed = 0x1, } } - /// See + /// Represents a conference call (or an invitation to a conference call, if neither the missed nor active flags are set). See [TLDef(0x2FFE2F7A)] public sealed partial class MessageActionConferenceCall : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Call ID. public long call_id; + /// Call duration, for left calls only. [IfFlag(2)] public int duration; + /// Identifiers of some other call participants. [IfFlag(3)] public Peer[] other_participants; [Flags] public enum Flags : uint { + /// Whether the conference call has ended and the user hasn't joined. missed = 0x1, + /// Whether the user is currently in the conference call. active = 0x2, /// Field has a value has_duration = 0x4, /// Field has a value has_other_participants = 0x8, + /// Whether this is a video conference call. video = 0x10, } } - /// See + /// Items were marked as completed or not completed in a todo list ». See [TLDef(0xCC7C5C89)] public sealed partial class MessageActionTodoCompletions : MessageAction { + /// Items marked as completed. public int[] completed; + /// Items marked as not completed. public int[] incompleted; } - /// See + /// Items were appended to the todo list ». See [TLDef(0xC7EDBC83)] public sealed partial class MessageActionTodoAppendTasks : MessageAction { + /// Appended items. public TodoItem[] list; } - /// See + /// A suggested post » was approved or rejected. See [TLDef(0xEE7A1596)] public sealed partial class MessageActionSuggestedPostApproval : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// If the suggested post was rejected, can optionally contain a rejection comment. [IfFlag(2)] public string reject_comment; + /// Scheduling date. [IfFlag(3)] public DateTime schedule_date; + /// Price for the suggested post. [IfFlag(4)] public StarsAmountBase price; [Flags] public enum Flags : uint { + /// Whether the suggested post was rejected. rejected = 0x1, + /// If set, the post was approved but the user's balance is too low to pay for the suggested post. balance_too_low = 0x2, /// Field has a value has_reject_comment = 0x4, @@ -3117,13 +3172,14 @@ namespace TL has_price = 0x10, } } - /// See + /// A suggested post » was successfully posted, and payment for it was successfully received. See [TLDef(0x95DDCF69)] public sealed partial class MessageActionSuggestedPostSuccess : MessageAction { + /// The price. public StarsAmountBase price; } - /// See + /// A suggested post » was accepted and posted or scheduled, but either the channel deleted the posted/scheduled post before stars_suggested_post_age_min seconds have elapsed, or the user refunded the payment for the stars used to pay for the suggested post. See [TLDef(0x69F916F8)] public sealed partial class MessageActionSuggestedPostRefund : MessageAction { @@ -3132,19 +3188,25 @@ namespace TL [Flags] public enum Flags : uint { + /// If set, the user refunded the payment for the stars used to pay for the suggested post. payer_initiated = 0x1, } } - /// See + /// You were gifted some toncoins. See [TLDef(0xA8A3C699)] public sealed partial class MessageActionGiftTon : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Name of a localized FIAT currency. public string currency; + /// FIAT currency equivalent (in the currency specified in currency) of the amount specified in crypto_amount. public long amount; + /// Name of the cryptocurrency. public string crypto_currency; + /// Amount in the smallest unit of the cryptocurrency (for TONs, one billionth of a ton, AKA a nanoton). public long crypto_amount; + /// Transaction ID. [IfFlag(0)] public string transaction_id; [Flags] public enum Flags : uint @@ -3268,7 +3330,7 @@ namespace TL public long id; /// Access hash public long access_hash; - /// file reference + /// file reference public byte[] file_reference; /// Date of upload public DateTime date; @@ -3432,13 +3494,17 @@ namespace TL /// Authorization info public Auth_AuthorizationBase authorization; } - /// See + /// Official apps may receive this constructor, indicating that due to the high cost of SMS verification codes for the user's country/provider, the user must purchase a Telegram Premium subscription in order to proceed with the login/signup. See [TLDef(0xD7A2FCF9)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { + /// Store identifier of the Telegram Premium subscription. public string store_product; + /// Phone code hash, to be stored and later re-used with Auth_SignIn public string phone_code_hash; + /// An email address that can be contacted for more information about this request. public string support_email_address; + /// The mandatory subject for the email. public string support_email_subject; } @@ -3450,7 +3516,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Iff setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass. + /// If and only if setup_password_required is set and the user declines to set a 2-step verification password, they will be able to log into their account via SMS again only after this many days pass. [IfFlag(1)] public int otherwise_relogin_days; /// Temporary passport sessions [IfFlag(0)] public int tmp_sessions; @@ -3631,15 +3697,19 @@ namespace TL [IfFlag(9)] public string request_chat_title; /// If set, this is a private chat with an administrator of a chat or channel to which the user sent a join request, and this field contains the timestamp when the join request » was sent. [IfFlag(9)] public DateTime request_chat_date; - /// Contains the ID of the business bot » managing this chat, used to display info about the bot in the action bar. + /// Contains the ID of the business bot » managing this chat, used to display info about the bot in the action bar. [IfFlag(13)] public long business_bot_id; /// Contains a deep link », used to open a management menu in the business bot. This flag is set if and only if business_bot_id is set. [IfFlag(13)] public string business_bot_manage_url; /// All users that must pay us » to send us private messages will have this flag set only for us, containing the amount of required stars, see here » for more info on paid messages. [IfFlag(14)] public long charge_paid_message_stars; + /// Used to display the user's registration year and month, the string is in MM.YYYY format, where MM is the registration month (1-12), and YYYY is the registration year. [IfFlag(15)] public string registration_month; + /// The country code of the user's phone number. [IfFlag(16)] public string phone_country; + /// When was the user's name last changed. [IfFlag(17)] public DateTime name_change_date; + /// When was the user's photo last changed. [IfFlag(18)] public DateTime photo_change_date; [Flags] public enum Flags : uint @@ -3666,9 +3736,9 @@ namespace TL has_request_chat_title = 0x200, /// This flag is set if request_chat_title and request_chat_date fields are set and the join request » is related to a channel (otherwise if only the request fields are set, the join request » is related to a chat). request_chat_broadcast = 0x400, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and all connected business bots » were paused in this chat using Account_ToggleConnectedBotPaused. business_bot_paused = 0x800, - /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. + /// This flag is set if both business_bot_id and business_bot_manage_url are set and connected business bots » can reply to messages in this chat, as specified by the settings during initial configuration. business_bot_can_reply = 0x1000, /// Fields and have a value has_business_bot_id = 0x2000, @@ -3813,6 +3883,7 @@ namespace TL [IfFlag(11)] public int folder_id; /// Time To Live of all messages in this chat; once a message is this many seconds old, it must be deleted. [IfFlag(14)] public int ttl_period; + /// The chat theme associated with this user ». [IfFlag(15)] public ChatThemeBase theme; /// Anonymized text to be shown instead of the user's name on forwarded messages [IfFlag(16)] public string private_forward_name; @@ -3844,14 +3915,21 @@ namespace TL [IfFlag(40)] public int stargifts_count; /// This bot has an active referral program » [IfFlag(43)] public StarRefProgram starref_program; + /// Describes a bot verification icon ». [IfFlag(44)] public BotVerification bot_verification; /// If set and bigger than 0, this user has enabled paid messages » and we must pay the specified amount of Stars to send messages to them, see here » for the full flow.
If set and equal to 0, the user requires payment in general but we were exempted from paying for any of the reasons specified in the docs ».
[IfFlag(46)] public long send_paid_messages_stars; + /// Disallows the reception of specific gift types. [IfFlag(47)] public DisallowedGiftsSettings disallowed_gifts; + /// The user's star rating. [IfFlag(49)] public StarsRating stars_rating; + /// Our pending star rating, only visible for ourselves. [IfFlag(50)] public StarsRating stars_my_pending_rating; + /// When the pending star rating will be applied, only visible for ourselves. [IfFlag(50)] public DateTime stars_my_pending_rating_date; + /// The main tab for the user's profile, see here » for more info. [IfFlag(52)] public ProfileTab main_tab; + /// The first song on the music tab of the profile, see here » for more info on the music profile tab. [IfFlag(53)] public DocumentBase saved_music; [Flags] public enum Flags : uint @@ -3944,6 +4022,7 @@ namespace TL has_send_paid_messages_stars = 0x4000, /// Field has a value has_disallowed_gifts = 0x8000, + /// If this flag is set for both us and another user (changed through ), a gift button should always be displayed in the text field in private chats with the other user: once clicked, the gift UI should be displayed, offering the user options to gift Telegram Premium » subscriptions or Telegram Gifts ». display_gifts_button = 0x10000, /// Field has a value has_stars_rating = 0x20000, @@ -4115,8 +4194,9 @@ namespace TL public int count; /// Rate to use in the offset_rate parameter in the next call to Messages_SearchGlobal [IfFlag(0)] public int next_rate; - /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}.
+ /// Indicates the absolute position of messages[0] within the total result set with count count.
This is useful, for example, if the result was fetched using offset_id, and we need to display a progress/total counter (like photo 134 of 200, for all media in a chat, we could simply use photo ${offset_id_offset} of ${count}).
[IfFlag(2)] public int offset_id_offset; + /// For global post searches », the remaining amount of free searches, here query_is_free is related to the current call only, not to the next paginated call, and all subsequent pagination calls will always be free. [IfFlag(3)] public SearchPostsFlood search_flood; [Flags] public enum Flags : uint @@ -4550,7 +4630,7 @@ namespace TL public override (long, int, int) GetMBox() => (0, pts, pts_count); } - /// Contents of messages in the common message box were read See + /// Contents of messages in the common message box were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Messages_ReadMessageContents). See [TLDef(0xF8227181)] public sealed partial class UpdateReadMessagesContents : Update { @@ -4847,6 +4927,7 @@ namespace TL public Peer peer; /// ID of the forum topic to which the draft is associated [IfFlag(0)] public int top_msg_id; + /// If set, the draft is related to the specified monoforum topic ID ». [IfFlag(1)] public Peer saved_peer_id; /// The draft public DraftMessageBase draft; @@ -5002,7 +5083,7 @@ namespace TL /// The list of favorited stickers was changed, the client should call Messages_GetFavedStickers to refetch the new list See [TLDef(0xE511996D)] public sealed partial class UpdateFavedStickers : Update { } - /// The specified channel/supergroup messages were read See + /// The specified channel/supergroup messages were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Channels_ReadMessageContents) See [TLDef(0x25F324F7)] public sealed partial class UpdateChannelReadMessagesContents : Update { @@ -5012,6 +5093,7 @@ namespace TL public long channel_id; /// Forum topic ID. [IfFlag(0)] public int top_msg_id; + /// If set, the messages were read within the specified monoforum topic ». [IfFlag(1)] public Peer saved_peer_id; /// IDs of messages that were read public int[] messages; @@ -5042,6 +5124,7 @@ namespace TL public Flags flags; /// The dialog public DialogPeerBase peer; + /// If set, the mark is related to the specified monoforum topic ID ». [IfFlag(1)] public Peer saved_peer_id; [Flags] public enum Flags : uint @@ -5541,6 +5624,7 @@ namespace TL public int msg_id; /// Forum topic ID [IfFlag(0)] public int top_msg_id; + /// If set, the reactions are in the specified monoforum topic ». [IfFlag(1)] public Peer saved_peer_id; /// Reactions public MessageReactions reactions; @@ -5881,7 +5965,7 @@ namespace TL /// IDs of the deleted messages. public int[] messages; } - /// Connecting or disconnecting a business bot or changing the connection settings will emit an update to the bot, with the new settings and a connection_id that will be used by the bot to handle updates from and send messages as the user. See + /// Connecting or disconnecting a business bot or changing the connection settings will emit an update to the bot, with the new settings and a connection_id that will be used by the bot to handle updates from and send messages as the user. See [TLDef(0x8AE5C97A)] public sealed partial class UpdateBotBusinessConnect : Update { @@ -5892,7 +5976,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was received via a connected business chat ». See + /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] public sealed partial class UpdateBotNewBusinessMessage : Update { @@ -5915,7 +5999,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was edited in a connected business chat ». See + /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] public sealed partial class UpdateBotEditBusinessMessage : Update { @@ -5938,7 +6022,7 @@ namespace TL public override (long, int, int) GetMBox() => (-1, qts, 1); } - /// A message was deleted in a connected business chat ». See + /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] public sealed partial class UpdateBotDeleteBusinessMessage : Update { @@ -5971,7 +6055,7 @@ namespace TL /// New balance. public StarsAmountBase balance; } - /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See + /// A callback button sent via a business connection was pressed, and the button data was sent to the bot that created the button. See [TLDef(0x1EA2FDA7)] public sealed partial class UpdateBusinessBotCallbackQuery : Update { @@ -5981,7 +6065,7 @@ namespace TL public long query_id; /// ID of the user that pressed the button public long user_id; - /// Business connection ID + /// Business connection ID public string connection_id; /// Message that contains the keyboard (also contains info about the chat where the message was sent). public MessageBase message; @@ -6026,51 +6110,65 @@ namespace TL [TLDef(0x8B725FCE)] public sealed partial class UpdatePaidReactionPrivacy : Update { - /// Whether paid reaction privacy is enabled or disabled. + /// Paid reaction privacy settings. public PaidReactionPrivacy private_; } - /// See + /// A paid login SMS code was successfully sent. See [TLDef(0x504AA18F)] public sealed partial class UpdateSentPhoneCode : Update { + /// Info about the sent code. public Auth_SentCodeBase sent_code; } - /// See + /// Contains updates to the blockchain of a conference call, see here » for more info. See [TLDef(0xA477288F)] public sealed partial class UpdateGroupCallChainBlocks : Update { + /// The conference call. public InputGroupCallBase call; + /// Subchain ID. public int sub_chain_id; + /// Blocks. public byte[][] blocks; + /// Offset of the next block. public int next_offset; } - /// See + /// Incoming messages in a monoforum topic were read See [TLDef(0x77B0E372)] public sealed partial class UpdateReadMonoForumInbox : Update { + /// ID of the monoforum. public long channel_id; + /// Topic ID. public Peer saved_peer_id; + /// Position up to which all incoming messages are read. public int read_max_id; } - /// See + /// Outgoing messages in a monoforum were read. See [TLDef(0xA4A79376)] public sealed partial class UpdateReadMonoForumOutbox : Update { + /// ID of the monoforum. public long channel_id; + /// Topic ID. public Peer saved_peer_id; + /// Position up to which all outgoing messages are read. public int read_max_id; } - /// See + /// An admin has (un)exempted this monoforum topic » from payment to send messages using Account_ToggleNoPaidMessagesException. See [TLDef(0x9F812B08)] public sealed partial class UpdateMonoForumNoPaidException : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The monoforum ID. public long channel_id; + /// The peer/topic ID. public Peer saved_peer_id; [Flags] public enum Flags : uint { + /// If set, an admin has exempted this peer, otherwise the peer was unexempted. exception = 0x1, } } @@ -6993,7 +7091,7 @@ namespace TL public long id; /// REQUIRED FIELD. See how to obtain it
access_hash parameter from the
public long access_hash; - ///
File reference + /// File reference public byte[] file_reference; } @@ -7016,7 +7114,7 @@ namespace TL public long id; /// Check sum, dependent on document ID public long access_hash; - /// File reference + /// File reference public byte[] file_reference; /// Creation date public DateTime date; @@ -7080,7 +7178,7 @@ namespace TL public int top_msg_id; } - /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , + /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -7620,7 +7718,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- video
- gif
- photo
- document
- profile
- telegram_background
- telegram_theme
- telegram_story
- telegram_channel
- telegram_channel_request
- telegram_megagroup
- telegram_chat
- telegram_megagroup_request
- telegram_chat_request
- telegram_album
- telegram_message
- telegram_bot
- telegram_voicechat
- telegram_livestream
- telegram_call
- telegram_user
- telegram_botapp
- telegram_channel_boost
- telegram_group_boost
- telegram_giftcode
- telegram_stickerset
- telegram_story_album
- telegram_collection

+ /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -7677,6 +7775,7 @@ namespace TL has_attributes = 0x1000, /// Whether the size of the media in the preview can be changed. has_large_media = 0x2000, + /// Represents a custom video cover. video_cover_photo = 0x4000, } @@ -7963,6 +8062,7 @@ namespace TL [IfFlag(10)] public StarsSubscriptionPricing subscription_pricing; /// For Telegram Star subscriptions », the ID of the payment form for the subscription. [IfFlag(12)] public long subscription_form_id; + /// Describes a bot verification icon ». [IfFlag(13)] public BotVerification bot_verification; [Flags] public enum Flags : uint @@ -8007,7 +8107,7 @@ namespace TL public DateTime expires; } - /// Represents a stickerset See Derived classes: , , , , , , , , , , + /// Represents a stickerset See Derived classes: , , , , , , , , , , /// a value means inputStickerSetEmpty public abstract partial class InputStickerSet : IObject { } /// Stickerset by ID See @@ -8054,7 +8154,7 @@ namespace TL /// Default custom emoji status stickerset for channel statuses See [TLDef(0x49748553)] public sealed partial class InputStickerSetEmojiChannelDefaultStatuses : InputStickerSet { } - /// See + /// TON gifts stickerset. See [TLDef(0x1CF671A0)] public sealed partial class InputStickerSetTonGifts : InputStickerSet { } @@ -8159,6 +8259,7 @@ namespace TL [IfFlag(7)] public string privacy_policy_url; /// Mini app » settings
[IfFlag(8)] public BotAppSettings app_settings; + /// This bot can verify peers: this field contains more info about the verification the bot can assign to peers. [IfFlag(9)] public BotVerifierSettings verifier_settings; [Flags] public enum Flags : uint @@ -8491,7 +8592,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -10095,6 +10196,7 @@ namespace TL public DateTime date; /// A message effect that should be played as specified here ». [IfFlag(7)] public long effect; + /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(8)] public SuggestedPost suggested_post; [Flags] public enum Flags : uint @@ -10791,10 +10893,11 @@ namespace TL /// The phone call was discarded because the user is busy in another call See [TLDef(0xFAF7E8C9)] public sealed partial class PhoneCallDiscardReasonBusy : PhoneCallDiscardReason { } - /// See + /// This phone call was migrated to a conference call. See [TLDef(0x9FBBF1F7)] public sealed partial class PhoneCallDiscardReasonMigrateConferenceCall : PhoneCallDiscardReason { + /// Conference link » slug. public string slug; } @@ -11664,6 +11767,7 @@ namespace TL video = 0x40, /// Field has a value has_custom_parameters = 0x80, + /// If set, the other party supports upgrading of the call to a conference call. conference_supported = 0x100, } @@ -12372,10 +12476,11 @@ namespace TL /// The subscriber that extended the subscription. public ChannelParticipantBase new_participant; } - /// See + /// Channel autotranslation was toggled ». See [TLDef(0xC517F77E)] public sealed partial class ChannelAdminLogEventActionToggleAutotranslation : ChannelAdminLogEventAction { + /// New value of the toggle public bool new_value; } @@ -13501,7 +13606,7 @@ namespace TL public Flags flags; /// The question of the poll (only Premium users can use custom emoji entities here). public TextWithEntities question; - /// The possible answers, vote using Messages_SendVote. + /// The possible answers (2-poll_answers_max), vote using Messages_SendVote. public PollAnswer[] answers; /// Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with close_date. [IfFlag(4)] public int close_period; @@ -13632,6 +13737,7 @@ namespace TL edit_stories = 0x8000, /// If set, allows the admin to delete stories posted by the other admins of the channel. delete_stories = 0x10000, + /// If set, allows the admin to manage the direct messages monoforum » and decline suggested posts ». manage_direct_messages = 0x20000, } } @@ -14245,7 +14351,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , , + /// Webpage attributes See Derived classes: , , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -14302,16 +14408,18 @@ namespace TL text_color = 0x2, } } - /// See + /// Contains info about collectible gift » for a preview of a collectible gift » (the will have a type of telegram_nft). See [TLDef(0xCF6F6DB8)] public sealed partial class WebPageAttributeUniqueStarGift : WebPageAttribute { + /// The . public StarGiftBase gift; } - /// See + /// Contains info about a gift collection » for a preview of a gift collection » (the will have a type of telegram_collection). See [TLDef(0x31CAD303)] public sealed partial class WebPageAttributeStarGiftCollection : WebPageAttribute { + /// Gifts in the collection. public DocumentBase[] icons; } @@ -14421,6 +14529,7 @@ namespace TL has_emoticon = 0x2000000, /// Field has a value has_color = 0x8000000, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x10000000, } @@ -14464,6 +14573,7 @@ namespace TL has_my_invites = 0x4000000, /// Field has a value has_color = 0x8000000, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x10000000, } @@ -14614,22 +14724,25 @@ namespace TL /// Re-fetch PSA/MTProxy info after the specified number of seconds public DateTime expires; } - /// MTProxy/Public Service Announcement information See + /// A set of useful suggestions and a PSA/MTProxy sponsored peer, see here » for more info. See [TLDef(0x08A4D87A)] public sealed partial class Help_PromoData : Help_PromoDataBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Expiry of PSA/MTProxy info + /// Unixtime when to re-invoke Help_GetPromoData. public DateTime expires; /// MTProxy/PSA peer [IfFlag(3)] public Peer peer; - /// PSA type + /// For Public Service Announcement peers, indicates the type of the PSA. [IfFlag(1)] public string psa_type; - /// PSA message + /// For Public Service Announcement peers, contains the PSA itself. [IfFlag(2)] public string psa_message; + /// Contains a list of pending suggestions ». public string[] pending_suggestions; + /// Contains a list of inverted suggestions ». public string[] dismissed_suggestions; + /// Contains a list of custom pending suggestions ». [IfFlag(4)] public PendingSuggestion custom_pending_suggestion; /// Chat info public Dictionary chats; @@ -14638,7 +14751,7 @@ namespace TL [Flags] public enum Flags : uint { - /// MTProxy-related channel + /// Set when connecting using an MTProxy that has configured an associated peer (that will be passed in peer, i.e. the channel that sponsored the MTProxy) that should be pinned on top of the chat list. proxy = 0x1, /// Field has a value has_psa_type = 0x2, @@ -14783,6 +14896,7 @@ namespace TL public Flags flags; /// If configured, specifies the number of stars users must pay us to send us a message, see here » for more info on paid messages. [IfFlag(5)] public long noncontact_peers_paid_stars; + /// Disallows the reception of specific gift types. [IfFlag(6)] public DisallowedGiftsSettings disallowed_gifts; [Flags] public enum Flags : uint @@ -14801,6 +14915,7 @@ namespace TL has_noncontact_peers_paid_stars = 0x20, /// Field has a value has_disallowed_gifts = 0x40, + /// Enables or disables our .display_gifts_button flag: if the .display_gifts_button flag of both us and another user is set, a gift button should always be displayed in the text field in private chats with the other user: once clicked, the gift UI should be displayed, offering the user options to gift Telegram Premium » subscriptions or Telegram Gifts ». display_gifts_button = 0x80, } } @@ -14958,6 +15073,7 @@ namespace TL [IfFlag(7)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(10)] public int quote_offset; + /// Can be set to reply to the specified item of a todo list ». [IfFlag(11)] public int todo_item_id; [Flags] public enum Flags : uint @@ -14998,7 +15114,7 @@ namespace TL public int story_id; } - /// Info about the comment section of a channel post, or a simple message thread See + /// Info about the comment section of a channel post, a simple message thread, a forum topic, or a direct messages topic (all features ultimately based on message threads). See [TLDef(0x83D60FC2)] public sealed partial class MessageReplies : IObject { @@ -15100,6 +15216,7 @@ namespace TL public int unmuted_video_limit; /// Version public int version; + /// Invitation link for the conference. [IfFlag(16)] public string invite_link; [Flags] public enum Flags : uint @@ -15130,7 +15247,9 @@ namespace TL rtmp_stream = 0x1000, /// Whether the listeners list is hidden and cannot be fetched using Phone_GetGroupParticipants. The phone.groupParticipants.count and groupCall.participants_count counters will still include listeners. listeners_hidden = 0x2000, + /// Whether this is an E2E conference call. conference = 0x4000, + /// Whether we're created this group call. creator = 0x8000, /// Field has a value has_invite_link = 0x10000, @@ -15153,16 +15272,18 @@ namespace TL /// REQUIRED FIELD. See how to obtain it
Group call access hash
public long access_hash; } - ///
See + /// Join a conference call through an invitation link ». See [TLDef(0xFE06823F)] public sealed partial class InputGroupCallSlug : InputGroupCallBase { + /// Slug from the conference link ». public string slug; } - /// See + /// Join a group call through a invitation message. See [TLDef(0x8C10603F)] public sealed partial class InputGroupCallInviteMessage : InputGroupCallBase { + /// ID of the . public int msg_id; } @@ -15552,36 +15673,46 @@ namespace TL [TLDef(0xE926D63E)] public sealed partial class Account_ResetPasswordOk : Account_ResetPasswordResult { } - /// See + /// A chat theme See Derived classes: , public abstract partial class ChatThemeBase : IObject { } - /// See + /// A chat theme See [TLDef(0xC3DFFC04)] public sealed partial class ChatTheme : ChatThemeBase { + /// The emoji identifying the chat theme. public string emoticon; } - /// See + /// A chat theme based on a collectible gift ». See [TLDef(0x3458F9C8)] public sealed partial class ChatThemeUniqueGift : ChatThemeBase { + /// The owned collectible gift on which this theme is based, as a . public StarGiftBase gift; + /// Theme settings. public ThemeSettings[] theme_settings; } - /// See + /// Available chat themes See /// a value means account.chatThemesNotModified [TLDef(0x16484857)] public sealed partial class Account_ChatThemes : IObject, IPeerResolver { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Hash to pass to the method that returned this constructor, to avoid refetching the result if it hasn't changed. public long hash; + /// Themes. public ChatThemeBase[] themes; + /// Chats mentioned in the themes field. public Dictionary chats; + /// Users mentioned in the themes field. public Dictionary users; + /// Next offset for pagination. [IfFlag(0)] public int next_offset; [Flags] public enum Flags : uint { + /// Field has a value has_next_offset = 0x1, } /// returns a or for the given Peer @@ -15616,7 +15747,9 @@ namespace TL [IfFlag(7)] public string sponsor_info; /// If set, contains additional information about the sponsored message to be shown along with the message. [IfFlag(8)] public string additional_info; + /// For sponsored messages to show on channel videos », allow the user to hide the ad only after the specified amount of seconds. [IfFlag(15)] public int min_display_duration; + /// For sponsored messages to show on channel videos », autohide the ad after after the specified amount of seconds. [IfFlag(15)] public int max_display_duration; [Flags] public enum Flags : uint @@ -15651,7 +15784,9 @@ namespace TL public Flags flags; /// If set, specifies the minimum number of messages between shown sponsored messages; otherwise, only one sponsored message must be shown after all ordinary messages. [IfFlag(0)] public int posts_between; + /// For sponsored messages to show on channel videos », the number of seconds to wait before showing the first ad. [IfFlag(1)] public int start_delay; + /// For sponsored messages to show on channel videos », the number of seconds to wait after the previous ad is hidden, before showing the next ad. [IfFlag(2)] public int between_delay; /// Sponsored messages public SponsoredMessage[] messages; @@ -16179,7 +16314,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , , , , , , + /// An invoice See Derived classes: , , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16226,6 +16361,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Receiver of the gift. public InputPeer peer; /// Identifier of the gift, from .id public long gift_id; @@ -16238,37 +16374,45 @@ namespace TL hide_name = 0x1, /// Field has a value has_message = 0x2, + /// Also pay for an eventual upgrade of the gift to a collectible gift ». include_upgrade = 0x4, } } - /// See + /// Used to pay to upgrade a Gift to a collectible gift, see the collectible gifts » documentation for more info on the full flow. See [TLDef(0x4D818D5D)] public sealed partial class InputInvoiceStarGiftUpgrade : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The identifier of the received gift to upgrade. public InputSavedStarGift stargift; [Flags] public enum Flags : uint { + /// Set this flag to keep the original gift text, sender and receiver in the upgraded gift as a attribute. keep_original_details = 0x1, } } - /// See + /// Used to pay to transfer a collectible gift to another peer, see the gifts » documentation for more info. See [TLDef(0x4A5F5BD9)] public sealed partial class InputInvoiceStarGiftTransfer : InputInvoice { + /// The identifier of the received gift public InputSavedStarGift stargift; + /// The destination peer public InputPeer to_id; } - /// See + /// Used to gift a Telegram Premium subscription to another user, paying with Telegram Stars. See [TLDef(0xDABAB2EF)] public sealed partial class InputInvoicePremiumGiftStars : InputInvoice { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Who will receive the gifted subscription. public InputUserBase user_id; + /// Duration of the subscription in months, must be one of the options with currency == "XTR" returned by Payments_GetPremiumGiftCodeOptions. public int months; + /// Message attached with the gift. [IfFlag(0)] public TextWithEntities message; [Flags] public enum Flags : uint @@ -16277,31 +16421,39 @@ namespace TL has_message = 0x1, } } - /// See + /// Transfer stars from the balance of a user account connected to a business bot, to the balance of the business bot, see here » for more info on the full flow. See [TLDef(0xF4997E42)] public sealed partial class InputInvoiceBusinessBotTransferStars : InputInvoice { + /// Always . public InputUserBase bot; + /// The number of stars to transfer. public long stars; } - /// See + /// Used to buy a collectible gift currently up on resale, see here for more info on the full flow. See [TLDef(0xC39F5324)] public sealed partial class InputInvoiceStarGiftResale : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Slug of the gift to buy. public string slug; + /// The receiver of the gift. public InputPeer to_id; [Flags] public enum Flags : uint { + /// Buy the gift using TON. ton = 0x1, } } - /// See + /// Separately prepay for the upgrade of a gift ». See [TLDef(0x9A0B48B8)] public sealed partial class InputInvoiceStarGiftPrepaidUpgrade : InputInvoice { + /// The peer that owns the gift. public InputPeer peer; + /// The upgrade hash from .prepaid_upgrade_hash or .prepaid_upgrade_hash. public string hash; } @@ -16449,6 +16601,7 @@ namespace TL [TLDef(0xF9A2A6CB)] public sealed partial class InputStorePaymentStarsTopup : InputStorePaymentPurpose { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Amount of stars to topup public long stars; @@ -16456,6 +16609,7 @@ namespace TL public string currency; /// Total price 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 amount; + /// Should be populated with the peer where the topup process was initiated due to low funds (i.e. a bot for bot payments, a channel for paid media/reactions, etc); leave this flag unpopulated if the topup flow was not initated when attempting to spend more Stars than currently available on the account's balance. [IfFlag(0)] public InputPeer spend_purpose_peer; [Flags] public enum Flags : uint @@ -16518,19 +16672,24 @@ namespace TL has_prize_description = 0x10, } } - /// See + /// Indicates payment for a login code. See [TLDef(0x9BB2636D)] public sealed partial class InputStorePaymentAuthCode : InputStorePaymentPurpose { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Phone number. public string phone_number; + /// phone_code_hash returned by Auth_SendCode. public string phone_code_hash; + /// 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 amount; [Flags] public enum Flags : uint { + /// Set this flag to restore a previously made purchase. restore = 0x1, } } @@ -16549,6 +16708,7 @@ namespace TL /// a value means emojiStatusEmpty public abstract partial class EmojiStatusBase : IObject { + /// If set, the emoji status will be active until the specified unixtime. public virtual DateTime Until => default; } /// An emoji status See @@ -16559,6 +16719,7 @@ namespace TL public Flags flags; /// Custom emoji document ID public long document_id; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16567,23 +16728,34 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } - /// See + /// An owned collectible gift » as emoji status. See [TLDef(0x7184603B)] public sealed partial class EmojiStatusCollectible : EmojiStatusBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the collectible (from .id). public long collectible_id; + /// ID of the custom emoji representing the status. public long document_id; + /// Name of the collectible. public string title; + /// Unique identifier of the collectible that may be used to create a collectible gift link » for the current collectible, or to fetch further info about the collectible using Payments_GetUniqueStarGift. public string slug; + /// The ID of a pattern to apply on the profile's backdrop, correlated to the from the gift in slug. public long pattern_document_id; + /// Color of the center of the profile backdrop in RGB24 format, from the gift's . public int center_color; + /// Color of the edges of the profile backdrop in RGB24 format, from the gift's . public int edge_color; + /// Color of the pattern_document_id applied on the profile backdrop in RGB24 format, from the gift's . public int pattern_color; + /// Color of text on the profile backdrop in RGB24 format, from the gift's . public int text_color; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16592,15 +16764,18 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } - /// See + /// An owned collectible gift » as emoji status: can only be used in Account_UpdateEmojiStatus, is never returned by the API. See [TLDef(0x07141DBF)] public sealed partial class InputEmojiStatusCollectible : EmojiStatusBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the collectible (from .id). public long collectible_id; + /// If set, the emoji status will be active until the specified unixtime. [IfFlag(0)] public DateTime until; [Flags] public enum Flags : uint @@ -16609,6 +16784,7 @@ namespace TL has_until = 0x1, } + /// If set, the emoji status will be active until the specified unixtime. public override DateTime Until => until; } @@ -16673,7 +16849,7 @@ namespace TL [TLDef(0xEAFDF716)] public sealed partial class Messages_Reactions : IObject { - /// Hash used for caching, for more info click here + /// Hash used for caching, can also be locally regenerated using the algorithm specified here ». public long hash; /// Reactions public Reaction[] reactions; @@ -17386,6 +17562,7 @@ namespace TL { /// Field has a value has_emoticon = 0x1, + /// If set, any animated emojis present in title should not be animated and should be instead frozen on the first frame. title_noanimate = 0x2, } @@ -17578,6 +17755,7 @@ namespace TL [IfFlag(3)] public StoryViews views; /// The reaction we sent. [IfFlag(15)] public Reaction sent_reaction; + /// Albums this story is part of. [IfFlag(19)] public int[] albums; [Flags] public enum Flags : uint @@ -17819,7 +17997,9 @@ namespace TL [IfFlag(3)] public MessageEntity[] quote_entities; /// Offset of the message quote_text within the original message (in UTF-16 code units). [IfFlag(4)] public int quote_offset; + /// Must be set to the ID of the topic when replying to a message within a monoforum topic. [IfFlag(5)] public InputPeer monoforum_peer_id; + /// Can be set to reply to the specified item of a todo list ». [IfFlag(6)] public int todo_item_id; [Flags] public enum Flags : uint @@ -17849,10 +18029,11 @@ namespace TL /// ID of the story to reply to. public int story_id; } - /// See + /// Used to send messages to a monoforum topic. See [TLDef(0x69D66C45)] public sealed partial class InputReplyToMonoForum : InputReplyTo { + /// The topic ID. public InputPeer monoforum_peer_id; } @@ -17884,7 +18065,7 @@ namespace TL } } - /// Coordinates and size of a clicable rectangular area on top of a story. See + /// Coordinates and size of a clickable rectangular area on top of a story. See [TLDef(0xCFC9E002)] public sealed partial class MediaAreaCoordinates : IObject { @@ -18024,11 +18205,13 @@ namespace TL /// ARGB background color. public int color; } - /// See + /// Represents a collectible gift ». See [TLDef(0x5787686D)] public sealed partial class MediaAreaStarGift : MediaArea { + /// Coordinates of the media area. public MediaAreaCoordinates coordinates; + /// slug from .slug, that can be resolved as specified here ». public string slug; } @@ -18696,29 +18879,40 @@ namespace TL /// The latest message ID public override int TopMessage => top_message; } - /// See + /// Represents a monoforum topic ». See [TLDef(0x64407EA7)] public sealed partial class MonoForumDialog : SavedDialogBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The peer associated to the topic, AKA the topic ID. public Peer peer; + /// The latest message ID public int top_message; + /// Position up to which all incoming messages are read. public int read_inbox_max_id; + /// Position up to which all outgoing messages are read. public int read_outbox_max_id; + /// Number of unread messages. public int unread_count; + /// Number of unread reactions. public int unread_reactions_count; + /// A pending message draft. [IfFlag(1)] public DraftMessageBase draft; [Flags] public enum Flags : uint { /// Field has a value has_draft = 0x2, + /// Whether this topic has a manually set (with Messages_MarkDialogUnread) unread mark. unread_mark = 0x8, + /// If set, an admin has exempted this peer from payment to send messages using Account_ToggleNoPaidMessagesException. nopaid_messages_exception = 0x10, } + /// The peer associated to the topic, AKA the topic ID. public override Peer Peer => peer; + /// The latest message ID public override int TopMessage => top_message; } @@ -18800,7 +18994,7 @@ namespace TL { /// Saved reaction tags. public SavedReactionTag[] tags; - /// Hash used for caching, for more info click here + /// Hash used for caching, for more info click here. Can also be manually regenerated, if needed, using the custom algorithm specified here ». public long hash; } @@ -19117,7 +19311,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Contains info about a connected business bot ». See + /// Contains info about a connected business bot ». See [TLDef(0xCD64636C)] public sealed partial class ConnectedBot : IObject { @@ -19125,8 +19319,9 @@ namespace TL public Flags flags; /// ID of the connected bot public long bot_id; - /// Specifies the private chats that a connected business bot » may receive messages and interact with.
+ /// Specifies the private chats that a connected business bot » may receive messages and interact with.
public BusinessBotRecipients recipients; + /// Business bot rights. public BusinessBotRights rights; [Flags] public enum Flags : uint @@ -19134,7 +19329,7 @@ namespace TL } } - /// Info about currently connected business bots. See + /// Info about currently connected business bots. See [TLDef(0x17D7F87B)] public sealed partial class Account_ConnectedBots : IObject { @@ -19180,20 +19375,21 @@ namespace TL } } - /// Contains info about a bot business connection. See + /// Contains info about a bot business connection. See [TLDef(0x8F34B2F5)] public sealed partial class BotBusinessConnection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Business connection ID, used to identify messages coming from the connection and to reply to them as specified here ». + /// Business connection ID, used to identify messages coming from the connection and to reply to them as specified here ». public string connection_id; /// ID of the user that the bot is connected to via this connection. public long user_id; - /// ID of the datacenter where to send queries wrapped in a InvokeWithBusinessConnection as specified here ». + /// ID of the datacenter where to send queries wrapped in a InvokeWithBusinessConnection as specified here ». public int dc_id; /// When was the connection created. public DateTime date; + /// Business bot rights. [IfFlag(2)] public BusinessBotRights rights; [Flags] public enum Flags : uint @@ -19290,7 +19486,7 @@ namespace TL public string url; } - /// Specifies the private chats that a connected business bot » may interact with. See + /// Specifies the private chats that a connected business bot » may interact with. See [TLDef(0xC4E5921E)] public sealed partial class InputBusinessBotRecipients : IObject { @@ -19320,7 +19516,7 @@ namespace TL } } - /// Specifies the private chats that a connected business bot » may receive messages and interact with. See + /// Specifies the private chats that a connected business bot » may receive messages and interact with. See [TLDef(0xB88CF373)] public sealed partial class BusinessBotRecipients : IObject { @@ -19741,7 +19937,7 @@ namespace TL } } - /// Represents a Telegram Stars transaction ». See + /// Represents a Telegram Stars or TON transaction ». See [TLDef(0x13659EB0)] public sealed partial class StarsTransaction : IObject { @@ -19749,6 +19945,7 @@ namespace TL public Flags flags; /// Transaction ID. public string id; + /// Amount of Telegram Stars or TON. public StarsAmountBase amount; /// Date of the transaction (unixtime). public DateTime date; @@ -19784,9 +19981,13 @@ namespace TL [IfFlag(17)] public Peer starref_peer; /// For transactions made by referred users, the amount of Telegram Stars received by the affiliate, can be negative for refunds. [IfFlag(17)] public StarsAmountBase starref_amount; + /// This transaction is related to the reception or transmission of a paid message ». [IfFlag(19)] public int paid_messages; + /// This transaction indicates the payment for a gifted Telegram Premium subscription ». [IfFlag(20)] public int premium_gift_months; + /// Indicates that this is payment for ad revenue from the specified unixtime (always set together with ads_proceeds_to_date). [IfFlag(23)] public DateTime ads_proceeds_from_date; + /// Indicates that this is payment for ad revenue to the specified unixtime. [IfFlag(23)] public DateTime ads_proceeds_to_date; [Flags] public enum Flags : uint @@ -19827,16 +20028,21 @@ namespace TL has_starref_commission_permille = 0x10000, /// Fields and have a value has_starref_peer = 0x20000, + /// This transaction pays for the upgrade of a gift to a collectible gift ». stargift_upgrade = 0x40000, /// Field has a value has_paid_messages = 0x80000, /// Field has a value has_premium_gift_months = 0x100000, + /// This transaction transfers stars from the balance of a user account connected to a business bot, to the balance of the business bot, see here » for more info. business_transfer = 0x200000, + /// This transaction is related to the resale of a collectible gift ». stargift_resale = 0x400000, /// Fields and have a value has_ads_proceeds_from_date = 0x800000, + /// Represents payment for a paid global post search ». posts_search = 0x1000000, + /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, } } @@ -19960,7 +20166,7 @@ namespace TL [Flags] public enum Flags : uint { - /// If set, the user may withdraw up to available_balance stars. + /// If set, the user may withdraw up to available_balance stars. withdrawal_enabled = 0x1, /// Field has a value has_next_withdrawal_at = 0x2, @@ -19973,6 +20179,7 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// For ad revenue statistics, ad impressions graph [IfFlag(0)] public StatsGraphBase top_hours_graph; /// Star revenue graph (number of earned stars) public StatsGraphBase revenue_graph; @@ -19988,11 +20195,11 @@ namespace TL } } - /// Contains the URL to use to withdraw Telegram Star revenue. See + /// Contains the URL to use to withdraw Telegram Star revenue. See [TLDef(0x1DAB80B7)] public sealed partial class Payments_StarsRevenueWithdrawalUrl : IObject { - /// Contains the URL to use to withdraw Telegram Star revenue. + /// Contains the URL to use to withdraw Telegram Star revenue. public string url; } @@ -20215,7 +20422,9 @@ namespace TL public virtual long ID => default; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public virtual int AvailabilityTotal => default; + /// Title of the gift public virtual string Title => default; + /// This gift was released by the specified peer. public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See @@ -20234,6 +20443,7 @@ namespace TL [IfFlag(0)] public int availability_remains; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. [IfFlag(0)] public int availability_total; + /// The total number of (upgraded to collectibles) gifts of this type currently on resale [IfFlag(4)] public long availability_resale; /// The receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page.
convert_stars will be equal to stars only if the gift was bought using recently bought Telegram Stars, otherwise it will be less than stars.
public long convert_stars; @@ -20241,12 +20451,19 @@ namespace TL [IfFlag(1)] public DateTime first_sale_date; /// For sold out gifts only: when was the gift last bought. [IfFlag(1)] public DateTime last_sale_date; + /// The number of Telegram Stars the user can pay to convert the gift into a collectible gift ». [IfFlag(3)] public long upgrade_stars; + /// The minimum price in Stars for gifts of this type currently on resale. [IfFlag(4)] public long resell_min_stars; + /// Title of the gift [IfFlag(5)] public string title; + /// This gift was released by the specified peer. [IfFlag(6)] public Peer released_by; + /// Maximum number of gifts of this type that can be owned by any user. [IfFlag(8)] public int per_user_total; + /// Remaining number of gifts of this type that can be owned by the current user. [IfFlag(8)] public int per_user_remains; + /// If set, the specified gift possibly cannot be sent until the specified date, see here » for the full flow. [IfFlag(9)] public DateTime locked_until_date; [Flags] public enum Flags : uint @@ -20265,7 +20482,9 @@ namespace TL has_title = 0x20, /// Field has a value has_released_by = 0x40, + /// This gift can only be bought by users with a Premium subscription. require_premium = 0x80, + /// If set, the maximum number of gifts of this type that can be owned by a single user is limited and specified in per_user_total, and the remaining slots for the current user in per_user_remains. limited_per_user = 0x100, /// Field has a value has_locked_until_date = 0x200, @@ -20275,7 +20494,9 @@ namespace TL public override long ID => id; /// For limited-supply gifts: the total number of gifts that was available in the initial supply. public override int AvailabilityTotal => availability_total; + /// Title of the gift public override string Title => title; + /// This gift was released by the specified peer. public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See @@ -20284,23 +20505,39 @@ namespace TL { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Identifier of the gift. + /// Identifier of the collectible gift. public long id; + /// Unique ID of the gift. public long gift_id; + /// Collectible title. public string title; + /// Slug that can be used to create a collectible gift deep link », or elsewhere in the API where a collectible slug is accepted. public string slug; + /// Unique identifier of this collectible gift among all (already upgraded) collectible gifts of the same type. public int num; + /// The owner of the gift. [IfFlag(0)] public Peer owner_id; + /// The name of the owner if neither owner_id nor owner_address are set. [IfFlag(1)] public string owner_name; + /// For NFTs on the TON blockchain, contains the address of the owner (append it to the ton_blockchain_explorer_url client configuration value » to obtain a link with information about the address). [IfFlag(2)] public string owner_address; + /// Collectible attributes public StarGiftAttribute[] attributes; + /// Total number of gifts of the same type that were upgraded to a collectible gift. public int availability_issued; + /// Total number of gifts of the same type that can be upgraded or were already upgraded to a collectible gift. public int availability_total; + /// For NFTs on the TON blockchain, contains the address of the NFT (append it to the ton_blockchain_explorer_url client configuration value » to obtain a link with information about the address). [IfFlag(3)] public string gift_address; + /// Resale price of the gift. [IfFlag(4)] public StarsAmountBase[] resell_amount; + /// This gift was released by the specified peer. [IfFlag(5)] public Peer released_by; + /// Price of the gift. [IfFlag(8)] public long value_amount; + /// Currency for the gift's price. [IfFlag(8)] public string value_currency; + /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; [Flags] public enum Flags : uint @@ -20317,19 +20554,25 @@ namespace TL has_resell_amount = 0x10, /// Field has a value has_released_by = 0x20, + /// This gift can only be bought by users with a Premium subscription. require_premium = 0x40, + /// Whether the gift can be bought only using Toncoins. resale_ton_only = 0x80, /// Fields and have a value has_value_amount = 0x100, + /// A chat theme associated to this gift is available, see here » for more info on how to use it. theme_available = 0x200, /// Field has a value has_theme_peer = 0x400, } - /// Identifier of the gift. + /// Identifier of the collectible gift. public override long ID => id; + /// Total number of gifts of the same type that can be upgraded or were already upgraded to a collectible gift. public override int AvailabilityTotal => availability_total; + /// Collectible title. public override string Title => title; + /// This gift was released by the specified peer. public override Peer ReleasedBy => released_by; } @@ -20342,7 +20585,9 @@ namespace TL public int hash; /// List of available gifts. public StarGiftBase[] gifts; + /// Chats mentioned in the gifts field. public Dictionary chats; + /// Users mentioned in the gifts field. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); @@ -20550,18 +20795,20 @@ namespace TL { /// The integer amount of Telegram Stars. public long amount; - /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
+ /// The decimal amount of Telegram Stars, expressed as nanostars (i.e. 1 nanostar is equal to 1/1'000'000'000th (one billionth) of a Telegram Star).
This field may also be negative (the allowed range is -999999999 to 999999999).
public int nanos; /// The integer amount of Telegram Stars. public override long Amount => amount; } - /// See + /// Describes an amount of toncoin in nanotons (i.e. 1/1_000_000_000 of a toncoin). See [TLDef(0x74AEE3E0)] public sealed partial class StarsTonAmount : StarsAmountBase { + /// The amount in nanotons. public long amount; + /// The amount in nanotons. public override long Amount => amount; } @@ -20602,30 +20849,37 @@ namespace TL } } - /// See + /// Info about the current verifier bot ». See [TLDef(0xB0CD6617)] public sealed partial class BotVerifierSettings : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Verification icon public long icon; + /// The name of the organization that provides the verification public string company; + /// An optional default description for the verification [IfFlag(0)] public string custom_description; [Flags] public enum Flags : uint { /// Field has a value has_custom_description = 0x1, + /// Indicates whether the bot is allowed to set a custom description field for individual verified peers, different from the custom_description provided here. can_modify_custom_description = 0x2, } } - /// See + /// Describes a bot verification icon ». See [TLDef(0xF93CD45C)] public sealed partial class BotVerification : IObject { + /// ID of the bot that verified this peer public long bot_id; + /// Verification icon public long icon; + /// Verification description public string description; } @@ -20704,64 +20958,87 @@ namespace TL public StarGiftAttribute[] sample_attributes; } - /// See + /// Describes a list of users (or bots). See [TLDef(0x62D706B8)] public partial class Users_Users : IObject { + /// Users public Dictionary users; } - /// See + /// Describes a partial list of users. See [TLDef(0x315A4974)] public sealed partial class Users_UsersSlice : Users_Users { + /// Total number of users (bigger than the users specified in users) public int count; } - /// See + /// Represents a collectible gift ». See [TLDef(0x416C56E8)] public sealed partial class Payments_UniqueStarGift : IObject, IPeerResolver { + /// The . public StarGiftBase gift; + /// Chats mentioned in the gift field. public Dictionary chats; + /// Users mentioned in the gift field. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a webpage preview. See [TLDef(0x8C9A88AC)] public sealed partial class Messages_WebPagePreview : IObject, IPeerResolver { + /// The or a if there is no preview. public MessageMedia media; + /// Chats mentioned in the gift field. public Dictionary chats; + /// Users mentioned within the media object. public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Represents a gift owned by a peer. See [TLDef(0x19A9B572)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Sender of the gift (unset for anonymous gifts). [IfFlag(1)] public Peer from_id; + /// Reception date of the gift. public DateTime date; + /// The collectible gift. public StarGiftBase gift; + /// Message attached to the gift. [IfFlag(2)] public TextWithEntities message; + /// For gifts received by users, ID to use in s. [IfFlag(3)] public int msg_id; + /// For gifts received by channels, ID to use in s. [IfFlag(11)] public long saved_id; + /// For non-collectible gifts, the receiver of this gift may convert it to this many Telegram Stars, instead of displaying it on their profile page. [IfFlag(4)] public long convert_stars; + /// Only for pre-paid non-collectible gifts, the number of Telegram Stars the sender has already paid to convert the gift into a collectible gift » (this is different from the meaning of the flag in , where it signals the upgrade price for not yet upgraded gifts). [IfFlag(6)] public long upgrade_stars; + /// If set, indicates that the current gift can't be exported to the TON blockchain » yet: the owner will be able to export it at the specified unixtime. [IfFlag(7)] public DateTime can_export_at; + /// If set, indicates that the gift can be transferred » to another user by paying the specified amount of stars. [IfFlag(8)] public long transfer_stars; + /// If set, indicates that the current gift can't be transferred » yet: the owner will be able to transfer it at the specified unixtime. [IfFlag(13)] public DateTime can_transfer_at; + /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(14)] public DateTime can_resell_at; + /// IDs of the collections » that this gift is a part of. [IfFlag(15)] public int[] collection_id; + /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; [Flags] public enum Flags : uint { + /// If set, the gift sender in from_id and the message are set only for the receiver of the gift. name_hidden = 0x1, /// Field has a value has_from_id = 0x2, @@ -20771,6 +21048,7 @@ namespace TL has_msg_id = 0x8, /// Field has a value has_convert_stars = 0x10, + /// If set, the gift is not pinned on the user's profile. unsaved = 0x20, /// Field has a value has_upgrade_stars = 0x40, @@ -20778,10 +21056,13 @@ namespace TL has_can_export_at = 0x80, /// Field has a value has_transfer_stars = 0x100, + /// This gift was upgraded to a collectible gift » and then re-downgraded to a regular gift because a request to refund the payment related to the upgrade was made, and the money was returned. refunded = 0x200, + /// Only set for non-collectible gifts, if they can be upgraded to a collectible gift ». can_upgrade = 0x400, /// Field has a value has_saved_id = 0x800, + /// Whether this gift is pinned on top of the user's profile page. pinned_to_top = 0x1000, /// Field has a value has_can_transfer_at = 0x2000, @@ -20791,21 +21072,28 @@ namespace TL has_collection_id = 0x8000, /// Field has a value has_prepaid_upgrade_hash = 0x10000, + /// If set, someone already separately pre-paid for the upgrade of this gift. upgrade_separate = 0x20000, } } - /// See + /// Represents a list of gifts. See [TLDef(0x95F389B1)] public sealed partial class Payments_SavedStarGifts : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results (can be less than the returned gifts, in which case next_offset will be set). public int count; + /// Ternary value: can be not set, set&true, set&false.
Can only be set for channels we own: the value indicates whether we
enabled gift notifications for this channel.
[IfFlag(1)] public bool chat_notifications_enabled; + /// Gifts public SavedStarGift[] gifts; + /// Offset to pass to Payments_GetSavedStarGifts to fetch the next page of results. [IfFlag(0)] public string next_offset; + /// Channels mentioned in gifts public Dictionary chats; + /// Users mentioned in gifts public Dictionary users; [Flags] public enum Flags : uint @@ -20819,9 +21107,9 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See Derived classes: , , + /// Points to a gift ». See Derived classes: , , public abstract partial class InputSavedStarGift : IObject { } - /// A gift received in a private chat with another user. See + /// A gift received in a private chat with another user. See [TLDef(0x69279795)] public sealed partial class InputSavedStarGiftUser : InputSavedStarGift { @@ -20837,30 +21125,33 @@ namespace TL /// ID of the gift, must be the saved_id of a /. public long saved_id; } - /// See + /// Points to a collectible gift obtained from a collectible gift link ». See [TLDef(0x2085C238)] public sealed partial class InputSavedStarGiftSlug : InputSavedStarGift { + /// Slug from the link. public string slug; } - /// See + /// A URL that can be used to import the exported NFT on Fragment. See [TLDef(0x84AA3A9C)] public sealed partial class Payments_StarGiftWithdrawalUrl : IObject { + /// The URL to open. public string url; } - /// See Derived classes: , + /// Paid reaction privacy settings » See Derived classes: , /// a value means paidReactionPrivacyDefault public abstract partial class PaidReactionPrivacy : IObject { } - /// See + /// Send paid reactions anonymously. See [TLDef(0x1F0C1AD9)] public sealed partial class PaidReactionPrivacyAnonymous : PaidReactionPrivacy { } - /// See + /// Send paid reactions as the specified peer, fetched using Channels_GetSendAs. See [TLDef(0xDC6CFCF0)] public sealed partial class PaidReactionPrivacyPeer : PaidReactionPrivacy { + /// The peer to send reactions as. public InputPeer peer; } @@ -20886,7 +21177,7 @@ namespace TL public long stars_amount; } - /// See + /// Business bot rights. See [TLDef(0xA0624CF7)] public sealed partial class BusinessBotRights : IObject { @@ -20895,24 +21186,38 @@ namespace TL [Flags] public enum Flags : uint { + /// Whether the bot can send and edit messages in private chats that had incoming messages in the last 24 hours. reply = 0x1, + /// Whether the bot can mark incoming private messages as read. read_messages = 0x2, + /// Whether the bot can delete messages sent by the bot. delete_sent_messages = 0x4, + /// Whether the bot can delete received private messages in managed chats. delete_received_messages = 0x8, + /// Whether the bot can edit the first and last name of the business account. edit_name = 0x10, + /// Whether the bot can edit the bio of the business account. edit_bio = 0x20, + /// Whether the bot can edit the profile photo of the business account. edit_profile_photo = 0x40, + /// Whether the bot can edit the username of the business account. edit_username = 0x80, + /// Whether the bot can view gifts and the amount of Telegram Stars owned by the business account. view_gifts = 0x100, + /// Whether the bot can convert regular gifts owned by the business account to Telegram Stars. sell_gifts = 0x200, + /// Whether the bot can change the privacy settings pertaining to gifts for the business account. change_gift_settings = 0x400, + /// Whether the bot can transfer and upgrade gifts owned by the business account. transfer_and_upgrade_gifts = 0x800, + /// Whether the bot can transfer Telegram Stars received by the business account to its own account, or use them to upgrade and transfer gifts. transfer_stars = 0x1000, + /// Whether the bot can post, edit and delete stories on behalf of the business account. manage_stories = 0x2000, } } - /// See + /// Disallow the reception of specific gift types. See [TLDef(0x71F276C4)] public sealed partial class DisallowedGiftsSettings : IObject { @@ -20921,22 +21226,30 @@ namespace TL [Flags] public enum Flags : uint { + /// Disallow the reception of gifts with an unlimited supply (those with the .limited flag not set). disallow_unlimited_stargifts = 0x1, + /// Disallow the reception of limited-supply gifts (those with the .limited flag set). disallow_limited_stargifts = 0x2, + /// Disallow the reception of collectible gifts ». disallow_unique_stargifts = 0x4, + /// Disallow the reception of gifted Telegram Premium subscriptions ». disallow_premium_gifts = 0x8, } } - /// See + /// A sponsored peer. See [TLDef(0xC69708D3)] public sealed partial class SponsoredPeer : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the sponsored peer, to be passed to Messages_ViewSponsoredMessage, Messages_ClickSponsoredMessage or Messages_ReportSponsoredMessage (the same methods used for sponsored messages &raquo). public byte[] random_id; + /// The sponsored peer. public Peer peer; + /// If set, contains additional information about the sponsor to be shown along with the peer. [IfFlag(0)] public string sponsor_info; + /// If set, contains additional information about the sponsored message to be shown along with the peer. [IfFlag(1)] public string additional_info; [Flags] public enum Flags : uint @@ -20948,60 +21261,75 @@ namespace TL } } - /// See + /// Sponsored peers. See /// a value means contacts.sponsoredPeersEmpty [TLDef(0xEB032884)] public sealed partial class Contacts_SponsoredPeers : IObject, IPeerResolver { + /// Sponsored peers. public SponsoredPeer[] peers; + /// Info about sponsored chats and channels public Dictionary chats; + /// Info about sponsored users public Dictionary users; /// returns a or for the given Peer public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See Derived classes: , , + /// Represents the identifier of a collectible gift attribute. See Derived classes: , , public abstract partial class StarGiftAttributeId : IObject { } - /// See + /// The ID of a model of a collectible gift ». See [TLDef(0x48AAAE3C)] public sealed partial class StarGiftAttributeIdModel : StarGiftAttributeId { + /// The sticker representing the upgraded gift public long document_id; } - /// See + /// The ID of a pattern of a collectible gift ». See [TLDef(0x4A162433)] public sealed partial class StarGiftAttributeIdPattern : StarGiftAttributeId { + /// The sticker representing the symbol public long document_id; } - /// See + /// The ID of a backdrop of a collectible gift ». See [TLDef(0x1F01C757)] public sealed partial class StarGiftAttributeIdBackdrop : StarGiftAttributeId { + /// Unique ID of the backdrop. public int backdrop_id; } - /// See + /// Indicates the total number of gifts that have the specified attribute. See [TLDef(0x2EB1B658)] public sealed partial class StarGiftAttributeCounter : IObject { + /// The attribute (just the ID, without the attribute itself). public StarGiftAttributeId attribute; + /// Total number of gifts with this attribute. public int count; } - /// See + /// List of gifts currently on resale ». See [TLDef(0x947A12DF)] public sealed partial class Payments_ResaleStarGifts : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of results. public int count; + /// Collectible gifts on resale (may be less than count, in which case next_offset will be set). public StarGiftBase[] gifts; + /// Offset for pagination, pass this to Payments_GetResaleStarGifts.offset to fetch the next results. [IfFlag(0)] public string next_offset; + /// Possible gift attributes. [IfFlag(1)] public StarGiftAttribute[] attributes; + /// Hash of the attributes field, pass this to Payments_GetResaleStarGifts.attributes_hash to avoid returning any attributes (flag not set) if they haven't changed. [IfFlag(1)] public long attributes_hash; + /// Chats mentioned in the attributes. public Dictionary chats; [IfFlag(2)] public StarGiftAttributeCounter[] counters; + /// Users mentioned in the attributes. public Dictionary users; [Flags] public enum Flags : uint @@ -21017,85 +21345,107 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// Contains the number of available active story slots (equal to the value of the story_expiring_limit_* client configuration parameter minus the number of currently active stories). See [TLDef(0xC387C04E)] public sealed partial class Stories_CanSendStoryCount : IObject { + /// Remaining active story slots. public int count_remains; } - /// See + /// Represents a custom pending suggestion ». See [TLDef(0xE7E82E12)] public sealed partial class PendingSuggestion : IObject { + /// The suggestion ID, can be passed to Help_DismissSuggestion. public string suggestion; + /// Title of the suggestion. public TextWithEntities title; + /// Body of the suggestion. public TextWithEntities description; + /// URL to open when the user clicks on the suggestion. public string url; } - /// See + /// An item of a todo list ». See [TLDef(0xCBA9A52F)] public sealed partial class TodoItem : IObject { + /// ID of the item, a positive (non-zero) integer unique within the current list. public int id; + /// Text of the item, maximum length equal to todo_item_length_max ». public TextWithEntities title; } - /// See + /// Represents a todo list ». See [TLDef(0x49B92A26)] public sealed partial class TodoList : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Title of the todo list, maximum length equal to todo_title_length_max ». public TextWithEntities title; + /// Items of the list. public TodoItem[] list; [Flags] public enum Flags : uint { + /// If set, users different from the creator of the list can append items to the list. others_can_append = 0x1, + /// If set, users different from the creator of the list can complete items in the list. others_can_complete = 0x2, } } - /// See + /// A completed todo list » item. See [TLDef(0x4CC120B7)] public sealed partial class TodoCompletion : IObject { + /// The ID of the completed item. public int id; + /// ID of the user that completed the item. public long completed_by; + /// When was the item completed. public DateTime date; } - /// See + /// Contains info about a suggested post ». See [TLDef(0x0E8E37E5)] public sealed partial class SuggestedPost : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Price of the suggested post. [IfFlag(3)] public StarsAmountBase price; + /// Scheduling date. [IfFlag(0)] public DateTime schedule_date; [Flags] public enum Flags : uint { /// Field has a value has_schedule_date = 0x1, + /// Whether the suggested post was accepted. accepted = 0x2, + /// Whether the suggested post was rejected. rejected = 0x4, /// Field has a value has_price = 0x8, } } - /// See + /// Represents the profile's star rating, see here » for more info. See [TLDef(0x1B0E4F07)] public sealed partial class StarsRating : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The current level, may be negative. public int level; + /// The numerical value of the rating required for the current level. public long current_level_stars; + /// Numerical value of the current rating. public long stars; + /// The numerical value of the rating required for the next level. [IfFlag(0)] public long next_level_stars; [Flags] public enum Flags : uint @@ -21105,16 +21455,21 @@ namespace TL } } - /// See + /// Represents a star gift collection ». See [TLDef(0x9D6B13B0)] public sealed partial class StarGiftCollection : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// The ID of the collection. public int collection_id; + /// Title of the collection. public string title; + /// Optional icon for the collection, taken from the first gift in the collection. [IfFlag(0)] public DocumentBase icon; + /// Number of gifts in the collection. public int gifts_count; + /// Field to use instead of collection_id when generating the hash to pass to Payments_GetStarGiftCollections. public long hash; [Flags] public enum Flags : uint @@ -21124,23 +21479,28 @@ namespace TL } } - /// See + /// Represents a list of star gift collections ». See /// a value means payments.starGiftCollectionsNotModified [TLDef(0x8A2932F3)] public sealed partial class Payments_StarGiftCollections : IObject { + /// Star gift collections. public StarGiftCollection[] collections; } - /// See + /// Represents a story album ». See [TLDef(0x9325705A)] public sealed partial class StoryAlbum : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// ID of the album. public int album_id; + /// Name of the album. public string title; + /// Photo from the first story of the album, if it's a photo. [IfFlag(0)] public PhotoBase icon_photo; + /// Video from the first story of the album, if it's a video. [IfFlag(1)] public DocumentBase icon_video; [Flags] public enum Flags : uint @@ -21152,134 +21512,168 @@ namespace TL } } - /// See + /// Story albums ». See /// a value means stories.albumsNotModified [TLDef(0xC3987A3A)] public sealed partial class Stories_Albums : IObject { + /// Hash to pass to Stories_GetAlbums to avoid returning any results if they haven't changed. public long hash; + /// The albums. public StoryAlbum[] albums; } - /// See + /// Indicates if the specified global post search » requires payment. See [TLDef(0x3E0B5B6A)] public sealed partial class SearchPostsFlood : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Total number of daily free search slots. public int total_daily; + /// Remaining number of free search slots. public int remains; + /// If there are no more search slots, specifies the unixtime when more search slots will be available. [IfFlag(1)] public int wait_till; + /// The number of Telegram Stars to pay for each non-free search. public long stars_amount; [Flags] public enum Flags : uint { + /// The specified query is free (and it will not use up free search slots). query_is_free = 0x1, /// Field has a value has_wait_till = 0x2, } } - /// See + /// Information about the value of a collectible gift ». See [TLDef(0x512FE446)] public sealed partial class Payments_UniqueStarGiftValueInfo : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + /// Three-letter ISO 4217 currency code (a localized fiat currency used to represent prices and price estimations in this constructor). public string currency; + /// Estimated value of the gift, in the smallest unit of the currency specified in currency. public long value; + /// Initial purchase date of the gift. public DateTime initial_sale_date; + /// Initial purchase price in Stars. public long initial_sale_stars; + /// Initial purchase price in the smallest unit of the currency specified in currency (automatically converted from initial_sale_stars). public long initial_sale_price; + /// Last resale date of the gift. [IfFlag(0)] public DateTime last_sale_date; + /// Last resale price, in the smallest unit of the currency specified in currency. [IfFlag(0)] public long last_sale_price; + /// The current minimum price of collectible gifts of the same type, in the smallest unit of the currency specified in currency. [IfFlag(2)] public long floor_price; + /// The current average sale price of collectible gifts of the same type, in the smallest unit of the currency specified in currency. [IfFlag(3)] public long average_price; + /// Number of gifts of the same type currently being resold on Telegram. [IfFlag(4)] public int listed_count; + /// Number of gifts of the same type currently being resold on fragment. [IfFlag(5)] public int fragment_listed_count; + /// Fragment link to the listing of gifts of the same type currently being resold on fragment. [IfFlag(5)] public string fragment_listed_url; [Flags] public enum Flags : uint { + /// Fields and have a value has_last_sale_date = 0x1, + /// If set, the last sale was completed on Fragment. last_sale_on_fragment = 0x2, + /// Field has a value has_floor_price = 0x4, + /// Field has a value has_average_price = 0x8, + /// Field has a value has_listed_count = 0x10, + /// Fields and have a value has_fragment_listed_count = 0x20, + /// If set, the value is calculated from the average value of sold gifts of the same type. Otherwise, it is based on the sale price of the gift. value_is_average = 0x40, } } - /// See + /// Represents a tab of a profile page ». See public enum ProfileTab : uint { - ///See + ///Represents the stories tab of a profile page. Posts = 0xB98CD696, - ///See + ///Represents the gifts tab of a profile page. Gifts = 0x4D4BD46A, - ///See + ///Represents the media tab of a profile page. Media = 0x72C64955, - ///See + ///Represents the shared files tab of a profile. Files = 0xAB339C00, - ///See + ///Represents the music tab of a profile page. Music = 0x9F27D26E, - ///See + ///Represents the voice messages tab of a profile page. Voice = 0xE477092E, - ///See + ///Represents the shared links tab of a profile page. Links = 0xD3656499, - ///See + ///Represents the gifs tab of a profile page. Gifs = 0xA2C0F695, } - /// See + /// List of songs (.ids) currently pinned on a user's profile, see here » for more info. See Derived classes: , public abstract partial class Users_SavedMusicBase : IObject { } - /// See + /// This subset of the songs currently pinned on a user's profile hasn't changed, see here » for more info. See [TLDef(0xE3878AA4)] public sealed partial class Users_SavedMusicNotModified : Users_SavedMusicBase { + /// Total number of songs on the user's profile. public int count; } - /// See + /// List of songs currently pinned on a user's profile, see here » for more info. See [TLDef(0x34A2F297)] public sealed partial class Users_SavedMusic : Users_SavedMusicBase { + /// Total number of songs (can be bigger than documents depending on the passed limit, and the default maximum limit in which case pagination is required). public int count; + /// Songs. public DocumentBase[] documents; } - /// See + /// List of IDs of songs (.ids) currently pinned on our profile, see here » for more info. See /// a value means account.savedMusicIdsNotModified [TLDef(0x998D6636)] public sealed partial class Account_SavedMusicIds : IObject { + /// Full list of .ids public long[] ids; } - /// See + /// Specifies if a gift can or cannot be sent. See Derived classes: , public abstract partial class Payments_CheckCanSendGiftResult : IObject { } - /// See + /// The specified gift can be sent. See [TLDef(0x374FA7AD)] public sealed partial class Payments_CheckCanSendGiftResultOk : Payments_CheckCanSendGiftResult { } - /// See + /// The specified gift cannot be sent yet for the specified reason. See [TLDef(0xD5E58274)] public sealed partial class Payments_CheckCanSendGiftResultFail : Payments_CheckCanSendGiftResult { + /// The reason why it can't be sent yet. public TextWithEntities reason; } - /// See + /// Specifies a chat theme ». See Derived classes: , /// a value means inputChatThemeEmpty public abstract partial class InputChatThemeBase : IObject { } - /// See + /// Set an emoji-based chat theme, returned by Account_GetChatThemes. See [TLDef(0xC93DE95C)] public sealed partial class InputChatTheme : InputChatThemeBase { + /// The emoji. public string emoticon; } - /// See + /// Set a theme based on an owned collectible gift », returned by Account_GetUniqueGiftChatThemes. See [TLDef(0x87E5DFE4)] public sealed partial class InputChatThemeUniqueGift : InputChatThemeBase { + /// The slug from .slug. public string slug; } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 804263a..ce2d58b 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -7,7 +7,7 @@ namespace TL { public static class SchemaExtensions { - /// Invokes a query after successful completion of one of the previous queries. See + /// Invokes a query after successful completion of one of the previous queries. See [bots: ✓] /// Message identifier on which a current query depends /// The query itself public static Task InvokeAfterMsg(this Client client, long msg_id, IMethod query) @@ -17,7 +17,7 @@ namespace TL query = query, }); - /// Invokes a query after a successful completion of previous queries See + /// Invokes a query after a successful completion of previous queries See [bots: ✓] /// List of messages on which a current query depends /// The query itself public static Task InvokeAfterMsgs(this Client client, long[] msg_ids, IMethod query) @@ -27,7 +27,7 @@ namespace TL query = query, }); - /// Initialize connection See Possible codes: 400 (details) + /// Initialize connection See [bots: ✓] Possible codes: 400 (details) /// Application identifier (see. App configuration) /// Device model /// Operation system version @@ -54,7 +54,7 @@ namespace TL query = query, }); - /// Invoke the specified query using the specified API layer See Possible codes: -504,400,403,406 (details) + /// Invoke the specified query using the specified API layer See [bots: ✓] Possible codes: 400,403,406 (details) /// The layer to use /// The query public static Task InvokeWithLayer(this Client client, int layer, IMethod query) @@ -64,7 +64,7 @@ namespace TL query = query, }); - /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See + /// Invoke a request without subscribing the used connection for updates (this is enabled by default for file queries). See [bots: ✓] /// The query public static Task InvokeWithoutUpdates(this Client client, IMethod query) => client.Invoke(new InvokeWithoutUpdates @@ -72,7 +72,7 @@ namespace TL query = query, }); - /// Invoke with the given message range See + /// Invoke with the given message range See [bots: ✓] /// Message range /// Query public static Task InvokeWithMessagesRange(this Client client, MessageRange range, IMethod query) @@ -82,7 +82,7 @@ namespace TL query = query, }); - /// Invoke a method within a takeout session, see here » for more info. See + /// Invoke a method within a takeout session, see here » for more info. See [bots: ✓] /// Takeout session ID » /// Query public static Task InvokeWithTakeout(this Client client, long takeout_id, IMethod query) @@ -92,7 +92,7 @@ namespace TL query = query, }); - /// Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor. See + /// Invoke a method using a Telegram Business Bot connection, see here » for more info, including a list of the methods that can be wrapped in this constructor. See [bots: ✓] /// Business connection ID. /// The actual query. public static Task InvokeWithBusinessConnection(this Client client, string connection_id, IMethod query) @@ -102,7 +102,7 @@ namespace TL query = query, }); - /// Official clients only, invoke with Google Play Integrity token. See + /// Official clients only, invoke with Google Play Integrity token. See [bots: ✓] /// Nonce. /// Token. /// Query. @@ -114,7 +114,7 @@ namespace TL query = query, }); - /// Official clients only, invoke with Apple push verification. See + /// Official clients only, invoke with Apple push verification. See [bots: ✓] /// Nonce. /// Secret. /// Query. @@ -126,7 +126,9 @@ namespace TL query = query, }); - /// See + /// Official clients only: re-execute a method call that required reCAPTCHA verification via a RECAPTCHA_CHECK_%s__%s, where the first placeholder is the action, and the second one is the reCAPTCHA key ID. See [bots: ✓] + /// reCAPTCHA token received after verification. + /// The original method call. public static Task InvokeWithReCaptcha(this Client client, string token, IMethod query) => client.Invoke(new InvokeWithReCaptcha { @@ -212,7 +214,7 @@ namespace TL bytes = bytes, }); - /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: -504,400 (details) + /// Binds a temporary authorization key temp_auth_key_id to the permanent authorization key perm_auth_key_id. Each permanent key may only be bound to one temporary key at a time, binding a new temporary key overwrites the previous one. See [bots: ✓] Possible codes: 400 (details) /// Permanent auth_key_id to bind to /// Random long from Binding message contents /// Unix timestamp to invalidate temporary key, see Binding message contents @@ -298,7 +300,7 @@ namespace TL except_auth_keys = except_auth_keys, }); - /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: -504,400 (details)
+ /// Generate a login token, for login via QR code.
The generated login token should be encoded using base64url, then shown as a tg://login?token=base64encodedtoken deep link » in the QR code. See Possible codes: 400 (details)
/// Application identifier (see. App configuration) /// Application identifier hash (see. App configuration) /// List of already logged-in user IDs, to prevent logging in twice with the same user @@ -452,7 +454,7 @@ namespace TL about = about, }); - /// Updates online user status. See Possible codes: -504 (details) + /// Updates online user status. See /// If is transmitted, user status will change to . public static Task Account_UpdateStatus(this Client client, bool offline) => client.Invoke(new Account_UpdateStatus @@ -1292,8 +1294,9 @@ namespace TL message = message, }); - /// Connect a business bot » to the current account, or to change the current connection settings. See Possible codes: 400,403 (details) + /// Connect a business bot » to the current account, or to change the current connection settings. See Possible codes: 400,403 (details) /// Whether to fully disconnect the bot from the current account. + /// Business bot rights. /// The bot to connect or disconnect /// Configuration for the business connection public static Task Account_UpdateConnectedBot(this Client client, InputUserBase bot, InputBusinessBotRecipients recipients, BusinessBotRights rights = null, bool deleted = false) @@ -1305,14 +1308,14 @@ namespace TL recipients = recipients, }); - /// List all currently connected business bots » See + /// List all currently connected business bots » See public static Task Account_GetConnectedBots(this Client client) => client.Invoke(new Account_GetConnectedBots { }); - /// Bots may invoke this method to re-fetch the associated with a specific business connection_id, see here » for more info on connected business bots.
This is needed for example for freshly logged in bots that are receiving some , etc. updates because some users have already connected to the bot before it could login.
In this case, the bot is receiving messages from the business connection, but it hasn't cached the associated with info about the connection (can it reply to messages? etc.) yet, and cannot receive the old ones because they were sent when the bot wasn't logged into the session yet.
This method can be used to fetch info about a not-yet-cached business connection, and should not be invoked if the info is already cached or to fetch changes, as eventual changes will automatically be sent as new updates to the bot using the usual update delivery methods ». See [bots: ✓] Possible codes: 400 (details)
- /// Business connection ID ». + /// Bots may invoke this method to re-fetch the associated with a specific business connection_id, see here » for more info on connected business bots.
This is needed for example for freshly logged in bots that are receiving some , etc. updates because some users have already connected to the bot before it could login.
In this case, the bot is receiving messages from the business connection, but it hasn't cached the associated with info about the connection (can it reply to messages? etc.) yet, and cannot receive the old ones because they were sent when the bot wasn't logged into the session yet.
This method can be used to fetch info about a not-yet-cached business connection, and should not be invoked if the info is already cached or to fetch changes, as eventual changes will automatically be sent as new updates to the bot using the usual update delivery methods ». See [bots: ✓] Possible codes: 400 (details)
+ /// Business connection ID ». public static Task Account_GetBotBusinessConnection(this Client client, string connection_id) => client.Invoke(new Account_GetBotBusinessConnection { @@ -1328,7 +1331,7 @@ namespace TL intro = intro, }); - /// Pause or unpause a specific chat, temporarily disconnecting it from all business bots ». See Possible codes: 400 (details) + /// Pause or unpause a specific chat, temporarily disconnecting it from all business bots ». See Possible codes: 400 (details) /// The chat to pause /// Whether to pause or unpause the chat public static Task Account_ToggleConnectedBotPaused(this Client client, InputPeer peer, bool paused) @@ -1338,7 +1341,7 @@ namespace TL paused = paused, }); - /// Permanently disconnect a specific chat from all business bots » (equivalent to specifying it in recipients.exclude_users during initial configuration with Account_UpdateConnectedBot); to reconnect of a chat disconnected using this method the user must reconnect the entire bot by invoking Account_UpdateConnectedBot. See Possible codes: 400 (details) + /// Permanently disconnect a specific chat from all business bots » (equivalent to specifying it in recipients.exclude_users during initial configuration with Account_UpdateConnectedBot); to reconnect of a chat disconnected using this method the user must reconnect the entire bot by invoking Account_UpdateConnectedBot. See Possible codes: 400 (details) /// The chat to disconnect public static Task Account_DisablePeerConnectedBot(this Client client, InputPeer peer) => client.Invoke(new Account_DisablePeerConnectedBot @@ -1425,7 +1428,8 @@ namespace TL settings = settings, }); - /// See + /// Obtain a list of emoji statuses » for owned collectible gifts. See + /// Hash for pagination /// a null value means account.emojiStatusesNotModified public static Task Account_GetCollectibleEmojiStatuses(this Client client, long hash = default) => client.Invoke(new Account_GetCollectibleEmojiStatuses @@ -1434,7 +1438,7 @@ namespace TL }); /// Get the number of stars we have received from the specified user thanks to paid messages »; the received amount will be equal to the sent amount multiplied by stars_paid_message_commission_permille divided by 1000. See Possible codes: 400 (details) - /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel. + /// If set, can contain the ID of a monoforum (channel direct messages) to obtain the number of stars the user has spent to send us direct messages via the channel. /// The user that paid to send us messages. public static Task Account_GetPaidMessagesRevenue(this Client client, InputUserBase user_id, InputPeer parent_peer = null) => client.Invoke(new Account_GetPaidMessagesRevenue @@ -1447,7 +1451,7 @@ namespace TL /// Allow a user to send us messages without paying if paid messages » are enabled. See Possible codes: 400 (details) /// If set and require_payment is not set, refunds the amounts the user has already paid us to send us messages (directly or via a monoforum). /// If set, requires the user to pay in order to send us messages.
Can only be set by monoforums, not users, i.e. parent_peer must be set if this flag is set; users must instead use the privacy setting to remove a previously added exemption.
If not set, allows the user to send us messages without paying (can be unset by both monoforums and users). - /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). + /// If set, applies the setting within the monoforum aka direct messages » (pass the ID of the monoforum, not the ID of the associated channel). /// The user to exempt or unexempt. public static Task Account_ToggleNoPaidMessagesException(this Client client, InputUserBase user_id, InputPeer parent_peer = null, bool refund_charged = false, bool require_payment = false) => client.Invoke(new Account_ToggleNoPaidMessagesException @@ -1457,14 +1461,18 @@ namespace TL user_id = user_id, }); - /// See + /// Changes the main profile tab of the current user, see here » for more info. See + /// The tab to set as main tab. public static Task Account_SetMainProfileTab(this Client client, ProfileTab tab) => client.Invoke(new Account_SetMainProfileTab { tab = tab, }); - /// See + /// Adds or removes a song from the current user's profile see here » for more info on the music tab of the profile page. See Possible codes: 400 (details) + /// If set, removes the song. + /// The song to add or remove; can be an already added song when reordering songs with after_id. Adding an already added song will never re-add it, only move it to the top of the song list (or after the song passed in after_id). + /// If set, the song will be added after the passed song (must be already pinned on the profile). public static Task Account_SaveMusic(this Client client, InputDocument id, InputDocument after_id = null, bool unsave = false) => client.Invoke(new Account_SaveMusic { @@ -1473,7 +1481,8 @@ namespace TL after_id = after_id, }); - /// See + /// Fetch the full list of only the IDs of songs currently added to the profile, see here » for more info. See + /// Hash generated » from the previously returned list of IDs. /// a null value means account.savedMusicIdsNotModified public static Task Account_GetSavedMusicIds(this Client client, long hash = default) => client.Invoke(new Account_GetSavedMusicIds @@ -1481,7 +1490,10 @@ namespace TL hash = hash, }); - /// See + /// Obtain all chat themes » associated to owned collectible gifts ». See + /// Offset for pagination. + /// Maximum number of results to return, see pagination + /// Hash from a previously returned , to avoid returning any result if the theme list hasn't changed. /// a null value means account.chatThemesNotModified public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Account_GetUniqueGiftChatThemes @@ -1491,7 +1503,7 @@ namespace TL hash = hash, }); - /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: -504,400 (details) + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) => client.Invoke(new Users_GetUsers @@ -1499,7 +1511,7 @@ namespace TL id = id, }); - /// Returns extended user info by ID. See [bots: ✓] Possible codes: -504,400 (details) + /// Returns extended user info by ID. See [bots: ✓] Possible codes: 400 (details) /// User ID public static Task Users_GetFullUser(this Client client, InputUserBase id) => client.Invoke(new Users_GetFullUser @@ -1507,7 +1519,7 @@ namespace TL id = id, }); - /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓] Possible codes: 400,403 (details) + /// Notify the user that the sent passport data contains some errors The user will not be able to re-submit their Passport data to you until the errors are fixed (the contents of the field for which you returned the error must change). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The user /// Errors public static Task Users_SetSecureValueErrors(this Client client, InputUserBase id, params SecureValueErrorBase[] errors) @@ -1525,7 +1537,11 @@ namespace TL id = id, }); - /// See + /// Get songs pinned to the user's profile, see here » for more info. See Possible codes: 400 (details) + /// The ID of the user. + /// Offset for pagination. + /// Maximum number of results to return, see pagination + /// Hash » of the IDs of previously added songs, to avoid returning any result if there was no change. public static Task Users_GetSavedMusic(this Client client, InputUserBase id, int offset = default, int limit = int.MaxValue, long hash = default) => client.Invoke(new Users_GetSavedMusic { @@ -1535,7 +1551,9 @@ namespace TL hash = hash, }); - /// See + /// Check if the passed songs are still pinned to the user's profile, or refresh the file references of songs pinned on a user's profile see here » for more info. See Possible codes: 400 (details) + /// The ID of the user. + /// The songs (here, file_reference can be empty to refresh file references). public static Task Users_GetSavedMusicByID(this Client client, InputUserBase id, params InputDocument[] documents) => client.Invoke(new Users_GetSavedMusicByID { @@ -1632,7 +1650,7 @@ namespace TL limit = limit, }); - /// Resolve a @username to get peer info See [bots: ✓] Possible codes: -504,400 (details) + /// Resolve a @username to get peer info See [bots: ✓] Possible codes: 400 (details) /// @username to resolve /// Referrer ID from referral links ». public static Task Contacts_ResolveUsername(this Client client, string username, string referer = null) @@ -1792,7 +1810,8 @@ namespace TL { }); - /// See Possible codes: 400 (details) + /// Obtain a list of sponsored peer search results for a given query See Possible codes: 400 (details) + /// The query /// a null value means contacts.sponsoredPeersEmpty public static Task Contacts_GetSponsoredPeers(this Client client, string q) => client.Invoke(new Contacts_GetSponsoredPeers @@ -1800,7 +1819,7 @@ namespace TL 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: ✓] Possible codes: -504 (details)
+ /// 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) => client.Invoke(new Messages_GetMessages @@ -1808,7 +1827,7 @@ namespace TL id = id, }); - /// Returns the current user dialog list. See Possible codes: -504,400,403 (details) + /// Returns the current user dialog list. See Possible codes: 400,403 (details) /// Exclude pinned dialogs /// Peer folder ID, for more info click here /// Offsets for pagination, for more info click here @@ -1828,7 +1847,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: -504,400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -1932,7 +1951,7 @@ namespace TL max_id = max_id, }); - /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Sends a current user typing event (see for all event types) to a conversation partner or group. See [bots: ✓] Possible codes: 400,403,406 (details) /// Target user or group /// Topic ID /// Type of action @@ -1945,7 +1964,7 @@ namespace TL action = action, }); - /// Sends a message to a chat See [bots: ✓] Possible codes: -504,400,403,404,406,420,500 (details) + /// Sends a message to a chat See [bots: ✓] Possible codes: 400,403,404,406,420,500 (details) /// Set this flag to disable generation of the webpage preview /// Send this message silently (no notifications for the receivers) /// Send this message as background message @@ -1965,6 +1984,7 @@ namespace TL /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { @@ -1983,7 +2003,7 @@ namespace TL suggested_post = suggested_post, }); - /// Send a media See [bots: ✓] Possible codes: -504,400,403,406,420,500 (details) + /// Send a media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Send message silently (no notification should be triggered) /// Send message in background /// Clear the draft @@ -2003,6 +2023,7 @@ namespace TL /// Add the message to the specified quick reply shortcut », instead. /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { @@ -2035,10 +2056,13 @@ namespace TL /// Random ID to prevent resending of messages You can use /// Destination peer /// Destination forum topic + /// Can only contain an , to forward messages to a monoforum topic (mutually exclusive with top_msg_id). /// Scheduled message date for scheduled messages /// Forward the messages as the specified peer /// Add the messages to the specified quick reply shortcut », instead. + /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { @@ -2282,7 +2306,7 @@ namespace TL peer = peer, }); - /// 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
Notifies the sender about the recipient having listened a voice message or watched a video. See
+ /// 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
Notifies the sender about the recipient having listened a voice message or watched a video, emitting an . See
/// Message ID list public static Task Messages_ReadMessageContents(this Client client, params int[] id) => client.InvokeAffected(new Messages_ReadMessageContents @@ -2340,7 +2364,7 @@ namespace TL subscription_pricing = subscription_pricing, }); - /// Check the validity of a chat invite link and get basic info about it See Possible codes: -504,400,406 (details) + /// Check the validity of a chat invite link and get basic info about it See Possible codes: 400,406 (details) /// Invite hash from chat invite deep link ». public static Task Messages_CheckChatInvite(this Client client, string hash) => client.Invoke(new Messages_CheckChatInvite @@ -2399,7 +2423,7 @@ namespace TL start_param = start_param, }); - /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: -504,400,406 (details) + /// Get and increase the view counter of a message sent or forwarded from a channel See Possible codes: 400,406 (details) /// Peer where the message was found /// ID of message /// Whether to mark the message as viewed and increment the view counter @@ -2440,7 +2464,7 @@ namespace TL /// Global search filter /// If a positive value was specified, the method will return only messages with date bigger than min_date /// If a positive value was transferred, the method will return only messages with date smaller than max_date - /// Initially 0, then set to the next_rate parameter of messages.messagesSlice + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here @@ -2518,7 +2542,7 @@ namespace TL offset = offset, }); - /// Answer an inline query, for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Answer an inline query, for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the results are composed of media files /// Set this flag if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query /// Unique identifier for the answered query @@ -2638,7 +2662,7 @@ namespace TL password = password, }); - /// Set the callback answer to a user button press (bots only) See [bots: ✓] Possible codes: 400 (details) + /// Set the callback answer to a user button press (bots only) See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Whether to show the message as a popup instead of a toast notification /// Query ID /// Popup to show @@ -2654,7 +2678,7 @@ namespace TL cache_time = cache_time, }); - /// Get dialog info of specified peers See Possible codes: -504,400,406 (details) + /// Get dialog info of specified peers See Possible codes: 400,406 (details) /// Peers public static Task Messages_GetPeerDialogs(this Client client, params InputDialogPeerBase[] peers) => client.Invoke(new Messages_GetPeerDialogs @@ -2671,6 +2695,7 @@ namespace TL /// Message entities for styled text /// Attached media /// Specifies a message effect » to use for the message. + /// Used to suggest a post to a channel, see here » for more info on the full flow. public static Task Messages_SaveDraft(this Client client, InputPeer peer, string message, MessageEntity[] entities = null, InputReplyTo reply_to = null, InputMedia media = null, long? effect = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_SaveDraft { @@ -2767,7 +2792,7 @@ namespace TL media = media, }); - /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: ✓] Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as a normal message (bots only). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// Unique identifier of target chat @@ -2784,7 +2809,7 @@ namespace TL score = score, }); - /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: ✓] Possible codes: 400 (details) + /// Use this method to set the score of the specified user in a game sent as an inline message (bots only). See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Set this flag if the game message should be automatically edited to include the current scoreboard /// Set this flag if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters /// ID of the inline message @@ -2799,7 +2824,7 @@ namespace TL score = score, }); - /// Get highscores of a game See [bots: ✓] Possible codes: 400 (details) + /// Get highscores of a game See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Where was the game sent /// ID of message with game media attachment /// Get high scores made by a certain user @@ -2811,7 +2836,7 @@ namespace TL user_id = user_id, }); - /// Get highscores of a game sent using an inline bot See [bots: ✓] Possible codes: 400 (details) + /// Get highscores of a game sent using an inline bot See [bots: ✓ users: ✗] Possible codes: 400 (details) /// ID of inline message /// Get high scores of a certain user public static Task Messages_GetInlineGameHighScores(this Client client, InputBotInlineMessageIDBase id, InputUserBase user_id) @@ -2873,7 +2898,7 @@ namespace TL folder_id = folder_id, }); - /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See [bots: ✓] Possible codes: 400 (details) + /// If you sent an invoice requesting a shipping address and the parameter is_flexible was specified, the bot will receive an update. Use this method to reply to shipping queries. See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Unique identifier for the query to be answered /// Error message in human readable form that explains why it is impossible to complete the order (e.g. "Sorry, delivery to your desired address is unavailable"). Telegram will display this message to the user. /// A vector of available shipping options. @@ -2886,7 +2911,7 @@ namespace TL shipping_options = shipping_options, }); - /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See [bots: ✓] Possible codes: 400 (details)
+ /// Once the user has confirmed their payment and shipping details, the bot receives an update.
Use this method to respond to such pre-checkout queries.
Note: Telegram must receive an answer within 10 seconds after the pre-checkout query was sent. See [bots: ✓ users: ✗] Possible codes: 400 (details)
/// Set this flag if everything is alright (goods are available, etc.) and the bot is ready to proceed with the order, otherwise do not set it, and set the error field, instead /// Unique identifier for the query to be answered /// Required if the success isn't set. Error message in human readable form that explains the reason for failure to proceed with the checkout (e.g. "Sorry, somebody just bought the last of our amazing black T-shirts while you were busy filling out your payment details. Please choose a different color or garment!"). Telegram will display this message to the user. @@ -2898,8 +2923,8 @@ namespace TL error = error, }); - /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: -504,400,403 (details) - /// Whether the media will be used only in the specified business connection », and not directly by the bot. + /// Upload a file and associate it to a chat (without actually sending it to the chat) See [bots: ✓] Possible codes: 400,403 (details) + /// Whether the media will be used only in the specified business connection », and not directly by the bot. /// The chat, can be for bots and for users. /// File uploaded in chunks as described in files » /// a null value means messageMediaEmpty @@ -2943,7 +2968,7 @@ namespace TL unfave = unfave, }); - /// Get unread messages where we were mentioned See Possible codes: -504,400 (details) + /// Get unread messages where we were mentioned See Possible codes: 400 (details) /// Peer where to look for mentions /// If set, considers only messages within the specified forum topic /// Offsets for pagination, for more info click here @@ -2964,7 +2989,7 @@ namespace TL min_id = min_id, }); - /// Mark mentions as read See Possible codes: -504,400 (details) + /// Mark mentions as read See Possible codes: 400 (details) /// Dialog /// Mark as read only mentions within the specified forum topic public static Task Messages_ReadMentions(this Client client, InputPeer peer, int? top_msg_id = null) @@ -3017,7 +3042,7 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Upload encrypted file and associate it to a secret chat See Possible codes: 400 (details) + /// Upload encrypted file and associate it to a secret chat (without actually sending it to the chat). See Possible codes: 400 (details) /// The secret chat to associate the file to /// The file /// a null value means encryptedFileEmpty @@ -3049,6 +3074,7 @@ namespace TL /// Manually mark dialog as unread See Possible codes: 400 (details) /// Mark as unread/read + /// If set, must be equal to the ID of a monoforum, and will affect the monoforum topic passed in peer. /// Dialog public static Task Messages_MarkDialogUnread(this Client client, InputDialogPeerBase peer, InputPeer parent_peer = null, bool unread = false) => client.Invoke(new Messages_MarkDialogUnread @@ -3059,6 +3085,7 @@ namespace TL }); /// Get dialogs manually marked as unread See + /// Can be equal to the ID of a monoforum, to fetch monoforum topics manually marked as unread. public static Task Messages_GetDialogUnreadMarks(this Client client, InputPeer parent_peer = null) => client.Invoke(new Messages_GetDialogUnreadMarks { @@ -3228,7 +3255,7 @@ namespace TL /// Get scheduled messages See Possible codes: 400 (details) /// Peer - /// Hash used for caching, for more info click here.
To generate the hash, populate the ids array with the id, date and edit_date (in this order) of the previously returned messages (in order, i.e. ids = [id1, date1, edit_date1, id2, date2, edit_date2, ...]). + /// Hash used for caching, for more info click here.
To generate the hash, populate the ids array with the id, edit_date (0 if unedited) and date (in this order) of the previously returned messages (in order, i.e. ids = [id1, (edit_date1 ?? 0), date1, id2, (edit_date2 ?? 0), date2, ...]). public static Task Messages_GetScheduledHistory(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Messages_GetScheduledHistory { @@ -3387,6 +3414,7 @@ namespace TL /// Unpin all pinned messages See [bots: ✓] Possible codes: 400 (details) /// Chat where to unpin /// Forum topic where to unpin + /// If set, must be equal to the ID of a monoforum topic, and will unpin all messages pinned in the passed monoforum topic. public static Task Messages_UnpinAllMessages(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_UnpinAllMessages { @@ -3572,8 +3600,9 @@ namespace TL peer = peer, }); - /// Change the chat theme of a certain chat See Possible codes: 400 (details) + /// Change the chat theme of a certain chat, see here » for more info. See Possible codes: 400 (details) /// Private chat where to change theme + /// The theme to set. public static Task Messages_SetChatTheme(this Client client, InputPeer peer, InputChatThemeBase theme) => client.Invoke(new Messages_SetChatTheme { @@ -3669,12 +3698,12 @@ namespace TL send_as = send_as, }); - /// React to message. See Possible codes: 400,403 (details) + /// React to message. See [bots: ✓] Possible codes: 400,403 (details) /// Whether a bigger and longer reaction should be shown /// Whether to add this reaction to the recent reactions list ». /// Peer /// Message ID to react to - /// A list of reactions + /// A list of reactions (doesn't accept s, use Messages_SendPaidReaction to send paid reactions, instead). public static Task Messages_SendReaction(this Client client, InputPeer peer, int msg_id, Reaction[] reaction = null, bool big = false, bool add_to_recent = false) => client.Invoke(new Messages_SendReaction { @@ -3761,6 +3790,7 @@ namespace TL /// Get unread reactions to messages you sent See Possible codes: 400 (details) /// Peer /// If set, considers only reactions to messages within the specified forum topic + /// If set, must be equal to the ID of a monoforum topic: will affect that topic in the monoforum passed in peer. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination @@ -3783,6 +3813,7 @@ namespace TL /// Mark message reactions » as read See Possible codes: 400 (details) /// Peer /// Mark as read only reactions to messages within the specified forum topic + /// If set, must be equal to the ID of a monoforum topic: will affect that topic in the monoforum passed in peer. public static Task Messages_ReadReactions(this Client client, InputPeer peer, int? top_msg_id = null, InputPeer saved_peer_id = null) => client.InvokeAffected(new Messages_ReadReactions { @@ -3899,7 +3930,7 @@ namespace TL platform = platform, }); - /// 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
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓] Possible codes: 400 (details)
+ /// 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
Terminate webview interaction started with Messages_RequestWebView, sending the specified message to the chat on behalf of the user. See [bots: ✓ users: ✗] Possible codes: 400 (details)
/// Webview interaction ID obtained from Messages_RequestWebView /// Message to send public static Task Messages_SendWebViewResultMessage(this Client client, string bot_query_id, InputBotInlineResultBase result) @@ -4158,8 +4189,9 @@ namespace TL hash = hash, }); - /// Returns the current saved dialog list, see here » for more info. See + /// Returns the current saved dialog list » or monoforum topic list ». See /// Exclude pinned dialogs + /// If set, fetches the topic list of the passed monoforum, otherwise fetches the saved dialog list. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here (top_message ID used for pagination) /// Offset peer for pagination @@ -4177,8 +4209,9 @@ namespace TL hash = hash, }); - /// Returns saved messages » forwarded from a specific peer See Possible codes: 400 (details) - /// Target peer + /// Fetch saved messages » forwarded from a specific peer, or fetch messages from a monoforum topic ». See Possible codes: 400 (details) + /// If set, fetches messages from the specified monoforum, otherwise fetches from saved messages. + /// Target peer (or topic) /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date /// Number of list elements to be skipped, negative values are also accepted. @@ -4201,8 +4234,9 @@ namespace TL hash = hash, }); - /// Deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) - /// Peer, whose messages will be deleted from saved messages » + /// Deletes messages from a monoforum topic », or deletes messages forwarded from a specific peer to saved messages ». See Possible codes: 400 (details) + /// If set, affects the messages of the passed monoforum topic », otherwise affects saved messages ». + /// Peer, whose messages will be deleted from saved messages », or the ID of the topic. /// Maximum ID of message to delete /// Delete all messages newer than this UNIX timestamp /// Delete all messages older than this UNIX timestamp @@ -4331,7 +4365,7 @@ namespace TL /// 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
Fetch (a subset or all) messages in a quick reply shortcut ». See Possible codes: 400 (details)
/// Quick reply shortcut ID. /// IDs of the messages to fetch, if empty fetches all of them. - /// Hash used for caching, for more info click here + /// Hash for pagination, generated as specified here » (not the usual algorithm used for hash generation). public static Task Messages_GetQuickReplyMessages(this Client client, int shortcut_id, long hash = default, int[] id = null) => client.Invoke(new Messages_GetQuickReplyMessages { @@ -4452,12 +4486,12 @@ namespace TL platform = platform, }); - /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400 (details) + /// Sends one or more paid Telegram Star reactions », transferring Telegram Stars » to a channel's balance. See Possible codes: 400,403 (details) /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). - /// Unique client message ID required to prevent message resending You can use - /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy.
If the user explicitly chose to make their paid reaction(s) private, pass to Messages_SendPaidReaction.private.
If the user explicitly chose to make their paid reaction(s) not private, pass to Messages_SendPaidReaction.private.
If the user did not make any explicit choice about the privacy of their paid reaction(s) (i.e. when reacting by clicking on an existing star reaction on a message), do not populate the Messages_SendPaidReaction.private flag. + /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the first 32 bits are random, and the remaining 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use + /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy. Not populating this field will use the default reaction privacy, stored on the server and synced to clients using (see here for more info). public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction { @@ -4487,7 +4521,7 @@ namespace TL { }); - /// Mark a specific sponsored message » as read See Possible codes: -504 (details) + /// Mark a specific sponsored message » as read See /// The ad's unique ID. public static Task Messages_ViewSponsoredMessage(this Client client, byte[] random_id) => client.Invoke(new Messages_ViewSponsoredMessage @@ -4518,6 +4552,7 @@ namespace TL /// Get a list of sponsored messages for a peer, see here » for more info. See Possible codes: 400 (details) /// The currently open channel/bot. + /// Must be set when fetching sponsored messages to show on channel videos ». /// a null value means messages.sponsoredMessagesEmpty public static Task Messages_GetSponsoredMessages(this Client client, InputPeer peer, int? msg_id = null) => client.Invoke(new Messages_GetSponsoredMessages @@ -4527,7 +4562,7 @@ namespace TL msg_id = msg_id ?? default, }); - /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓] Possible codes: 400 (details) + /// Save a prepared inline message, to be shared by the user of the mini app using a web_app_send_prepared_message event See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The message /// The user to whom the web_app_send_prepared_message event event will be sent /// Types of chats where this message can be sent @@ -4571,7 +4606,9 @@ namespace TL }); /// Used for Telegram Gateway verification messages »: indicate to the server that one or more s were received by the client, if requested by the .report_delivery_until_date flag or the equivalent flag in push notifications. See Possible codes: 400 (details) - /// If set, + /// Must be set if the messages were received from a push notification. + /// The peer where the messages were received. + /// The IDs of the received messages. public static Task Messages_ReportMessagesDelivery(this Client client, InputPeer peer, int[] id, bool push = false) => client.Invoke(new Messages_ReportMessagesDelivery { @@ -4580,7 +4617,9 @@ namespace TL id = id, }); - /// See + /// Obtain information about specific saved message dialogs » or monoforum topics ». See + /// If set, fetches monoforum topics », otherwise fetches saved message dialogs ». + /// IDs of dialogs (topics) to fetch. public static Task Messages_GetSavedDialogsByID(this Client client, InputPeer[] ids, InputPeer parent_peer = null) => client.Invoke(new Messages_GetSavedDialogsByID { @@ -4589,7 +4628,10 @@ namespace TL ids = ids, }); - /// See Possible codes: 400 (details) + /// Mark messages as read in a monoforum topic ». See Possible codes: 400 (details) + /// ID of the monoforum group. + /// ID of the topic. + /// If a positive value is passed, only messages with identifiers less or equal than the given one will be read. public static Task Messages_ReadSavedHistory(this Client client, InputPeer parent_peer, InputPeer peer, int max_id = default) => client.Invoke(new Messages_ReadSavedHistory { @@ -4598,7 +4640,11 @@ namespace TL max_id = max_id, }); - /// See Possible codes: 400 (details) + /// Mark one or more items of a todo list » as completed or not completed. See Possible codes: 400 (details) + /// Peer where the todo list was posted. + /// ID of the message with the todo list. + /// Items to mark as completed. + /// Items to mark as not completed. public static Task Messages_ToggleTodoCompleted(this Client client, InputPeer peer, int msg_id, int[] completed, params int[] incompleted) => client.Invoke(new Messages_ToggleTodoCompleted { @@ -4608,7 +4654,10 @@ namespace TL incompleted = incompleted, }); - /// See Possible codes: 400 (details) + /// Appends one or more items to a todo list ». See Possible codes: 400 (details) + /// Peer where the todo list was posted. + /// ID of the message with the todo list. + /// Items to append. public static Task Messages_AppendTodoList(this Client client, InputPeer peer, int msg_id, params TodoItem[] list) => client.Invoke(new Messages_AppendTodoList { @@ -4617,7 +4666,12 @@ namespace TL list = list, }); - /// See Possible codes: 400 (details) + /// Approve or reject a suggested post ». See [bots: ✓] Possible codes: 400 (details) + /// Reject the suggested post. + /// Both for users and channels, must contain the ID of the direct messages monoforum » (for channels, the topic ID is extracted automatically from the msg_id). + /// ID of the suggestion message. + /// Custom scheduling date. + /// Optional comment for rejections (can only be used if reject is set). public static Task Messages_ToggleSuggestedPostApproval(this Client client, InputPeer peer, int msg_id, DateTime? schedule_date = null, string reject_comment = null, bool reject = false) => client.Invoke(new Messages_ToggleSuggestedPostApproval { @@ -4628,13 +4682,13 @@ namespace TL reject_comment = reject_comment, }); - /// Returns a current state of updates. See [bots: ✓] Possible codes: -504 (details) + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState { }); - /// Get new updates. See [bots: ✓] Possible codes: -504,400,403,500 (details) + /// Get new updates. See [bots: ✓] Possible codes: 400,403,500 (details) /// PTS, see updates. /// PTS limit /// For fast updating: if provided and pts + pts_total_limit < remote pts, will be returned.
Simply tells the server to not return the difference if it is bigger than pts_total_limit
If the remote pts is too big (> ~4000000), this field will default to 1000000 @@ -4653,7 +4707,7 @@ namespace TL qts_limit = qts_limit ?? default, }); - /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: -504,400,403,406,500 (details) + /// Returns the difference between the current state of updates of a certain channel and transmitted. See [bots: ✓] Possible codes: 400,403,406,500 (details) /// Set to true to skip some possibly unneeded updates and reduce server-side load /// The channel /// Messsage filter @@ -4710,7 +4764,7 @@ namespace TL /// Returns the list of user photos. See [bots: ✓] Possible codes: 400 (details) /// User ID /// Number of list elements to be skipped - /// If a positive value was transferred, the method will return only photos with IDs less than the set one. This parameter is often useful when refetching file references », as in conjuction with limit=1 and offset=-1 the object with the id specified in max_id can be fetched. + /// If a positive value was transferred, the method will return only photos with IDs less than the set one. This parameter is often useful when refetching file references », as in conjuction with limit=1 and offset=-1 the object with the id specified in max_id can be fetched. /// Number of list elements to be returned public static Task Photos_GetUserPhotos(this Client client, InputUserBase user_id, int offset = default, long max_id = default, int limit = int.MaxValue) => client.Invoke(new Photos_GetUserPhotos @@ -4815,7 +4869,7 @@ namespace TL request_token = request_token, }); - /// Get SHA256 hashes for verifying downloaded CDN files See [bots: ✓] Possible codes: -504,400 (details) + /// 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, long offset = default) @@ -4835,7 +4889,7 @@ namespace TL offset = offset, }); - /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: -504,400,403 (details) + /// Returns current configuration, including data center configuration. See [bots: ✓] Possible codes: 400,403 (details) public static Task Help_GetConfig(this Client client) => client.Invoke(new Help_GetConfig { @@ -4868,7 +4922,7 @@ namespace TL { }); - /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓] Possible codes: 400 (details) + /// Informs the server about the number of pending bot updates if they haven't been processed for a long time; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Number of pending updates /// Error message, if present public static Task Help_SetBotUpdatesStatus(this Client client, int pending_updates_count, string message) @@ -4878,7 +4932,7 @@ namespace TL message = message, }); - /// Get configuration for CDN file downloads. See [bots: ✓] Possible codes: -504 (details) + /// Get configuration for CDN file downloads. See [bots: ✓] public static Task Help_GetCdnConfig(this Client client) => client.Invoke(new Help_GetCdnConfig { @@ -4969,7 +5023,7 @@ namespace TL entities = entities, }); - /// Get MTProxy/Public Service Announcement information See + /// Returns a set of useful suggestions and PSA/MTProxy sponsored peers, see here » for more info. See public static Task Help_GetPromoData(this Client client) => client.Invoke(new Help_GetPromoData { @@ -5037,7 +5091,7 @@ namespace TL hash = hash, }); - /// Mark channel/supergroup history as read See Possible codes: -504,400,406 (details) + /// Mark channel/supergroup history as read See Possible codes: 400,406 (details) /// Channel/supergroup /// ID of message up to which messages should be marked as read public static Task Channels_ReadHistory(this Client client, InputChannelBase channel, int max_id = default) @@ -5069,7 +5123,7 @@ namespace TL id = id, }); - /// Get channel/supergroup messages See [bots: ✓] Possible codes: -504,400,406 (details) + /// Get channel/supergroup messages See [bots: ✓] Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages to get public static Task Channels_GetMessages(this Client client, InputChannelBase channel, params InputMessage[] id) @@ -5079,7 +5133,7 @@ namespace TL id = id, }); - /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Get the participants of a supergroup/channel See [bots: ✓] Possible codes: 400,403,406 (details) /// Channel /// Which participant types to fetch /// Offset @@ -5106,7 +5160,7 @@ namespace TL participant = participant, }); - /// Get info about channels/supergroups See [bots: ✓] Possible codes: -504,400,406 (details) + /// Get info about channels/supergroups See [bots: ✓] Possible codes: 400,406 (details) /// IDs of channels/supergroups to get info about public static Task Channels_GetChannels(this Client client, params InputChannelBase[] id) => client.Invoke(new Channels_GetChannels @@ -5114,7 +5168,7 @@ namespace TL id = id, }); - /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: -504,400,403,406 (details) + /// Get full info about a supergroup, gigagroup or channel See [bots: ✓] Possible codes: 400,403,406 (details) /// The channel, supergroup or gigagroup to get info about public static Task Channels_GetFullChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFullChannel @@ -5197,7 +5251,7 @@ namespace TL username = username, }); - /// Join a channel/supergroup See Possible codes: -504,400,406,420 (details) + /// Join a channel/supergroup See Possible codes: 400,406,420 (details) /// Channel/supergroup to join public static Task Channels_JoinChannel(this Client client, InputChannelBase channel) => client.Invoke(new Channels_JoinChannel @@ -5308,7 +5362,7 @@ namespace TL stickerset = stickerset, }); - /// Mark channel/supergroup message contents as read See Possible codes: 400,406 (details) + /// Mark channel/supergroup message contents as read, emitting an . See Possible codes: 400,406 (details) /// Channel/supergroup /// IDs of messages whose contents should be marked as read public static Task Channels_ReadMessageContents(this Client client, InputChannelBase channel, params int[] id) @@ -5413,6 +5467,7 @@ namespace TL }); /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) + /// If set, fetches the list of peers that can be used to send paid reactions to messages of a specific peer. /// The group where we intend to send messages public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false) => client.Invoke(new Channels_GetSendAs @@ -5484,6 +5539,7 @@ namespace TL /// Enable or disable forum functionality in a supergroup. See Possible codes: 400 (details) /// Supergroup ID /// Enable or disable forum functionality + /// If true enables the tabbed forum UI, otherwise enables the list-based forum UI. public static Task Channels_ToggleForum(this Client client, InputChannelBase channel, bool enabled, bool tabs) => client.Invoke(new Channels_ToggleForum { @@ -5647,7 +5703,7 @@ namespace TL enabled = enabled, }); - /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: -504,400 (details) + /// Obtain a list of similarly themed public channels, selected based on similarities in their subscriber bases. See Possible codes: 400 (details) /// The method will return channels related to the passed channel. If not set, the method will returns channels related to channels the user has joined. public static Task Channels_GetChannelRecommendations(this Client client, InputChannelBase channel = null) => client.Invoke(new Channels_GetChannelRecommendations @@ -5696,12 +5752,14 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing a specific hashtag. See Possible codes: 420 (details) + /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 420 (details) /// The hashtag to search, without the # character. - /// Initially 0, then set to the next_rate parameter of messages.messagesSlice + /// The full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow. + /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. /// Offsets for pagination, for more info click here /// Offsets for pagination, for more info click here /// Maximum number of results to return, see pagination + /// For full text post searches (query), allows payment of the specified amount of Stars for the search, see here » for more info on the full flow. public static Task Channels_SearchPosts(this Client client, int offset_rate = default, InputPeer offset_peer = null, int offset_id = default, int limit = int.MaxValue, string hashtag = null, string query = null, long? allow_paid_stars = null) => client.Invoke(new Channels_SearchPosts { @@ -5715,8 +5773,8 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) - /// Only usable for channels, enables or disables the associated monoforum aka direct messages. + /// Enable or disable paid messages » in this supergroup or monoforum. See Possible codes: 400 (details) + /// Only usable for channels, enables or disables the associated monoforum aka direct messages. /// Pass the supergroup ID for supergroups and the ID of the channel to modify the setting in the associated monoforum. /// Specifies the required amount of Telegram Stars users must pay to send messages to the supergroup or monoforum. public static Task Channels_UpdatePaidMessagesPrice(this Client client, InputChannelBase channel, long send_paid_messages_stars, bool broadcast_messages_allowed = false) @@ -5727,7 +5785,9 @@ namespace TL send_paid_messages_stars = send_paid_messages_stars, }); - /// See Possible codes: 400 (details) + /// Toggle autotranslation in a channel, for all users: see here » for more info. See Possible codes: 400 (details) + /// The channel where to toggle autotranslation. + /// Whether to enable or disable autotranslation. public static Task Channels_ToggleAutotranslation(this Client client, InputChannelBase channel, bool enabled) => client.Invoke(new Channels_ToggleAutotranslation { @@ -5735,7 +5795,9 @@ namespace TL enabled = enabled, }); - /// See Possible codes: 400 (details) + /// Can only be invoked by non-bot admins of a monoforum », obtains the original sender of a message sent by other monoforum admins to the monoforum, on behalf of the channel associated to the monoforum. See Possible codes: 400 (details) + /// ID of the monoforum. + /// ID of the message sent by a monoforum admin. public static Task Channels_GetMessageAuthor(this Client client, InputChannelBase channel, int id) => client.Invoke(new Channels_GetMessageAuthor { @@ -5743,7 +5805,8 @@ namespace TL id = id, }); - /// See + /// Check if the specified global post search » requires payment. See + /// The query. public static Task Channels_CheckSearchPostsFlood(this Client client, string query = null) => client.Invoke(new Channels_CheckSearchPostsFlood { @@ -5751,7 +5814,9 @@ namespace TL query = query, }); - /// See + /// Changes the main profile tab of a channel, see here » for more info. See Possible codes: 400 (details) + /// The channel. + /// The tab to set as main tab. public static Task Channels_SetMainProfileTab(this Client client, InputChannelBase channel, ProfileTab tab) => client.Invoke(new Channels_SetMainProfileTab { @@ -5759,7 +5824,7 @@ namespace TL tab = tab, }); - /// Sends a custom request; for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters public static Task Bots_SendCustomRequest(this Client client, string custom_method, DataJSON params_) @@ -5769,7 +5834,7 @@ namespace TL params_ = params_, }); - /// Answers a custom query; for bots only See [bots: ✓] Possible codes: 400,403 (details) + /// Answers a custom query; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Identifier of a custom query /// JSON-serialized answer to the query public static Task Bots_AnswerWebhookJSONQuery(this Client client, long query_id, DataJSON data) @@ -5779,7 +5844,7 @@ namespace TL data = data, }); - /// Set bot command list See [bots: ✓] Possible codes: 400 (details) + /// Set bot command list See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code /// Bot commands @@ -5791,7 +5856,7 @@ namespace TL commands = commands, }); - /// Clear bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) + /// Clear bot commands for the specified bot scope and language code See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_ResetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -5801,7 +5866,7 @@ namespace TL lang_code = lang_code, }); - /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓] Possible codes: 400 (details) + /// Obtain a list of bot commands for the specified bot scope and language code See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Command scope /// Language code public static Task Bots_GetBotCommands(this Client client, BotCommandScope scope, string lang_code) @@ -5811,7 +5876,7 @@ namespace TL lang_code = lang_code, }); - /// Sets the menu button action » for a given user or for all users See [bots: ✓] Possible codes: 400 (details) + /// Sets the menu button action » for a given user or for all users See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User ID /// Bot menu button action public static Task Bots_SetBotMenuButton(this Client client, InputUserBase user_id, BotMenuButtonBase button) @@ -5821,7 +5886,7 @@ namespace TL button = button, }); - /// Gets the menu button action for a given user or for all users, previously set using Bots_SetBotMenuButton; users can see this information in the . See [bots: ✓] Possible codes: 400 (details) + /// Gets the menu button action for a given user or for all users, previously set using Bots_SetBotMenuButton; users can see this information in the . See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User ID or empty for the default menu button. /// a null value means botMenuButtonDefault public static Task Bots_GetBotMenuButton(this Client client, InputUserBase user_id) @@ -5830,7 +5895,7 @@ namespace TL user_id = user_id, }); - /// Set the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details) + /// Set the default suggested admin rights for bots being added as admins to channels, see here for more info on how to handle them ». See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotBroadcastDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotBroadcastDefaultAdminRights @@ -5838,7 +5903,7 @@ namespace TL admin_rights = admin_rights, }); - /// Set the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ». See [bots: ✓] Possible codes: 400 (details) + /// Set the default suggested admin rights for bots being added as admins to groups, see here for more info on how to handle them ». See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Admin rights public static Task Bots_SetBotGroupDefaultAdminRights(this Client client, ChatAdminRights admin_rights) => client.Invoke(new Bots_SetBotGroupDefaultAdminRights @@ -6002,7 +6067,7 @@ namespace TL bot = bot, }); - /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓] Possible codes: 400 (details) + /// Change the emoji status of a user (invoked by bots, see here » for more info on the full flow) See [bots: ✓ users: ✗] Possible codes: 400,403 (details) /// The user whose emoji status should be changed /// The emoji status public static Task Bots_UpdateUserEmojiStatus(this Client client, InputUserBase user_id, EmojiStatusBase emoji_status) @@ -6053,7 +6118,7 @@ namespace TL duration_months = duration_months ?? default, }); - /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400 (details) + /// Verify a user or chat on behalf of an organization ». See [bots: ✓] Possible codes: 400,403 (details) /// If set, adds the verification; otherwise removes verification. /// Must not be set if invoked by a bot, must be set to the ID of an owned bot if invoked by a user. /// The peer to verify @@ -6075,7 +6140,7 @@ namespace TL bot = bot, }); - /// Get a payment form See Possible codes: 400,403,406 (details) + /// Get a payment form See [bots: ✓] Possible codes: 400,403,406 (details) /// Invoice /// Theme parameters » public static Task Payments_GetPaymentForm(this Client client, InputInvoice invoice, DataJSON theme_params = null) @@ -6150,7 +6215,7 @@ namespace TL number = number, }); - /// Generate an invoice deep link See [bots: ✓] Possible codes: 400 (details) + /// Generate an invoice deep link See [bots: ✓ users: ✗] Possible codes: 400 (details) /// Invoice public static Task Payments_ExportInvoice(this Client client, InputMedia invoice_media) => client.Invoke(new Payments_ExportInvoice @@ -6232,6 +6297,7 @@ namespace TL }); /// Get the current Telegram Stars balance of the current account (with peer=), or the stars balance of the bot specified in peer. See Possible codes: 400,403 (details) + /// If set, returns the channel/ad revenue balance in nanotons. /// Peer of which to get the balance. public static Task Payments_GetStarsStatus(this Client client, InputPeer peer, bool ton = false) => client.Invoke(new Payments_GetStarsStatus @@ -6244,6 +6310,7 @@ namespace TL /// If set, fetches only incoming transactions. /// If set, fetches only outgoing transactions. /// Return transactions in ascending order by date (instead of descending order by date). + /// If set, returns the channel/ad revenue transactions in nanotons, instead. /// If set, fetches only transactions for the specified Telegram Star subscription ». /// Fetch the transaction history of the peer ( or a bot we own). /// Offset for pagination, obtained from the returned next_offset, initially an empty string ». @@ -6258,7 +6325,7 @@ namespace TL limit = limit, }); - /// Make a payment using Telegram Stars, see here » for more info. See Possible codes: 400,403,406 (details) + /// Make a payment using Telegram Stars, see here » for more info. See [bots: ✓] Possible codes: 400,403,406 (details) /// Payment form ID /// Invoice public static Task Payments_SendStarsForm(this Client client, long form_id, InputInvoice invoice) @@ -6268,7 +6335,7 @@ namespace TL invoice = invoice, }); - /// Refund a Telegram Stars transaction, see here » for more info. See [bots: ✓] Possible codes: 400 (details) + /// Refund a Telegram Stars transaction, see here » for more info. See [bots: ✓ users: ✗] Possible codes: 400 (details) /// User to refund. /// Transaction ID. public static Task Payments_RefundStarsCharge(this Client client, InputUserBase user_id, string charge_id) @@ -6280,6 +6347,7 @@ namespace TL /// Get Telegram Star revenue statistics ». See Possible codes: 400 (details) /// Whether to enable dark theme for graph colors + /// If set, fetches channel/bot ad revenue statistics in TON. /// Get statistics for the specified bot, channel or ourselves (). public static Task Payments_GetStarsRevenueStats(this Client client, InputPeer peer, bool dark = false, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueStats @@ -6288,8 +6356,10 @@ namespace TL peer = peer, }); - /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// Withdraw funds from a channel or bot's star balance ». See Possible codes: 400 (details) + /// If set, withdraws channel/ad revenue in TON. /// Channel or bot from which to withdraw funds. + /// The amount of stars or nanotons to withdraw. /// 2FA password, see here » for more info. public static Task Payments_GetStarsRevenueWithdrawalUrl(this Client client, InputPeer peer, InputCheckPasswordSRP password, long? amount = null, bool ton = false) => client.Invoke(new Payments_GetStarsRevenueWithdrawalUrl @@ -6309,6 +6379,7 @@ namespace TL }); /// Obtain info about Telegram Star transactions » using specific transaction IDs. See Possible codes: 400 (details) + /// If set, returns channel/bot ad revenue transactions in nanotons. /// Channel or bot. /// Transaction IDs. public static Task Payments_GetStarsTransactionsByID(this Client client, InputPeer peer, InputStarsTransaction[] id, bool ton = false) @@ -6369,7 +6440,7 @@ namespace TL { }); - /// Get a list of available gifts, see here » for more info. See + /// Get a list of available gifts, see here » for more info. See [bots: ✓] /// Hash used for caching, for more info click here.
The hash may be generated locally by using the ids of the returned or stored sticker s. /// a null value means payments.starGiftsNotModified public static Task Payments_GetStarGifts(this Client client, int hash = default) @@ -6380,6 +6451,7 @@ namespace TL /// Display or remove a received gift » from our profile. See Possible codes: 400 (details) /// If set, hides the gift from our profile. + /// The gift to display or remove. public static Task Payments_SaveStarGift(this Client client, InputSavedStarGift stargift, bool unsave = false) => client.Invoke(new Payments_SaveStarGift { @@ -6388,6 +6460,7 @@ namespace TL }); /// Convert a received gift » into Telegram Stars: this will permanently destroy the gift, converting it into .convert_stars Telegram Stars, added to the user's balance. See Possible codes: 400 (details) + /// The gift to convert. public static Task Payments_ConvertStarGift(this Client client, InputSavedStarGift stargift) => client.Invoke(new Payments_ConvertStarGift { @@ -6476,7 +6549,9 @@ namespace TL gift_id = gift_id, }); - /// See Possible codes: 400 (details) + /// Upgrade a gift to a collectible gift: can only be used if the upgrade was already paid by the gift sender; see here » for more info on the full flow (including the different flow to use in case the upgrade was not paid by the gift sender). See Possible codes: 400 (details) + /// Set this flag to keep the original gift text, sender and receiver in the upgraded gift as a attribute. + /// The gift to upgrade public static Task Payments_UpgradeStarGift(this Client client, InputSavedStarGift stargift, bool keep_original_details = false) => client.Invoke(new Payments_UpgradeStarGift { @@ -6484,7 +6559,9 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Transfer a collectible gift to another user or channel: can only be used if transfer is free (i.e. .transfer_stars is not set); see here » for more info on the full flow (including the different flow to use in case the transfer isn't free). See Possible codes: 400 (details) + /// The gift to transfer. + /// Destination peer. public static Task Payments_TransferStarGift(this Client client, InputSavedStarGift stargift, InputPeer to_id) => client.Invoke(new Payments_TransferStarGift { @@ -6492,14 +6569,25 @@ namespace TL to_id = to_id, }); - /// See Possible codes: 400 (details) + /// Obtain info about a collectible gift » using a slug obtained from a collectible gift link ». See Possible codes: 400 (details) + /// The slug. public static Task Payments_GetUniqueStarGift(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGift { slug = slug, }); - /// See Possible codes: 400 (details) + /// Fetch the full list of gifts owned by a peer. See Possible codes: 400 (details) + /// Exclude gifts not pinned on the profile. + /// Exclude gifts pinned on the profile. + /// Exclude gifts that do not have the .limited flag set. + /// Exclude collectible gifts ». + /// If set, sorts the gifts by price instead of reception date. + /// Exclude gifts that can be upgraded to collectible gifts ». + /// Exclude gifts that cannot be upgraded to collectible gifts ». + /// Fetch only gifts owned by the specified peer, such as: a user, with peer=; a channel, with peer=; a connected business user (when executing the method as a bot, over the business connection), with peer=. + /// Only returns gifts within the specified collection ». + /// Offset for pagination. /// Maximum number of results to return, see pagination public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false) => client.Invoke(new Payments_GetSavedStarGifts @@ -6511,14 +6599,17 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Fetch info about specific gifts owned by a peer we control. See Possible codes: 400 (details) + /// List of gifts to fetch info about. public static Task Payments_GetSavedStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_GetSavedStarGift { stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Convert a collectible gift » to an NFT on the TON blockchain. See Possible codes: 400 (details) + /// The collectible gift to export. + /// The current user's 2FA password, passed as specified here ». public static Task Payments_GetStarGiftWithdrawalUrl(this Client client, InputSavedStarGift stargift, InputCheckPasswordSRP password) => client.Invoke(new Payments_GetStarGiftWithdrawalUrl { @@ -6526,7 +6617,9 @@ namespace TL password = password, }); - /// See Possible codes: 400 (details) + /// Enables or disables the reception of notifications every time a gift » is received by the specified channel, can only be invoked by admins with post_messages admin rights. See Possible codes: 400 (details) + /// Whether to enable or disable reception of notifications in the form of and service messages from the channel. + /// The channel for which to receive or not receive notifications. public static Task Payments_ToggleChatStarGiftNotifications(this Client client, InputPeer peer, bool enabled = false) => client.Invoke(new Payments_ToggleChatStarGiftNotifications { @@ -6534,7 +6627,9 @@ namespace TL peer = peer, }); - /// See Possible codes: 400 (details) + /// Pins a received gift on top of the profile of the user or owned channels by using Payments_ToggleStarGiftsPinnedToTop. See Possible codes: 400 (details) + /// The peer where to pin the gift. + /// The gift to pin. public static Task Payments_ToggleStarGiftsPinnedToTop(this Client client, InputPeer peer, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_ToggleStarGiftsPinnedToTop { @@ -6542,14 +6637,21 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 406 (details) + /// Checks whether a purchase is possible. Must be called before in-store purchase, official apps only. See Possible codes: 400,406 (details) + /// Payment purpose. public static Task Payments_CanPurchaseStore(this Client client, InputStorePaymentPurpose purpose) => client.Invoke(new Payments_CanPurchaseStore { purpose = purpose, }); - /// See Possible codes: -504,400 (details) + /// Get collectible gifts of a specific type currently on resale, see here » for more info. See Possible codes: 400 (details) + /// Sort gifts by price (ascending). + /// Sort gifts by number (ascending). + /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed. + /// Mandatory identifier of the base gift from which the collectible gift was upgraded. + /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. + /// Offset for pagination. /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -6562,7 +6664,9 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// A collectible gift we own » can be put up for sale on the gift marketplace » with this method, see here » for more info. See Possible codes: 400 (details) + /// The gift to resell. + /// Resale price of the gift. public static Task Payments_UpdateStarGiftPrice(this Client client, InputSavedStarGift stargift, StarsAmountBase resell_amount) => client.Invoke(new Payments_UpdateStarGiftPrice { @@ -6570,7 +6674,10 @@ namespace TL resell_amount = resell_amount, }); - /// See Possible codes: 400 (details) + /// Create a star gift collection ». See Possible codes: 400 (details) + /// Peer where to create the collection. + /// Title of the collection. + /// Gifts added to the collection. public static Task Payments_CreateStarGiftCollection(this Client client, InputPeer peer, string title, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CreateStarGiftCollection { @@ -6579,7 +6686,13 @@ namespace TL stargift = stargift, }); - /// See Possible codes: 400 (details) + /// Add or remove gifts from a star gift collection », or rename the collection. See Possible codes: 400 (details) + /// Peer that owns the collection. + /// Collection ID. + /// Title of the collection, to rename the collection. + /// Can contain a list of gifts to remove from the collection. + /// Can contain a list of gifts to add to the collection. + /// Can contain the new gift order. public static Task Payments_UpdateStarGiftCollection(this Client client, InputPeer peer, int collection_id, string title = null, InputSavedStarGift[] delete_stargift = null, InputSavedStarGift[] add_stargift = null, InputSavedStarGift[] order = null) => client.Invoke(new Payments_UpdateStarGiftCollection { @@ -6592,7 +6705,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Reorder the star gift collections » on an owned peer's profile. See Possible codes: 400 (details) + /// The owned peer. + /// New collection order. public static Task Payments_ReorderStarGiftCollections(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Payments_ReorderStarGiftCollections { @@ -6600,7 +6715,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Delete a star gift collection ». See Possible codes: 400 (details) + /// Peer that owns the collection. + /// ID of the collection. public static Task Payments_DeleteStarGiftCollection(this Client client, InputPeer peer, int collection_id) => client.Invoke(new Payments_DeleteStarGiftCollection { @@ -6608,7 +6725,9 @@ namespace TL collection_id = collection_id, }); - /// See Possible codes: 400 (details) + /// Fetches all star gift collections » of a peer. See Possible codes: 400 (details) + /// The peer. + /// Hash (generated as specified here ») using the .hash field (not the collection_id field) of all collections returned by a previous method call, to avoid refetching the result if it hasn't changed. /// a null value means payments.starGiftCollectionsNotModified public static Task Payments_GetStarGiftCollections(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Payments_GetStarGiftCollections @@ -6617,14 +6736,16 @@ namespace TL hash = hash, }); - /// See + /// Get information about the value of a collectible gift ». See Possible codes: 400 (details) + /// slug from a . public static Task Payments_GetUniqueStarGiftValueInfo(this Client client, string slug) => client.Invoke(new Payments_GetUniqueStarGiftValueInfo { slug = slug, }); - /// See + /// Check if the specified gift » can be sent. See Possible codes: 400 (details) + /// Gift ID. public static Task Payments_CheckCanSendGift(this Client client, long gift_id) => client.Invoke(new Payments_CheckCanSendGift { @@ -6767,7 +6888,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403,500 (details) + /// Start a telegram phone call See Possible codes: 400,403 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -6889,6 +7010,8 @@ namespace TL /// The group call /// Join the group call, presenting yourself as the specified user/channel /// The invitation hash from the invite link », if provided allows speaking in a livestream or muted group chat. + /// For conference calls, your public key. + /// The block containing an appropriate e2e.chain.changeSetGroupState event. /// WebRTC parameters public static Task Phone_JoinGroupCall(this Client client, InputGroupCallBase call, InputPeer join_as, DataJSON params_, string invite_hash = null, Int256? public_key = null, byte[] block = null, bool muted = false, bool video_stopped = false) => client.Invoke(new Phone_JoinGroupCall @@ -7136,7 +7259,12 @@ namespace TL params_ = params_, }); - /// See Possible codes: 400 (details) + /// Remove participants from a conference call. See Possible codes: 400 (details) + /// Whether this is a removal of members that already left the conference call. + /// Whether this is a forced removal of active members in a conference call. + /// The conference call. + /// IDs of users to remove. + /// The block containing an appropriate e2e.chain.changeSetGroupState event public static Task Phone_DeleteConferenceCallParticipants(this Client client, InputGroupCallBase call, long[] ids, byte[] block, bool only_left = false, bool kick = false) => client.Invoke(new Phone_DeleteConferenceCallParticipants { @@ -7146,7 +7274,9 @@ namespace TL block = block, }); - /// See Possible codes: 400 (details) + /// Broadcast a blockchain block to all members of a conference call, see here » for more info. See Possible codes: 400 (details) + /// The conference where to broadcast the block. + /// The block to broadcast. public static Task Phone_SendConferenceCallBroadcast(this Client client, InputGroupCallBase call, byte[] block) => client.Invoke(new Phone_SendConferenceCallBroadcast { @@ -7154,7 +7284,10 @@ namespace TL block = block, }); - /// See Possible codes: 400 (details) + /// Invite a user to a conference call. See Possible codes: 400 (details) + /// Invite the user to also turn on their video feed. + /// The conference call. + /// The user to invite. public static Task Phone_InviteConferenceCallParticipant(this Client client, InputGroupCallBase call, InputUserBase user_id, bool video = false) => client.Invoke(new Phone_InviteConferenceCallParticipant { @@ -7163,15 +7296,19 @@ namespace TL user_id = user_id, }); - /// See Possible codes: 400 (details) + /// Declines a conference call invite. See Possible codes: 400 (details) + /// The ID of the to decline. public static Task Phone_DeclineConferenceCallInvite(this Client client, int msg_id) => client.Invoke(new Phone_DeclineConferenceCallInvite { msg_id = msg_id, }); - /// See Possible codes: 400 (details) - /// Maximum number of results to return, see pagination + /// Fetch the blocks of a conference blockchain ». See Possible codes: 400 (details) + /// The conference. + /// Subchain ID. + /// Offset for pagination. + /// Maximum number of blocks to return in this call, see pagination public static Task Phone_GetGroupCallChainBlocks(this Client client, InputGroupCallBase call, int sub_chain_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Phone_GetGroupCallChainBlocks { @@ -7439,7 +7576,7 @@ namespace TL peer = peer, }); - /// Uploads a Telegram Story. See Possible codes: 400 (details) + /// Uploads a Telegram Story. See [bots: ✓] Possible codes: 400,403 (details) /// Whether to add the story to the profile automatically upon expiration. If not set, the story will only be added to the archive, see here » for more info. /// If set, disables forwards, screenshots, and downloads. /// Set this flag when reposting stories with fwd_from_id+fwd_from_id, if the media was modified before reposting. @@ -7453,6 +7590,7 @@ namespace TL /// Period after which the story is moved to archive (and to the profile if pinned is set), in seconds; must be one of 6 * 3600, 12 * 3600, 86400, or 2 * 86400 for Telegram Premium users, and 86400 otherwise. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. /// If set, indicates that this story is a repost of story with ID fwd_from_story posted by the peer in fwd_from_id. + /// If set, adds the story to the specified albums. public static Task Stories_SendStory(this Client client, InputPeer peer, InputMedia media, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, int? period = null, MediaArea[] media_areas = null, InputPeer fwd_from_id = null, int? fwd_from_story = null, int[] albums = null, bool pinned = false, bool noforwards = false, bool fwd_modified = false) => client.Invoke(new Stories_SendStory { @@ -7470,7 +7608,7 @@ namespace TL albums = albums, }); - /// Edit an uploaded story See Possible codes: 400 (details) + /// Edit an uploaded story See [bots: ✓] Possible codes: 400 (details) /// Peer where the story was posted. /// ID of story to edit. /// If specified, replaces the story media. @@ -7606,7 +7744,7 @@ namespace TL limit = limit, }); - /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: -504,400 (details) + /// Obtain info about the view count, forward count, reactions and recent viewers of one or more stories. See Possible codes: 400 (details) /// Peer whose stories should be fetched /// Story IDs public static Task Stories_GetStoriesViews(this Client client, InputPeer peer, params int[] id) @@ -7746,7 +7884,10 @@ namespace TL limit = limit, }); - /// See Possible codes: 400 (details) + /// Creates a story album. See Possible codes: 400 (details) + /// The owned peer where to create the album. + /// Album name. + /// Stories to add to the album. public static Task Stories_CreateAlbum(this Client client, InputPeer peer, string title, params int[] stories) => client.Invoke(new Stories_CreateAlbum { @@ -7755,7 +7896,13 @@ namespace TL stories = stories, }); - /// See Possible codes: 400 (details) + /// Rename a story albums », or add, delete or reorder stories in it. See Possible codes: 400 (details) + /// Peer where the album is posted. + /// Album ID. + /// New album title. + /// If set, deletes the specified stories from the album. + /// If set, adds the specified stories to the album. + /// If set, reorders the stories in the album by their IDs. public static Task Stories_UpdateAlbum(this Client client, InputPeer peer, int album_id, string title = null, int[] delete_stories = null, int[] add_stories = null, int[] order = null) => client.Invoke(new Stories_UpdateAlbum { @@ -7768,7 +7915,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Reorder story albums on a profile ». See Possible codes: 400 (details) + /// Peer where the albums are located. + /// New order of the albums. public static Task Stories_ReorderAlbums(this Client client, InputPeer peer, params int[] order) => client.Invoke(new Stories_ReorderAlbums { @@ -7776,7 +7925,9 @@ namespace TL order = order, }); - /// See Possible codes: 400 (details) + /// Delete a story album. See Possible codes: 400 (details) + /// Owned peer where the album is located. + /// ID of the album to delete. public static Task Stories_DeleteAlbum(this Client client, InputPeer peer, int album_id) => client.Invoke(new Stories_DeleteAlbum { @@ -7784,7 +7935,9 @@ namespace TL album_id = album_id, }); - /// See Possible codes: 400 (details) + /// Get story albums created by a peer. See Possible codes: 400 (details) + /// The peer. + /// The hash from a previously returned , to avoid returning any results if they haven't changed. /// a null value means stories.albumsNotModified public static Task Stories_GetAlbums(this Client client, InputPeer peer, long hash = default) => client.Invoke(new Stories_GetAlbums @@ -7793,7 +7946,10 @@ namespace TL hash = hash, }); - /// See Possible codes: 400 (details) + /// Get stories in a story album ». See Possible codes: 400 (details) + /// Peer where the album is posted. + /// ID of the album. + /// Offset for pagination. /// Maximum number of results to return, see pagination public static Task Stories_GetAlbumStories(this Client client, InputPeer peer, int album_id, int offset = default, int limit = int.MaxValue) => client.Invoke(new Stories_GetAlbumStories @@ -7835,7 +7991,7 @@ namespace TL peer = peer, }); - /// Gets the current number of boosts of a channel/supergroup. See Possible codes: -504,400 (details) + /// Gets the current number of boosts of a channel/supergroup. See Possible codes: 400 (details) /// The peer. public static Task Premium_GetBoostsStatus(this Client client, InputPeer peer) => client.Invoke(new Premium_GetBoostsStatus diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index a9a9c11..0bc2a97 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -3,7 +3,7 @@ namespace TL { #pragma warning disable IDE1006, CS1574 - /// Object describes the contents of an encrypted message. See + /// Object describes the contents of an encrypted message. See Derived classes: , public abstract partial class DecryptedMessageBase : IObject { /// Flags, see TL conditional fields (added in layer 45) @@ -24,11 +24,12 @@ namespace TL public virtual long ReplyToRandom => default; /// Random group ID, assigned by the author of message.
Multiple encrypted messages with a photo attached and with the same group ID indicate an album or grouped media (parameter added in layer 45)
public virtual long Grouped => default; + /// Random bytes, removed in layer 17. public virtual byte[] RandomBytes => default; public virtual DecryptedMessageAction Action => default; } - /// Object describes media contents of an encrypted message. See + /// Object describes media contents of an encrypted message. See Derived classes: , , , , , , , , /// a value means decryptedMessageMediaEmpty public abstract partial class DecryptedMessageMedia : IObject { @@ -36,14 +37,17 @@ namespace TL internal virtual (long size, byte[] key, byte[] iv) SizeKeyIV { get => default; set => throw new WTelegram.WTException("Incompatible DecryptedMessageMedia"); } } - /// Object describes the action to which a service message is linked. See + /// Object describes the action to which a service message is linked. See Derived classes: , , , , , , , , , , , , public abstract partial class DecryptedMessageAction : IObject { } - /// Indicates the location of a photo, will be deprecated soon See + /// Indicates the location of a photo, will be deprecated soon See Derived classes: , public abstract partial class FileLocationBase : IObject { + /// Volume ID public virtual long VolumeId => default; + /// Local ID public virtual int LocalId => default; + /// Secret public virtual long Secret => default; } @@ -55,6 +59,7 @@ namespace TL { /// Random message ID, assigned by the author of message.
Must be equal to the ID passed to sending method.
public long random_id; + /// Random bytes, removed in layer 17. public byte[] random_bytes; /// Message text public string message; @@ -67,6 +72,7 @@ namespace TL public override string Message => message; /// Media content public override DecryptedMessageMedia Media => media; + /// Random bytes, removed in layer 17. public override byte[] RandomBytes => random_bytes; } ///
Contents of an encrypted service message. See @@ -75,12 +81,14 @@ namespace TL { /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public long random_id; + /// Random bytes, removed in Layer 17. public byte[] random_bytes; /// Action relevant to the service message public DecryptedMessageAction action; /// Random message ID, assigned by the message author.
Must be equal to the ID passed to the sending method.
public override long RandomId => random_id; + /// Random bytes, removed in Layer 17. public override byte[] RandomBytes => random_bytes; /// Action relevant to the service message public override DecryptedMessageAction Action => action; @@ -167,6 +175,7 @@ namespace TL public int thumb_w; /// Thumbnail height public int thumb_h; + /// File name, moved to attributes in Layer 45. public string file_name; /// File MIME-type public string mime_type; @@ -498,25 +507,38 @@ namespace TL [TLDef(0x7C596B46)] public sealed partial class FileLocationUnavailable : FileLocationBase { + /// Volume ID public long volume_id; + /// Local ID public int local_id; + /// Secret public long secret; + /// Volume ID public override long VolumeId => volume_id; + /// Local ID public override int LocalId => local_id; + /// Secret public override long Secret => secret; } ///
File location. See [TLDef(0x53D69076)] public sealed partial class FileLocation : FileLocationBase { + /// DC ID public int dc_id; + /// Volume ID public long volume_id; + /// Local ID public int local_id; + /// Secret public long secret; + /// Volume ID public override long VolumeId => volume_id; + /// Local ID public override int LocalId => local_id; + /// Secret public override long Secret => secret; } } @@ -775,7 +797,6 @@ namespace TL { /// Field has a value has_reply_to_random_id = 0x8, - /// Whether this is a silent message (no notification triggered) silent = 0x20, /// Field has a value has_entities = 0x80, From 48d005b60587ad66dcdedec35bec850935aa11d0 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 10 Oct 2025 20:27:42 +0200 Subject: [PATCH 310/336] Encryption class public + Methods table --- generator/MTProtoGenerator.cs | 16 +++++++++++++--- src/Client.cs | 10 +++------- src/Encryption.cs | 12 +++++++----- 3 files changed, 23 insertions(+), 15 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 4fd169d..26011b6 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -32,6 +32,7 @@ public class MTProtoGenerator : IIncrementalGenerator var nullables = LoadNullables(layer); var namespaces = new Dictionary>(); // namespace,class,methods var tableTL = new StringBuilder(); + var methodsTL = new StringBuilder(); var source = new StringBuilder(); source .AppendLine("using System;") @@ -46,6 +47,9 @@ public class MTProtoGenerator : IIncrementalGenerator tableTL .AppendLine("\t\tpublic static readonly Dictionary> Table = new()") .AppendLine("\t\t{"); + methodsTL + .AppendLine("\t\tpublic static readonly Dictionary> Methods = new()") + .AppendLine("\t\t{"); foreach (var classDecl in unit.classes) { @@ -86,8 +90,13 @@ public class MTProtoGenerator : IIncrementalGenerator } if (id == 0x3072CFA1) // GzipPacked tableTL.AppendLine($"\t\t\t[0x{id:X8}] = reader => (IObject)reader.ReadTLGzipped(typeof(IObject)),"); - else if (name != "Null" && (ns != "TL.Methods" || name == "Ping")) - tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); + else if (name != "Null") + { + if (ns == "TL.Methods") + methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); + if (ns != "TL.Methods" || name == "Ping") + tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); + } var override_ = symbol.BaseType == object_ ? "" : "override "; if (name == "Messages_AffectedMessages") override_ = "virtual "; //if (symbol.Constructors[0].IsImplicitlyDeclared) @@ -213,7 +222,8 @@ public class MTProtoGenerator : IIncrementalGenerator foreach (var nullable in nullables) tableTL.AppendLine($"\t\t\t[0x{nullable.Value:X8}] = null,"); tableTL.AppendLine("\t\t};"); - namespaces["TL"]["Layer"] = tableTL.ToString(); + methodsTL.AppendLine("\t\t};"); + namespaces["TL"]["Layer"] = tableTL.ToString() + methodsTL.ToString(); foreach (var namesp in namespaces) { source.Append("namespace ").AppendLine(namesp.Key).Append('{'); diff --git a/src/Client.cs b/src/Client.cs index 08b6207..be24bf3 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -185,10 +185,6 @@ namespace WTelegram return Console.ReadLine(); } - /// Load a specific Telegram server public key - /// A string starting with -----BEGIN RSA PUBLIC KEY----- - public static void LoadPublicKey(string pem) => Encryption.LoadPublicKey(pem); - /// Builds a structure that is used to validate a 2FA password /// Password validation configuration. You can obtain this via Account_GetPassword or through OnOther as part of the login process /// The password to validate @@ -358,7 +354,7 @@ namespace WTelegram if (await stream.FullReadAsync(data, 4, ct) != 4) throw new WTException(ConnectionShutDown); #if OBFUSCATION - _recvCtr.EncryptDecrypt(data, 4); + _recvCtr.EncryptDecrypt(data.AsSpan(0, 4)); #endif int payloadLen = BinaryPrimitives.ReadInt32LittleEndian(data); if (payloadLen <= 0) @@ -370,7 +366,7 @@ namespace WTelegram if (await stream.FullReadAsync(data, payloadLen, ct) != payloadLen) throw new WTException("Could not read frame data : Connection shut down"); #if OBFUSCATION - _recvCtr.EncryptDecrypt(data, payloadLen); + _recvCtr.EncryptDecrypt(data.AsSpan(0, payloadLen)); #endif obj = ReadFrame(data, payloadLen); } @@ -1526,7 +1522,7 @@ namespace WTelegram int frameLength = (int)memStream.Length; BinaryPrimitives.WriteInt32LittleEndian(buffer, frameLength - 4); // patch payload_len with correct value #if OBFUSCATION - _sendCtr?.EncryptDecrypt(buffer, frameLength); + _sendCtr?.EncryptDecrypt(buffer.AsSpan(0, frameLength)); #endif if (_networkStream != null) await _networkStream.WriteAsync(buffer, 0, frameLength); diff --git a/src/Encryption.cs b/src/Encryption.cs index 957c537..09f6caa 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -13,7 +13,7 @@ using static WTelegram.Compat; namespace WTelegram { - internal static class Encryption + public static class Encryption { private static readonly Dictionary PublicKeys = []; internal static readonly RandomNumberGenerator RNG = RandomNumberGenerator.Create(); @@ -237,6 +237,8 @@ namespace WTelegram throw new WTException("g^a or g^b is not between 2^{2048-64} and dh_prime - 2^{2048-64}"); } + /// Load a specific Telegram server public key + /// A string starting with -----BEGIN RSA PUBLIC KEY----- public static void LoadPublicKey(string pem) { using var rsa = RSA.Create(); @@ -319,7 +321,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB } #if OBFUSCATION - internal sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable + public sealed class AesCtr(byte[] key, byte[] ivec) : IDisposable { readonly ICryptoTransform _encryptor = AesECB.CreateEncryptor(key, null); readonly byte[] _ecount = new byte[16]; @@ -327,9 +329,9 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB public void Dispose() => _encryptor.Dispose(); - public void EncryptDecrypt(byte[] buffer, int length) + public void EncryptDecrypt(Span buffer) { - for (int i = 0; i < length; i++) + for (int i = 0; i < buffer.Length; i++) { if (_num == 0) { @@ -373,7 +375,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var sendCtr = new AesCtr(sendKey, sendIV); var recvCtr = new AesCtr(recvKey, recvIV); var encrypted = (byte[])preamble.Clone(); - sendCtr.EncryptDecrypt(encrypted, 64); + sendCtr.EncryptDecrypt(encrypted); for (int i = 56; i < 64; i++) preamble[i] = encrypted[i]; return (sendCtr, recvCtr, preamble); From 2e95576be5700d32a36ae887ef6a9ea97c074ca4 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:14:48 +0100 Subject: [PATCH 311/336] Encryption class public + TL Methods/Helpers --- generator/MTProtoGenerator.cs | 17 ++++++++++---- src/Encryption.cs | 44 +++++++++++++++++------------------ src/TL.cs | 40 ++++++++++++++++++++++++++++++- 3 files changed, 74 insertions(+), 27 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index 26011b6..c9e71f0 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -83,7 +83,7 @@ public class MTProtoGenerator : IIncrementalGenerator ns = symbol.ContainingNamespace.ToString(); name = symbol.Name; if (!namespaces.TryGetValue(ns, out var classes)) namespaces[ns] = classes = []; - if (name is "_Message" or "RpcResult" or "MsgCopy") + if (name is "_Message" or "MsgCopy") { classes[name] = "\t\tpublic void WriteTL(BinaryWriter writer) => throw new NotSupportedException();"; continue; @@ -93,7 +93,7 @@ public class MTProtoGenerator : IIncrementalGenerator else if (name != "Null") { if (ns == "TL.Methods") - methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); + methodsTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}{(symbol.IsGenericType ? "" : "")}.ReadTL,"); if (ns != "TL.Methods" || name == "Ping") tableTL.AppendLine($"\t\t\t[0x{id:X8}] = {(ns == "TL" ? "" : ns + '.')}{name}.ReadTL,"); } @@ -176,7 +176,7 @@ public class MTProtoGenerator : IIncrementalGenerator writeTl.AppendLine($"writer.WriteTLMessages({member.Name});"); break; case "TL.IObject": case "TL.IMethod": - readTL.AppendLine($"r.{member.Name} = {(memberType == "TL.IObject" ? "" : $"({memberType})")}reader.ReadTLObject();"); + readTL.AppendLine($"r.{member.Name} = {(memberType == "TL.IObject" ? "reader.ReadTLObject()" : "reader.ReadTLMethod()")};"); writeTl.AppendLine($"{member.Name}.WriteTL(writer);"); break; case "System.Collections.Generic.Dictionary": @@ -187,14 +187,23 @@ public class MTProtoGenerator : IIncrementalGenerator readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); break; + case "object": + readTL.AppendLine($"r.{member.Name} = reader.ReadTLObject();"); + writeTl.AppendLine($"writer.WriteTLValue({member.Name}, {member.Name}.GetType());"); + break; default: if (member.Type is IArrayTypeSymbol arrayType) { if (name is "FutureSalts") + { readTL.AppendLine($"r.{member.Name} = reader.ReadTLRawVector<{memberType.Substring(0, memberType.Length - 2)}>(0x0949D9DC).ToArray();"); + writeTl.AppendLine($"writer.WriteTLRawVector({member.Name}, 16);"); + } else + { readTL.AppendLine($"r.{member.Name} = reader.ReadTLVector<{memberType.Substring(0, memberType.Length - 2)}>();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name});"); + } } else if (member.Type.BaseType.SpecialType == SpecialType.System_Enum) { diff --git a/src/Encryption.cs b/src/Encryption.cs index 09f6caa..4025d9e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -94,7 +94,7 @@ namespace WTelegram if (serverDHparams is not ServerDHParamsOk serverDHparamsOk) throw new WTException("not server_DH_params_ok"); if (serverDHparamsOk.nonce != nonce) throw new WTException("Nonce mismatch"); if (serverDHparamsOk.server_nonce != resPQ.server_nonce) throw new WTException("Server Nonce mismatch"); - var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(resPQ.server_nonce, pqInnerData.new_nonce); + var (tmp_aes_key, tmp_aes_iv) = ConstructTmpAESKeyIV(sha1, resPQ.server_nonce, pqInnerData.new_nonce); var answer = AES_IGE_EncryptDecrypt(serverDHparamsOk.encrypted_answer, tmp_aes_key, tmp_aes_iv, false); using var answerReader = new BinaryReader(new MemoryStream(answer)); @@ -163,26 +163,26 @@ namespace WTelegram session.AuthKey = authKey; session.Salt = BinaryPrimitives.ReadInt64LittleEndian(pqInnerData.new_nonce.raw) ^ BinaryPrimitives.ReadInt64LittleEndian(resPQ.server_nonce.raw); session.OldSalt = session.Salt; + } - (byte[] key, byte[] iv) ConstructTmpAESKeyIV(TL.Int128 server_nonce, Int256 new_nonce) - { - byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; - sha1.TransformBlock(new_nonce, 0, 32, null, 0); - sha1.TransformFinalBlock(server_nonce, 0, 16); - sha1.Hash.CopyTo(tmp_aes_key, 0); // tmp_aes_key := SHA1(new_nonce + server_nonce) - sha1.Initialize(); - sha1.TransformBlock(server_nonce, 0, 16, null, 0); - sha1.TransformFinalBlock(new_nonce, 0, 32); - Array.Copy(sha1.Hash, 0, tmp_aes_key, 20, 12); // + SHA1(server_nonce, new_nonce)[0:12] - Array.Copy(sha1.Hash, 12, tmp_aes_iv, 0, 8); // tmp_aes_iv != SHA1(server_nonce, new_nonce)[12:8] - sha1.Initialize(); - sha1.TransformBlock(new_nonce, 0, 32, null, 0); - sha1.TransformFinalBlock(new_nonce, 0, 32); - sha1.Hash.CopyTo(tmp_aes_iv, 8); // + SHA(new_nonce + new_nonce) - Array.Copy(new_nonce, 0, tmp_aes_iv, 28, 4); // + new_nonce[0:4] - sha1.Initialize(); - return (tmp_aes_key, tmp_aes_iv); - } + public static (byte[] key, byte[] iv) ConstructTmpAESKeyIV(SHA1 sha1, TL.Int128 server_nonce, Int256 new_nonce) + { + byte[] tmp_aes_key = new byte[32], tmp_aes_iv = new byte[32]; + sha1.TransformBlock(new_nonce, 0, 32, null, 0); + sha1.TransformFinalBlock(server_nonce, 0, 16); + sha1.Hash.CopyTo(tmp_aes_key, 0); // tmp_aes_key := SHA1(new_nonce + server_nonce) + sha1.Initialize(); + sha1.TransformBlock(server_nonce, 0, 16, null, 0); + sha1.TransformFinalBlock(new_nonce, 0, 32); + Array.Copy(sha1.Hash, 0, tmp_aes_key, 20, 12); // + SHA1(server_nonce, new_nonce)[0:12] + Array.Copy(sha1.Hash, 12, tmp_aes_iv, 0, 8); // tmp_aes_iv != SHA1(server_nonce, new_nonce)[12:8] + sha1.Initialize(); + sha1.TransformBlock(new_nonce, 0, 32, null, 0); + sha1.TransformFinalBlock(new_nonce, 0, 32); + sha1.Hash.CopyTo(tmp_aes_iv, 8); // + SHA(new_nonce + new_nonce) + Array.Copy(new_nonce, 0, tmp_aes_iv, 28, 4); // + new_nonce[0:4] + sha1.Initialize(); + return (tmp_aes_key, tmp_aes_iv); } internal static void CheckGoodPrime(BigInteger p, int g) @@ -278,7 +278,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB -----END RSA PUBLIC KEY-----"); } - internal static byte[] EncryptDecryptMessage(Span input, bool encrypt, int x, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) + public static byte[] EncryptDecryptMessage(Span input, bool encrypt, int x, byte[] authKey, byte[] msgKey, int msgKeyOffset, SHA256 sha256) { // first, construct AES key & IV byte[] aes_key = new byte[32], aes_iv = new byte[32]; @@ -299,7 +299,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB return AES_IGE_EncryptDecrypt(input, aes_key, aes_iv, encrypt); } - internal static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) + public static byte[] AES_IGE_EncryptDecrypt(Span input, byte[] aes_key, byte[] aes_iv, bool encrypt) { if (input.Length % 16 != 0) throw new WTException("AES_IGE input size not divisible by 16"); diff --git a/src/TL.cs b/src/TL.cs index 67342ea..7c4b65d 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -16,7 +16,7 @@ namespace TL #else public interface IObject { } #endif - public interface IMethod : IObject { } + public interface IMethod : IObject { } public interface IPeerResolver { IPeerInfo UserOrChat(Peer peer); } [AttributeUsage(AttributeTargets.Class)] @@ -105,6 +105,17 @@ namespace TL #endif } + public static IMethod ReadTLMethod(this BinaryReader reader) + { + uint ctorNb = reader.ReadUInt32(); + if (!Layer.Methods.TryGetValue(ctorNb, out var ctor)) + throw new WTelegram.WTException($"Cannot find method for ctor #{ctorNb:x}"); + var method = ctor?.Invoke(reader); + if (method is IMethod && typeof(X) == typeof(object)) + method = new BoolMethod { query = method }; + return (IMethod)method; + } + internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) { if (value == null) @@ -222,6 +233,21 @@ namespace TL writer.WriteTLValue(array.GetValue(i), elementType); } + internal static void WriteTLRawVector(this BinaryWriter writer, Array array, int elementSize) + { + var startPos = writer.BaseStream.Position; + int count = array.Length; + var elementType = array.GetType().GetElementType(); + for (int i = count - 1; i >= 0; i--) + { + writer.BaseStream.Position = startPos + i * elementSize; + writer.WriteTLValue(array.GetValue(i), elementType); + } + writer.BaseStream.Position = startPos; + writer.Write(count); + writer.BaseStream.Position = startPos + count * elementSize + 4; + } + internal static List ReadTLRawVector(this BinaryReader reader, uint ctorNb) { int count = reader.ReadInt32(); @@ -443,4 +469,16 @@ namespace TL [TLDef(0x3072CFA1)] //gzip_packed#3072cfa1 packed_data:bytes = Object public sealed partial class GzipPacked : IObject { public byte[] packed_data; } + + public sealed class Null : IObject + { + public readonly static Null Instance = new(); + public void WriteTL(BinaryWriter writer) => writer.WriteTLNull(typeof(X)); + } + + public sealed class BoolMethod : IMethod + { + public IObject query; + public void WriteTL(BinaryWriter writer) => query.WriteTL(writer); + } } From 4875f75774fcf073941953d72b92db1caa04b90c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:27:32 +0100 Subject: [PATCH 312/336] API Layer 216: topics methods/updates moved to prefix Messages_* (to support topics for bots), contact notes, groupcall comments, profile color, stargifts stuff --- README.md | 2 +- src/Client.Helpers.cs | 8 +- src/TL.Schema.cs | 264 ++++++++++++++----- src/TL.SchemaFuncs.cs | 515 +++++++++++++++++++++---------------- src/TL.Table.cs | 39 +-- src/WTelegramClient.csproj | 4 +- 6 files changed, 537 insertions(+), 295 deletions(-) diff --git a/README.md b/README.md index 5bf0849..895eedf 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-214-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-216-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/Client.Helpers.cs b/src/Client.Helpers.cs index e205579..6faa509 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -640,18 +640,18 @@ namespace WTelegram } /// Helper simplified method: Get all topics of a forum See Possible codes: 400 (details) - /// Supergroup + /// Supergroup or Bot peer /// Search query - public async Task Channels_GetAllForumTopics(InputChannelBase channel, string q = null) + public async Task Channels_GetAllForumTopics(InputPeer peer, string q = null) { - var result = await this.Channels_GetForumTopics(channel, offset_date: DateTime.MaxValue, q: q); + var result = await this.Messages_GetForumTopics(peer, offset_date: DateTime.MaxValue, q: q); if (result.topics.Length < result.count) { var topics = result.topics.ToList(); var messages = result.messages.ToList(); while (true) { - var more_topics = await this.Channels_GetForumTopics(channel, messages[^1].Date, messages[^1].ID, topics[^1].ID); + var more_topics = await this.Messages_GetForumTopics(peer, messages[^1].Date, messages[^1].ID, topics[^1].ID); if (more_topics.topics.Length == 0) break; topics.AddRange(more_topics.topics); messages.AddRange(more_topics.messages); diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 16411b9..45807d0 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -819,9 +819,9 @@ namespace TL /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
[IfFlag(37)] public int stories_max_id; /// The user's accent color. - [IfFlag(40)] public PeerColor color; + [IfFlag(40)] public PeerColorBase color; /// The user's profile color. - [IfFlag(41)] public PeerColor profile_color; + [IfFlag(41)] public PeerColorBase profile_color; /// Monthly Active Users (MAU) of this bot (may be absent for small bots). [IfFlag(44)] public int bot_active_users; /// Describes a bot verification icon ». @@ -919,6 +919,7 @@ namespace TL has_bot_verification_icon = 0x4000, /// Field has a value has_send_paid_messages_stars = 0x8000, + bot_forum_view = 0x10000, } } @@ -1123,9 +1124,9 @@ namespace TL /// ID of the maximum read story. [IfFlag(36)] public int stories_max_id; /// The channel's accent color. - [IfFlag(39)] public PeerColor color; + [IfFlag(39)] public PeerColorBase color; /// The channel's profile color. - [IfFlag(40)] public PeerColor profile_color; + [IfFlag(40)] public PeerColorBase profile_color; /// Emoji status [IfFlag(41)] public EmojiStatusBase emoji_status; /// Boost level.
Changes to this flag should invalidate the local cache for this channel/supergroup ID, see here » for more info.
@@ -2744,6 +2745,7 @@ namespace TL { /// Field has a value has_icon_emoji_id = 0x1, + title_missing = 0x2, } } /// Forum topic information was edited. See @@ -2988,7 +2990,7 @@ namespace TL [IfFlag(12)] public long saved_id; /// Hash to prepay for a gift upgrade separately ». [IfFlag(14)] public string prepaid_upgrade_hash; - /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (valid for everyone, since all messages across all private chats with users share the same message ID sequence, and for channels the service message will already be sent to the channel, that will contain the service message with the original gift). + /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; [Flags] public enum Flags : uint @@ -3026,7 +3028,7 @@ namespace TL } } /// A gift » was upgraded to a collectible gift ». See - [TLDef(0x34F762F3)] + [TLDef(0x95728543)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3049,6 +3051,7 @@ namespace TL [IfFlag(9)] public DateTime can_transfer_at; /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; + [IfFlag(12)] public long drop_original_details_stars; [Flags] public enum Flags : uint { @@ -3076,6 +3079,9 @@ namespace TL has_can_resell_at = 0x400, /// The sender has pre-paid for the upgrade of this gift to a collectible gift. prepaid_upgrade = 0x800, + /// Field has a value + has_drop_original_details_stars = 0x1000, + assigned = 0x2000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3215,6 +3221,12 @@ namespace TL has_transaction_id = 0x1, } } + /// See + [TLDef(0x2C8F2A25)] + public sealed partial class MessageActionSuggestBirthday : MessageAction + { + public Birthday birthday; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -3495,7 +3507,7 @@ namespace TL public Auth_AuthorizationBase authorization; } /// Official apps may receive this constructor, indicating that due to the high cost of SMS verification codes for the user's country/provider, the user must purchase a Telegram Premium subscription in order to proceed with the login/signup. See - [TLDef(0xD7A2FCF9)] + [TLDef(0xE0955A3C)] public sealed partial class Auth_SentCodePaymentRequired : Auth_SentCodeBase { /// Store identifier of the Telegram Premium subscription. @@ -3506,6 +3518,8 @@ namespace TL public string support_email_address; /// The mandatory subject for the email. public string support_email_subject; + public string currency; + public long amount; } /// Object contains info on user authorization. See Derived classes: , @@ -3852,7 +3866,7 @@ namespace TL } /// Extended user info See - [TLDef(0xC577B5AD)] + [TLDef(0xA02BC13E)] public sealed partial class UserFull : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3931,6 +3945,7 @@ namespace TL [IfFlag(52)] public ProfileTab main_tab; /// The first song on the music tab of the profile, see here » for more info on the music profile tab. [IfFlag(53)] public DocumentBase saved_music; + [IfFlag(54)] public TextWithEntities note; [Flags] public enum Flags : uint { @@ -4032,6 +4047,8 @@ namespace TL has_main_tab = 0x100000, /// Field has a value has_saved_music = 0x200000, + /// Field has a value + has_note = 0x400000, } } @@ -4165,15 +4182,17 @@ namespace TL { /// List of messages public virtual MessageBase[] Messages => default; + public virtual ForumTopicBase[] Topics => default; /// returns a or for the given Peer public abstract IPeerInfo UserOrChat(Peer peer); } /// Full list of messages with auxiliary data. See - [TLDef(0x8C718E87)] + [TLDef(0x1D73E7EA)] public partial class Messages_Messages : Messages_MessagesBase, IPeerResolver { /// List of messages public MessageBase[] messages; + public ForumTopicBase[] topics; /// List of chats mentioned in dialogs public Dictionary chats; /// List of users mentioned in messages and chats @@ -4181,11 +4200,12 @@ namespace TL /// List of messages public override MessageBase[] Messages => messages; + public override ForumTopicBase[] Topics => topics; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// Incomplete list of messages and auxiliary data. See - [TLDef(0x762B263D)] + [TLDef(0x5F206716)] public sealed partial class Messages_MessagesSlice : Messages_Messages, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4242,6 +4262,8 @@ namespace TL /// Found messages public override MessageBase[] Messages => messages; + /// Forum topic information + public override ForumTopicBase[] Topics => topics; /// returns a or for the given Peer public override IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } @@ -4358,6 +4380,7 @@ namespace TL public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; + public virtual void SetPTS(int new_pts, int new_pts_count) { } } /// New message in a private chat or in a basic group. See [TLDef(0x1F2B0AFD)] @@ -4371,6 +4394,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Sent message with random_id client identifier was assigned an identifier. See [TLDef(0x4E90BFD6)] @@ -4393,13 +4417,24 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The user is preparing a message; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See - [TLDef(0xC01E857F, inheritBefore = true)] - public sealed partial class UpdateUserTyping : UpdateUser + [TLDef(0x2A17BF5C)] + public sealed partial class UpdateUserTyping : Update { + public Flags flags; + /// User id + public long user_id; + [IfFlag(0)] public int top_msg_id; /// Action type public SendMessageAction action; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_top_msg_id = 0x1, + } } /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See [TLDef(0x83487AF0, inheritBefore = true)] @@ -4466,6 +4501,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Interlocutor is typing a message in an encrypted chat. Update period is 6 second. If upon this time there is no repeated update, it shall be considered that the interlocutor stopped typing. See [TLDef(0x1710F156)] @@ -4576,7 +4612,7 @@ namespace TL public string phone; } /// Incoming messages were read See - [TLDef(0x9C974FDF)] + [TLDef(0x9E84BC99)] public sealed partial class UpdateReadHistoryInbox : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -4585,6 +4621,7 @@ namespace TL [IfFlag(0)] public int folder_id; /// Peer public Peer peer; + [IfFlag(1)] public int top_msg_id; /// Maximum ID of messages read public int max_id; /// Number of messages that are still unread @@ -4598,9 +4635,12 @@ namespace TL { /// Field has a value has_folder_id = 0x1, + /// Field has a value + has_top_msg_id = 0x2, } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Outgoing messages were read See [TLDef(0x2F2F21BF)] @@ -4616,6 +4656,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// An instant view webpage preview was generated See [TLDef(0x7F891213)] @@ -4629,6 +4670,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Contents of messages in the common message box were read (emitted specifically for messages like voice messages or video, only once the media is watched and marked as read using Messages_ReadMessageContents). See [TLDef(0xF8227181)] @@ -4652,6 +4694,7 @@ namespace TL } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// There are new updates in the specified channel, the client must fetch them.
If the difference is too long or if the channel isn't currently in the states, start fetching from the specified pts. See
[TLDef(0x108D941F)] @@ -4671,6 +4714,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, 0); + public override void SetPTS(int new_pts, int _) => pts = new_pts; } /// Channel/supergroup ( and/or ) information was updated. See [TLDef(0x635B4C09)] @@ -4684,6 +4728,7 @@ namespace TL public sealed partial class UpdateNewChannelMessage : UpdateNewMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Incoming messages in a channel/supergroup were read See [TLDef(0x922E6E10)] @@ -4709,6 +4754,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, 0); + public override void SetPTS(int new_pts, int _) => pts = new_pts; } /// Some messages in a supergroup/channel were deleted See [TLDef(0xC32D5B12)] @@ -4718,6 +4764,7 @@ namespace TL public long channel_id; public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The view counter of a message in a channel has changed See [TLDef(0xF226AC08, inheritBefore = true)] @@ -4838,6 +4885,7 @@ namespace TL public sealed partial class UpdateEditChannelMessage : UpdateEditMessage { public override (long, int, int) GetMBox() => (message.Peer is PeerChannel pc ? pc.channel_id : 0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// A callback button was pressed, and the button data was sent to the bot that created the button See [TLDef(0xB9CFC48D)] @@ -4880,6 +4928,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// This notification is received by bots when a button is pressed See [TLDef(0x691E9052)] @@ -4960,6 +5009,7 @@ namespace TL public long channel_id; public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// A dialog was pinned/unpinned See [TLDef(0x6E6FE51C)] @@ -5177,6 +5227,7 @@ namespace TL public int pts_count; public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Settings of a certain peer have changed See [TLDef(0x6A7E7366)] @@ -5253,6 +5304,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A new folder was added See [TLDef(0x26FFDE7D)] @@ -5393,6 +5445,7 @@ namespace TL } public override (long, int, int) GetMBox() => (0, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Messages were pinned/unpinned in a channel/supergroup See [TLDef(0x5BB98608)] @@ -5416,6 +5469,7 @@ namespace TL } public override (long, int, int) GetMBox() => (channel_id, pts, pts_count); + public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// Chat ( and/or ) information was updated. See [TLDef(0xF89A6A4E)] @@ -5503,6 +5557,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A participant has left, joined, was banned or admined in a channel or supergroup. See [TLDef(0x985D3ABB)] @@ -5540,6 +5595,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A bot was stopped or re-started. See [TLDef(0xC4870A49)] @@ -5555,6 +5611,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// New WebRTC parameters See [TLDef(0x0B783982)] @@ -5611,6 +5668,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// New message reactions » are available See [TLDef(0x1E297BFA)] @@ -5724,40 +5782,6 @@ namespace TL /// Revealed media, contains only s. public MessageExtendedMediaBase[] extended_media; } - /// A forum topic » was pinned or unpinned. See - [TLDef(0x192EFBE3)] - public sealed partial class UpdateChannelPinnedTopic : Update - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// The forum ID - public long channel_id; - /// The topic ID - public int topic_id; - - [Flags] public enum Flags : uint - { - /// Whether the topic was pinned or unpinned - pinned = 0x1, - } - } - /// The pinned topics of a forum have changed. See - [TLDef(0xFE198602)] - public sealed partial class UpdateChannelPinnedTopics : Update - { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - /// Forum ID. - public long channel_id; - /// Ordered list containing the IDs of all pinned topics. - [IfFlag(0)] public int[] order; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_order = 0x1, - } - } /// User ( and/or ) information was updated. See [TLDef(0x20529438)] public partial class UpdateUser : Update @@ -5825,6 +5849,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
[TLDef(0x07B68920, inheritBefore = true)] @@ -5872,6 +5897,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Bots only: the number of reactions on a message with anonymous reactions has changed. See [TLDef(0x09CB7759)] @@ -5889,6 +5915,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A saved message dialog was pinned/unpinned See [TLDef(0xAEAF9E74)] @@ -5975,6 +6002,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was received via a connected business chat ». See [TLDef(0x9DDB347C)] @@ -5998,6 +6026,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was edited in a connected business chat ». See [TLDef(0x07DF587C)] @@ -6021,6 +6050,7 @@ namespace TL } public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// A message was deleted in a connected business chat ». See [TLDef(0xA02A982E)] @@ -6036,6 +6066,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Represents a new reaction to a story. See [TLDef(0x1824E40B)] @@ -6105,6 +6136,7 @@ namespace TL public int qts; public override (long, int, int) GetMBox() => (-1, qts, 1); + public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Contains the current default paid reaction privacy, see here » for more info. See [TLDef(0x8B725FCE)] @@ -6172,6 +6204,49 @@ namespace TL exception = 0x1, } } + /// See + [TLDef(0x78C314E0)] + public sealed partial class UpdateGroupCallMessage : Update + { + public InputGroupCallBase call; + public Peer from_id; + public long random_id; + public TextWithEntities message; + } + /// See + [TLDef(0xC957A766)] + public sealed partial class UpdateGroupCallEncryptedMessage : Update + { + public InputGroupCallBase call; + public Peer from_id; + public byte[] encrypted_message; + } + /// See + [TLDef(0x683B2C52)] + public sealed partial class UpdatePinnedForumTopic : Update + { + public Flags flags; + public Peer peer; + public int topic_id; + + [Flags] public enum Flags : uint + { + pinned = 0x1, + } + } + /// See + [TLDef(0xDEF143D0)] + public sealed partial class UpdatePinnedForumTopics : Update + { + public Flags flags; + public Peer peer; + [IfFlag(0)] public int[] order; + + [Flags] public enum Flags : uint + { + has_order = 0x1, + } + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7270,6 +7345,13 @@ namespace TL /// Emoji public string emoticon; } + /// See + [TLDef(0x376D975C)] + public sealed partial class SendMessageTextDraftAction : SendMessageAction + { + public long random_id; + public TextWithEntities text; + } /// Users found by name substring and auxiliary data. See [TLDef(0xB3134D9D)] @@ -12436,9 +12518,9 @@ namespace TL public partial class ChannelAdminLogEventActionChangePeerColor : ChannelAdminLogEventAction { /// Previous accent palette - public PeerColor prev_value; + public PeerColorBase prev_value; /// New accent palette - public PeerColor new_value; + public PeerColorBase new_value; } /// The profile accent color was changed See [TLDef(0x5E477B25)] @@ -15253,6 +15335,9 @@ namespace TL creator = 0x8000, /// Field has a value has_invite_link = 0x10000, + messages_enabled = 0x20000, + can_change_messages_enabled = 0x40000, + min = 0x80000, } /// Group call ID @@ -15694,7 +15779,7 @@ namespace TL /// Available chat themes See /// a value means account.chatThemesNotModified - [TLDef(0x16484857)] + [TLDef(0xBE098173)] public sealed partial class Account_ChatThemes : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15708,7 +15793,7 @@ namespace TL /// Users mentioned in the themes field. public Dictionary users; /// Next offset for pagination. - [IfFlag(0)] public int next_offset; + [IfFlag(0)] public string next_offset; [Flags] public enum Flags : uint { @@ -15740,7 +15825,7 @@ namespace TL /// If set, contains some media. [IfFlag(14)] public MessageMedia media; /// If set, the sponsored message should use the message accent color » specified in color. - [IfFlag(13)] public PeerColor color; + [IfFlag(13)] public PeerColorBase color; /// Label of the sponsored message button. public string button_text; /// If set, contains additional information about the sponsor to be shown along with the message. @@ -16456,6 +16541,18 @@ namespace TL /// The upgrade hash from .prepaid_upgrade_hash or .prepaid_upgrade_hash. public string hash; } + /// See + [TLDef(0x3E77F614)] + public sealed partial class InputInvoicePremiumAuthCode : InputInvoice + { + public InputStorePaymentPurpose purpose; + } + /// See + [TLDef(0x0923D8D1)] + public sealed partial class InputInvoiceStarGiftDropOriginalDetails : InputInvoice + { + public InputSavedStarGift stargift; + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -17040,7 +17137,7 @@ namespace TL public override int ID => id; } /// Represents a forum topic. See - [TLDef(0x71701DA9)] + [TLDef(0xCDFF0ECA)] public sealed partial class ForumTopic : ForumTopicBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -17049,6 +17146,7 @@ namespace TL public int id; /// Topic creation date public DateTime date; + public Peer peer; /// Topic title public string title; /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. @@ -17090,6 +17188,7 @@ namespace TL short_ = 0x20, /// Whether the topic is hidden (only valid for the "General" topic, id=1) hidden = 0x40, + title_missing = 0x80, } /// Topic ID @@ -18709,9 +18808,11 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } + /// Represents a color palette ». See Derived classes: + public abstract partial class PeerColorBase : IObject { } /// Represents a color palette ». See [TLDef(0xB54B5ACF)] - public sealed partial class PeerColor : IObject + public sealed partial class PeerColor : PeerColorBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -18728,6 +18829,31 @@ namespace TL has_background_emoji_id = 0x2, } } + /// See + [TLDef(0xB9C0639A)] + public sealed partial class PeerColorCollectible : PeerColorBase + { + public Flags flags; + public long collectible_id; + public long gift_emoji_id; + public long background_emoji_id; + public int accent_color; + public int[] colors; + [IfFlag(0)] public int dark_accent_color; + [IfFlag(1)] public int[] dark_colors; + + [Flags] public enum Flags : uint + { + has_dark_accent_color = 0x1, + has_dark_colors = 0x2, + } + } + /// See + [TLDef(0xB8EA86A9)] + public sealed partial class InputPeerColorCollectible : PeerColorBase + { + public long collectible_id; + } /// Contains info about a color palette ». See Derived classes: , public abstract partial class Help_PeerColorSetBase : IObject { } @@ -20044,6 +20170,7 @@ namespace TL posts_search = 0x1000000, /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, + stargift_drop_original_details = 0x4000000, } } @@ -20488,6 +20615,7 @@ namespace TL limited_per_user = 0x100, /// Field has a value has_locked_until_date = 0x200, + peer_color_available = 0x400, } /// Identifier of the gift @@ -20500,7 +20628,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x1BEFE865)] + [TLDef(0xB0BF741B)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20539,6 +20667,8 @@ namespace TL [IfFlag(8)] public string value_currency; /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; + [IfFlag(11)] public PeerColorBase peer_color; + [IfFlag(12)] public Peer host_id; [Flags] public enum Flags : uint { @@ -20564,6 +20694,10 @@ namespace TL theme_available = 0x200, /// Field has a value has_theme_peer = 0x400, + /// Field has a value + has_peer_color = 0x800, + /// Field has a value + has_host_id = 0x1000, } /// Identifier of the collectible gift. @@ -20951,11 +21085,13 @@ namespace TL } /// A preview of the possible attributes (chosen randomly) a gift » can receive after upgrading it to a collectible gift », see here » for more info. See - [TLDef(0x167BD90B)] + [TLDef(0x3DE1DFED)] public sealed partial class Payments_StarGiftUpgradePreview : IObject { /// Possible gift attributes public StarGiftAttribute[] sample_attributes; + public StarGiftUpgradePrice[] prices; + public StarGiftUpgradePrice[] next_prices; } /// Describes a list of users (or bots). See @@ -21002,7 +21138,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0x19A9B572)] + [TLDef(0x8983A452)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21035,6 +21171,7 @@ namespace TL [IfFlag(15)] public int[] collection_id; /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; + [IfFlag(18)] public long drop_original_details_stars; [Flags] public enum Flags : uint { @@ -21074,6 +21211,8 @@ namespace TL has_prepaid_upgrade_hash = 0x10000, /// If set, someone already separately pre-paid for the upgrade of this gift. upgrade_separate = 0x20000, + /// Field has a value + has_drop_original_details_stars = 0x40000, } } @@ -21322,12 +21461,13 @@ namespace TL public StarGiftBase[] gifts; /// Offset for pagination, pass this to Payments_GetResaleStarGifts.offset to fetch the next results. [IfFlag(0)] public string next_offset; - /// Possible gift attributes. + /// Possible gift attributes, only set if Payments_GetResaleStarGifts.attributes_hash is set (on the first call, it must be equal to 0). [IfFlag(1)] public StarGiftAttribute[] attributes; /// Hash of the attributes field, pass this to Payments_GetResaleStarGifts.attributes_hash to avoid returning any attributes (flag not set) if they haven't changed. [IfFlag(1)] public long attributes_hash; /// Chats mentioned in the attributes. public Dictionary chats; + /// Indicates the total number of gifts that have a specific attribute, only set if Payments_GetResaleStarGifts.offset is empty (since this field is not related to the current result page but to all of them, it's only returned on the first page). [IfFlag(2)] public StarGiftAttributeCounter[] counters; /// Users mentioned in the attributes. public Dictionary users; @@ -21676,4 +21816,12 @@ namespace TL /// The slug from .slug. public string slug; } + + /// See + [TLDef(0x99EA331D)] + public sealed partial class StarGiftUpgradePrice : IObject + { + public DateTime date; + public long upgrade_stars; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ce2d58b..95c6790 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -387,6 +387,15 @@ namespace TL mnc = mnc, }); + /// See + public static Task Auth_CheckPaidAuth(this Client client, string phone_number, string phone_code_hash, long form_id) + => client.Invoke(new Auth_CheckPaidAuth + { + phone_number = phone_number, + phone_code_hash = phone_code_hash, + form_id = form_id, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1220,13 +1229,11 @@ namespace TL /// Update the accent color and background custom emoji » of the current account. See Possible codes: 400,403 (details) /// Whether to change the accent color emoji pattern of the profile page; otherwise, the accent color and emoji pattern of messages will be changed. /// ID of the accent color palette » to use (not RGB24, see here » for more info). - /// Custom emoji ID used in the accent color pattern. - public static Task Account_UpdateColor(this Client client, long? background_emoji_id = null, int? color = null, bool for_profile = false) + public static Task Account_UpdateColor(this Client client, PeerColorBase color = null, bool for_profile = false) => client.Invoke(new Account_UpdateColor { - flags = (Account_UpdateColor.Flags)((background_emoji_id != null ? 0x1 : 0) | (color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), - color = color ?? default, - background_emoji_id = background_emoji_id ?? default, + flags = (Account_UpdateColor.Flags)((color != null ? 0x4 : 0) | (for_profile ? 0x2 : 0)), + color = color, }); /// Get a set of suggested custom emoji stickers that can be used in an accent color pattern. See @@ -1495,7 +1502,7 @@ namespace TL /// Maximum number of results to return, see pagination /// Hash from a previously returned , to avoid returning any result if the theme list hasn't changed. /// a null value means account.chatThemesNotModified - public static Task Account_GetUniqueGiftChatThemes(this Client client, int offset = default, int limit = int.MaxValue, long hash = default) + public static Task Account_GetUniqueGiftChatThemes(this Client client, string offset, int limit = int.MaxValue, long hash = default) => client.Invoke(new Account_GetUniqueGiftChatThemes { offset = offset, @@ -1561,6 +1568,14 @@ namespace TL documents = documents, }); + /// See + public static Task Users_SuggestBirthday(this Client client, InputUserBase id, Birthday birthday) + => client.Invoke(new Users_SuggestBirthday + { + id = id, + birthday = birthday, + }); + /// Get the telegram IDs of all contacts.
Returns an array of Telegram user IDs for all contacts (0 if a contact does not have an associated Telegram account or have hidden their account using privacy settings). See
/// Hash used for caching, for more info click here public static Task Contacts_GetContactIDs(this Client client, long hash = default) @@ -1720,14 +1735,15 @@ namespace TL /// First name /// Last name /// User's phone number, may be omitted to simply add the user to the contact list, without a phone number. - public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, bool add_phone_privacy_exception = false) + public static Task Contacts_AddContact(this Client client, InputUserBase id, string first_name, string last_name, string phone, TextWithEntities note = null, bool add_phone_privacy_exception = false) => client.Invoke(new Contacts_AddContact { - flags = (Contacts_AddContact.Flags)(add_phone_privacy_exception ? 0x1 : 0), + flags = (Contacts_AddContact.Flags)((note != null ? 0x2 : 0) | (add_phone_privacy_exception ? 0x1 : 0)), id = id, first_name = first_name, last_name = last_name, phone = phone, + note = note, }); /// If the add contact action bar is active, add that user as contact See Possible codes: 400 (details) @@ -1819,6 +1835,14 @@ namespace TL q = q, }); + /// See + public static Task Contacts_UpdateContactNote(this Client client, InputUserBase id, TextWithEntities note) + => client.Invoke(new Contacts_UpdateContactNote + { + id = id, + note = note, + }); + /// 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) @@ -4490,7 +4514,7 @@ namespace TL /// The channel /// The message to react to /// The number of stars to send (each will increment the reaction counter by one). - /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the first 32 bits are random, and the remaining 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use + /// Unique client message ID required to prevent message resending.
Note: this argument must be composed of a 64-bit integer where the lower 32 bits are random, and the higher 32 bits are equal to the current unixtime, i.e. uint64_t random_id = (time() << 32) | ((uint64_t)random_uint32_t()): this differs from the random_id format of all other methods in the API, which just take 64 random bits. You can use /// Each post with star reactions has a leaderboard with the top senders, but users can opt out of appearing there if they prefer more privacy. Not populating this field will use the default reaction privacy, stored on the server and synced to clients using (see here for more info). public static Task Messages_SendPaidReaction(this Client client, InputPeer peer, int msg_id, int count, long random_id, PaidReactionPrivacy private_ = null) => client.Invoke(new Messages_SendPaidReaction @@ -4682,6 +4706,108 @@ namespace TL reject_comment = reject_comment, }); + /// Get topics of a forum See Possible codes: 400 (details) + /// Peer + /// Search query + /// Offsets for pagination, for more info click here, date of the last message of the last found topic. Use 0 or any date in the future to get results from the last topic. + /// Offsets for pagination, for more info click here, ID of the last message of the last found topic (or initially 0). + /// Offsets for pagination, for more info click here, ID of the last found topic (or initially 0). + /// Maximum number of results to return, see pagination. For optimal performance, the number of returned topics is chosen by the server and can be smaller than the specified limit. + public static Task Messages_GetForumTopics(this Client client, InputPeer peer, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) + => client.Invoke(new Messages_GetForumTopics + { + flags = (Messages_GetForumTopics.Flags)(q != null ? 0x1 : 0), + peer = peer, + q = q, + offset_date = offset_date, + offset_id = offset_id, + offset_topic = offset_topic, + limit = limit, + }); + + /// Get forum topics by their ID See Possible codes: 400 (details) + /// Peer + /// Topic IDs + public static Task Messages_GetForumTopicsByID(this Client client, InputPeer peer, params int[] topics) + => client.Invoke(new Messages_GetForumTopicsByID + { + peer = peer, + topics = topics, + }); + + /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic ID + /// If present, will update the topic title (maximum UTF-8 length: 128). + /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. + /// If present, will update the open/closed status of the topic. + /// If present, will hide/unhide the topic (only valid for the "General" topic, id=1). + public static Task Messages_EditForumTopic(this Client client, InputPeer peer, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) + => client.Invoke(new Messages_EditForumTopic + { + flags = (Messages_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), + peer = peer, + topic_id = topic_id, + title = title, + icon_emoji_id = icon_emoji_id ?? default, + closed = closed ?? default, + hidden = hidden ?? default, + }); + + /// Pin or unpin forum topics See Possible codes: 400 (details) + /// Peer + /// Forum topic ID + /// Whether to pin or unpin the topic + public static Task Messages_UpdatePinnedForumTopic(this Client client, InputPeer peer, int topic_id, bool pinned) + => client.Invoke(new Messages_UpdatePinnedForumTopic + { + peer = peer, + topic_id = topic_id, + pinned = pinned, + }); + + /// Reorder pinned forum topics See Possible codes: 400 (details) + /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) + /// Peer + /// Topic IDs » + public static Task Messages_ReorderPinnedForumTopics(this Client client, InputPeer peer, int[] order, bool force = false) + => client.Invoke(new Messages_ReorderPinnedForumTopics + { + flags = (Messages_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0), + peer = peer, + order = order, + }); + + /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic title (maximum UTF-8 length: 128) + /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. + /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. + /// Unique client message ID to prevent duplicate sending of the same event You can use + /// Create the topic as the specified peer + public static Task Messages_CreateForumTopic(this Client client, InputPeer peer, string title, long random_id, int? icon_color = null, InputPeer send_as = null, long? icon_emoji_id = null, bool title_missing = false) + => client.Invoke(new Messages_CreateForumTopic + { + flags = (Messages_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0) | (title_missing ? 0x10 : 0)), + peer = peer, + title = title, + icon_color = icon_color ?? default, + icon_emoji_id = icon_emoji_id ?? default, + random_id = random_id, + send_as = send_as, + }); + + /// See + /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) + /// Peer + /// Topic ID + public static Task Messages_DeleteTopicHistory(this Client client, InputPeer peer, int top_msg_id) + => client.InvokeAffected(new Messages_DeleteTopicHistory + { + peer = peer, + top_msg_id = top_msg_id, + }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5548,107 +5674,6 @@ namespace TL tabs = tabs, }); - /// Create a forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) - /// The forum - /// Topic title (maximum UTF-8 length: 128) - /// If no custom emoji icon is specified, specifies the color of the fallback topic icon (RGB), one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F. - /// ID of the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. - /// Unique client message ID to prevent duplicate sending of the same event You can use - /// Create the topic as the specified peer - public static Task Channels_CreateForumTopic(this Client client, InputChannelBase channel, string title, long random_id, int? icon_color = null, InputPeer send_as = null, long? icon_emoji_id = null) - => client.Invoke(new Channels_CreateForumTopic - { - flags = (Channels_CreateForumTopic.Flags)((icon_color != null ? 0x1 : 0) | (send_as != null ? 0x4 : 0) | (icon_emoji_id != null ? 0x8 : 0)), - channel = channel, - title = title, - icon_color = icon_color ?? default, - icon_emoji_id = icon_emoji_id ?? default, - random_id = random_id, - send_as = send_as, - }); - - /// Get topics of a forum See Possible codes: 400 (details) - /// Supergroup - /// Search query - /// Offsets for pagination, for more info click here, date of the last message of the last found topic. Use 0 or any date in the future to get results from the last topic. - /// Offsets for pagination, for more info click here, ID of the last message of the last found topic (or initially 0). - /// Offsets for pagination, for more info click here, ID of the last found topic (or initially 0). - /// Maximum number of results to return, see pagination. For optimal performance, the number of returned topics is chosen by the server and can be smaller than the specified limit. - public static Task Channels_GetForumTopics(this Client client, InputChannelBase channel, DateTime offset_date = default, int offset_id = default, int offset_topic = default, int limit = int.MaxValue, string q = null) - => client.Invoke(new Channels_GetForumTopics - { - flags = (Channels_GetForumTopics.Flags)(q != null ? 0x1 : 0), - channel = channel, - q = q, - offset_date = offset_date, - offset_id = offset_id, - offset_topic = offset_topic, - limit = limit, - }); - - /// Get forum topics by their ID See Possible codes: 400 (details) - /// Forum - /// Topic IDs - public static Task Channels_GetForumTopicsByID(this Client client, InputChannelBase channel, params int[] topics) - => client.Invoke(new Channels_GetForumTopicsByID - { - channel = channel, - topics = topics, - }); - - /// Edit forum topic; requires manage_topics rights. See [bots: ✓] Possible codes: 400,403 (details) - /// Supergroup - /// Topic ID - /// If present, will update the topic title (maximum UTF-8 length: 128). - /// If present, updates the custom emoji used as topic icon. Telegram Premium users can use any custom emoji, other users can only use the custom emojis contained in the emoji pack. Pass 0 to switch to the fallback topic icon. - /// If present, will update the open/closed status of the topic. - /// If present, will hide/unhide the topic (only valid for the "General" topic, id=1). - public static Task Channels_EditForumTopic(this Client client, InputChannelBase channel, int topic_id, string title = null, long? icon_emoji_id = null, bool? closed = default, bool? hidden = default) - => client.Invoke(new Channels_EditForumTopic - { - flags = (Channels_EditForumTopic.Flags)((title != null ? 0x1 : 0) | (icon_emoji_id != null ? 0x2 : 0) | (closed != default ? 0x4 : 0) | (hidden != default ? 0x8 : 0)), - channel = channel, - topic_id = topic_id, - title = title, - icon_emoji_id = icon_emoji_id ?? default, - closed = closed ?? default, - hidden = hidden ?? default, - }); - - /// Pin or unpin forum topics See Possible codes: 400 (details) - /// Supergroup ID - /// Forum topic ID - /// Whether to pin or unpin the topic - public static Task Channels_UpdatePinnedForumTopic(this Client client, InputChannelBase channel, int topic_id, bool pinned) - => client.Invoke(new Channels_UpdatePinnedForumTopic - { - channel = channel, - topic_id = topic_id, - pinned = pinned, - }); - - /// Delete message history of a forum topic See [bots: ✓] Possible codes: 400,403 (details) - /// Forum - /// Topic ID - public static Task Channels_DeleteTopicHistory(this Client client, InputChannelBase channel, int top_msg_id) - => client.InvokeAffected(new Channels_DeleteTopicHistory - { - channel = channel, - top_msg_id = top_msg_id, - }, channel.ChannelId); - - /// Reorder pinned forum topics See Possible codes: 400 (details) - /// If not set, the order of only the topics present both server-side and in order will be changed (i.e. mentioning topics not pinned server-side in order will not pin them, and not mentioning topics pinned server-side will not unpin them).
If set, the entire server-side pinned topic list will be replaced with order (i.e. mentioning topics not pinned server-side in order will pin them, and not mentioning topics pinned server-side will unpin them) - /// Supergroup ID - /// Topic IDs » - public static Task Channels_ReorderPinnedForumTopics(this Client client, InputChannelBase channel, int[] order, bool force = false) - => client.Invoke(new Channels_ReorderPinnedForumTopics - { - flags = (Channels_ReorderPinnedForumTopics.Flags)(force ? 0x1 : 0), - channel = channel, - order = order, - }); - /// Enable or disable the native antispam system. See Possible codes: 400 (details) /// Supergroup ID. The specified supergroup must have at least telegram_antispam_group_size_min members to enable antispam functionality, as specified by the client configuration parameters. /// Enable or disable the native antispam system. @@ -6589,10 +6614,10 @@ namespace TL /// Only returns gifts within the specified collection ». /// Offset for pagination. /// Maximum number of results to return, see pagination - public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false) + public static Task Payments_GetSavedStarGifts(this Client client, InputPeer peer, string offset, int limit = int.MaxValue, int? collection_id = null, bool exclude_unsaved = false, bool exclude_saved = false, bool exclude_unlimited = false, bool exclude_unique = false, bool sort_by_value = false, bool exclude_upgradable = false, bool exclude_unupgradable = false, bool peer_color_available = false, bool exclude_hosted = false) => client.Invoke(new Payments_GetSavedStarGifts { - flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0)), + flags = (Payments_GetSavedStarGifts.Flags)((collection_id != null ? 0x40 : 0) | (exclude_unsaved ? 0x1 : 0) | (exclude_saved ? 0x2 : 0) | (exclude_unlimited ? 0x4 : 0) | (exclude_unique ? 0x10 : 0) | (sort_by_value ? 0x20 : 0) | (exclude_upgradable ? 0x80 : 0) | (exclude_unupgradable ? 0x100 : 0) | (peer_color_available ? 0x200 : 0) | (exclude_hosted ? 0x400 : 0)), peer = peer, collection_id = collection_id ?? default, offset = offset, @@ -6648,10 +6673,10 @@ namespace TL /// Get collectible gifts of a specific type currently on resale, see here » for more info. See Possible codes: 400 (details) /// Sort gifts by price (ascending). /// Sort gifts by number (ascending). - /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed. + /// If a previous call to the method was made and .attributes_hash was set, pass it here to avoid returning any results if they haven't changed.
Otherwise, set this flag and pass 0 to return .attributes_hash and .attributes, these two fields will not be set if this flag is not set. /// Mandatory identifier of the base gift from which the collectible gift was upgraded. /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. - /// Offset for pagination. + /// Offset for pagination. If not equal to an empty string, .counters will not be set to avoid returning the counters every time a new page is fetched. /// Maximum number of results to return, see pagination public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) => client.Invoke(new Payments_GetResaleStarGifts @@ -7057,12 +7082,13 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (reset_invite_hash ? 0x2 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, join_muted = join_muted ?? default, + messages_enabled = messages_enabled ?? default, }); /// Get info about a group call See Possible codes: 400,403 (details) @@ -7318,6 +7344,23 @@ namespace TL limit = limit, }); + /// See + public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message) + => client.Invoke(new Phone_SendGroupCallMessage + { + call = call, + random_id = random_id, + message = message, + }); + + /// See + public static Task Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message) + => client.Invoke(new Phone_SendGroupCallEncryptedMessage + { + call = call, + encrypted_message = encrypted_message, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Platform identifier (i.e. android, tdesktop, etc). /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. @@ -8359,6 +8402,14 @@ namespace TL.Methods public string mnc; } + [TLDef(0x56E59F9C)] + public sealed partial class Auth_CheckPaidAuth : IMethod + { + public string phone_number; + public string phone_code_hash; + public long form_id; + } + [TLDef(0xEC86017A)] public sealed partial class Account_RegisterDevice : IMethod { @@ -9003,16 +9054,14 @@ namespace TL.Methods public string[] codes; } - [TLDef(0x7CEFA15D)] + [TLDef(0x684D214E)] public sealed partial class Account_UpdateColor : IMethod { public Flags flags; - [IfFlag(2)] public int color; - [IfFlag(0)] public long background_emoji_id; + [IfFlag(2)] public PeerColorBase color; [Flags] public enum Flags : uint { - has_background_emoji_id = 0x1, for_profile = 0x2, has_color = 0x4, } @@ -9256,10 +9305,10 @@ namespace TL.Methods public long hash; } - [TLDef(0xFE74EF9F)] + [TLDef(0xE42CE9C9)] public sealed partial class Account_GetUniqueGiftChatThemes : IMethod { - public int offset; + public string offset; public int limit; public long hash; } @@ -9305,6 +9354,13 @@ namespace TL.Methods public InputDocument[] documents; } + [TLDef(0xFC533372)] + public sealed partial class Users_SuggestBirthday : IMethod + { + public InputUserBase id; + public Birthday birthday; + } + [TLDef(0x7ADC669D)] public sealed partial class Contacts_GetContactIDs : IMethod { @@ -9436,7 +9492,7 @@ namespace TL.Methods public bool enabled; } - [TLDef(0xE8F463D0)] + [TLDef(0xD9BA2E54)] public sealed partial class Contacts_AddContact : IMethod { public Flags flags; @@ -9444,10 +9500,12 @@ namespace TL.Methods public string first_name; public string last_name; public string phone; + [IfFlag(1)] public TextWithEntities note; [Flags] public enum Flags : uint { add_phone_privacy_exception = 0x1, + has_note = 0x2, } } @@ -9528,6 +9586,13 @@ namespace TL.Methods public string q; } + [TLDef(0x139F63FB)] + public sealed partial class Contacts_UpdateContactNote : IMethod + { + public InputUserBase id; + public TextWithEntities note; + } + [TLDef(0x63C66506)] public sealed partial class Messages_GetMessages : IMethod { @@ -11991,6 +12056,98 @@ namespace TL.Methods } } + [TLDef(0x3BA47BFF)] + public sealed partial class Messages_GetForumTopics : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public string q; + public DateTime offset_date; + public int offset_id; + public int offset_topic; + public int limit; + + [Flags] public enum Flags : uint + { + has_q = 0x1, + } + } + + [TLDef(0xAF0A4A08)] + public sealed partial class Messages_GetForumTopicsByID : IMethod + { + public InputPeer peer; + public int[] topics; + } + + [TLDef(0xCECC1134)] + public sealed partial class Messages_EditForumTopic : IMethod + { + public Flags flags; + public InputPeer peer; + public int topic_id; + [IfFlag(0)] public string title; + [IfFlag(1)] public long icon_emoji_id; + [IfFlag(2)] public bool closed; + [IfFlag(3)] public bool hidden; + + [Flags] public enum Flags : uint + { + has_title = 0x1, + has_icon_emoji_id = 0x2, + has_closed = 0x4, + has_hidden = 0x8, + } + } + + [TLDef(0x175DF251)] + public sealed partial class Messages_UpdatePinnedForumTopic : IMethod + { + public InputPeer peer; + public int topic_id; + public bool pinned; + } + + [TLDef(0x0E7841F0)] + public sealed partial class Messages_ReorderPinnedForumTopics : IMethod + { + public Flags flags; + public InputPeer peer; + public int[] order; + + [Flags] public enum Flags : uint + { + force = 0x1, + } + } + + [TLDef(0x2F98C3D5)] + public sealed partial class Messages_CreateForumTopic : IMethod + { + public Flags flags; + public InputPeer peer; + public string title; + [IfFlag(0)] public int icon_color; + [IfFlag(3)] public long icon_emoji_id; + public long random_id; + [IfFlag(2)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_icon_color = 0x1, + has_send_as = 0x4, + has_icon_emoji_id = 0x8, + title_missing = 0x10, + } + } + + [TLDef(0xD2816F10)] + public sealed partial class Messages_DeleteTopicHistory : IMethod + { + public InputPeer peer; + public int top_msg_id; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12648,97 +12805,6 @@ namespace TL.Methods public bool tabs; } - [TLDef(0xF40C0224)] - public sealed partial class Channels_CreateForumTopic : IMethod - { - public Flags flags; - public InputChannelBase channel; - public string title; - [IfFlag(0)] public int icon_color; - [IfFlag(3)] public long icon_emoji_id; - public long random_id; - [IfFlag(2)] public InputPeer send_as; - - [Flags] public enum Flags : uint - { - has_icon_color = 0x1, - has_send_as = 0x4, - has_icon_emoji_id = 0x8, - } - } - - [TLDef(0x0DE560D1)] - public sealed partial class Channels_GetForumTopics : IMethod - { - public Flags flags; - public InputChannelBase channel; - [IfFlag(0)] public string q; - public DateTime offset_date; - public int offset_id; - public int offset_topic; - public int limit; - - [Flags] public enum Flags : uint - { - has_q = 0x1, - } - } - - [TLDef(0xB0831EB9)] - public sealed partial class Channels_GetForumTopicsByID : IMethod - { - public InputChannelBase channel; - public int[] topics; - } - - [TLDef(0xF4DFA185)] - public sealed partial class Channels_EditForumTopic : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int topic_id; - [IfFlag(0)] public string title; - [IfFlag(1)] public long icon_emoji_id; - [IfFlag(2)] public bool closed; - [IfFlag(3)] public bool hidden; - - [Flags] public enum Flags : uint - { - has_title = 0x1, - has_icon_emoji_id = 0x2, - has_closed = 0x4, - has_hidden = 0x8, - } - } - - [TLDef(0x6C2D9026)] - public sealed partial class Channels_UpdatePinnedForumTopic : IMethod - { - public InputChannelBase channel; - public int topic_id; - public bool pinned; - } - - [TLDef(0x34435F2D)] - public sealed partial class Channels_DeleteTopicHistory : IMethod - { - public InputChannelBase channel; - public int top_msg_id; - } - - [TLDef(0x2950A18F)] - public sealed partial class Channels_ReorderPinnedForumTopics : IMethod - { - public Flags flags; - public InputChannelBase channel; - public int[] order; - - [Flags] public enum Flags : uint - { - force = 0x1, - } - } - [TLDef(0x68F3E4EB)] public sealed partial class Channels_ToggleAntiSpam : IMethod { @@ -13551,6 +13617,8 @@ namespace TL.Methods has_collection_id = 0x40, exclude_upgradable = 0x80, exclude_unupgradable = 0x100, + peer_color_available = 0x200, + exclude_hosted = 0x400, } } @@ -13925,17 +13993,19 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0x74BBB43D)] + [TLDef(0xE9723804)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; + [IfFlag(2)] public bool messages_enabled; [Flags] public enum Flags : uint { has_join_muted = 0x1, reset_invite_hash = 0x2, + has_messages_enabled = 0x4, } } @@ -14148,6 +14218,21 @@ namespace TL.Methods public int limit; } + [TLDef(0x87893014)] + public sealed partial class Phone_SendGroupCallMessage : IMethod + { + public InputGroupCallBase call; + public long random_id; + public TextWithEntities message; + } + + [TLDef(0xE5AFA56D)] + public sealed partial class Phone_SendGroupCallEncryptedMessage : IMethod + { + public InputGroupCallBase call; + public byte[] encrypted_message; + } + [TLDef(0xF2F2330A)] public sealed partial class Langpack_GetLangPack : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 00b0355..dec7eeb 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 = 214; // fetched 01/09/2025 11:20:56 + public const int Version = 216; // fetched 10/10/2025 20:01:17 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -216,7 +216,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0xF24DE7FA] = typeof(MessageActionStarGift), - [0x34F762F3] = typeof(MessageActionStarGiftUnique), + [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -226,6 +226,7 @@ namespace TL [0x95DDCF69] = typeof(MessageActionSuggestedPostSuccess), [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), [0xA8A3C699] = typeof(MessageActionGiftTon), + [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -240,7 +241,7 @@ namespace TL [0xB2A2F663] = typeof(GeoPoint), [0x5E002502] = typeof(Auth_SentCode), [0x2390FE44] = typeof(Auth_SentCodeSuccess), - [0xD7A2FCF9] = typeof(Auth_SentCodePaymentRequired), + [0xE0955A3C] = typeof(Auth_SentCodePaymentRequired), [0x2EA2C0D4] = typeof(Auth_Authorization), [0x44747E9A] = typeof(Auth_AuthorizationSignUpRequired), [0xB434E2B8] = typeof(Auth_ExportedAuthorization), @@ -254,7 +255,7 @@ namespace TL [0xF47741F7] = typeof(PeerSettings), [0xA437C3ED] = typeof(WallPaper), [0xE0804116] = typeof(WallPaperNoFile), - [0xC577B5AD] = typeof(UserFull), + [0xA02BC13E] = typeof(UserFull), [0x145ADE0B] = typeof(Contact), [0xC13E3C50] = typeof(ImportedContact), [0x16D9703B] = typeof(ContactStatus), @@ -266,8 +267,8 @@ namespace TL [0x15BA6C40] = typeof(Messages_Dialogs), [0x71E094F3] = typeof(Messages_DialogsSlice), [0xF0E3E596] = typeof(Messages_DialogsNotModified), - [0x8C718E87] = typeof(Messages_Messages), - [0x762B263D] = typeof(Messages_MessagesSlice), + [0x1D73E7EA] = typeof(Messages_Messages), + [0x5F206716] = typeof(Messages_MessagesSlice), [0xC776BA4E] = typeof(Messages_ChannelMessages), [0x74535F21] = typeof(Messages_MessagesNotModified), [0x64FF9FD5] = typeof(Messages_Chats), @@ -294,7 +295,7 @@ namespace TL [0x1F2B0AFD] = typeof(UpdateNewMessage), [0x4E90BFD6] = typeof(UpdateMessageID), [0xA20DB0E5] = typeof(UpdateDeleteMessages), - [0xC01E857F] = typeof(UpdateUserTyping), + [0x2A17BF5C] = typeof(UpdateUserTyping), [0x83487AF0] = typeof(UpdateChatUserTyping), [0x07761198] = typeof(UpdateChatParticipants), [0xE5BDF8DE] = typeof(UpdateUserStatus), @@ -311,7 +312,7 @@ namespace TL [0xEBE46819] = typeof(UpdateServiceNotification), [0xEE3B272A] = typeof(UpdatePrivacy), [0x05492A13] = typeof(UpdateUserPhone), - [0x9C974FDF] = typeof(UpdateReadHistoryInbox), + [0x9E84BC99] = typeof(UpdateReadHistoryInbox), [0x2F2F21BF] = typeof(UpdateReadHistoryOutbox), [0x7F891213] = typeof(UpdateWebPage), [0xF8227181] = typeof(UpdateReadMessagesContents), @@ -398,8 +399,6 @@ namespace TL [0x6F7863F4] = typeof(UpdateRecentReactions), [0x86FCCF85] = typeof(UpdateMoveStickerSetToTop), [0xD5A41724] = typeof(UpdateMessageExtendedMedia), - [0x192EFBE3] = typeof(UpdateChannelPinnedTopic), - [0xFE198602] = typeof(UpdateChannelPinnedTopics), [0x20529438] = typeof(UpdateUser), [0xEC05B097] = typeof(UpdateAutoSaveSettings), [0x75B3B798] = typeof(UpdateStory), @@ -436,6 +435,10 @@ namespace TL [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), + [0x78C314E0] = typeof(UpdateGroupCallMessage), + [0xC957A766] = typeof(UpdateGroupCallEncryptedMessage), + [0x683B2C52] = typeof(UpdatePinnedForumTopic), + [0xDEF143D0] = typeof(UpdatePinnedForumTopics), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -505,6 +508,7 @@ namespace TL [0xB05AC6B1] = typeof(SendMessageChooseStickerAction), [0x25972BCB] = typeof(SendMessageEmojiInteraction), [0xB665902E] = typeof(SendMessageEmojiInteractionSeen), + [0x376D975C] = typeof(SendMessageTextDraftAction), [0xB3134D9D] = typeof(Contacts_Found), [0x0D09E07B] = typeof(InputPrivacyValueAllowContacts), [0x184B35CE] = typeof(InputPrivacyValueAllowAll), @@ -1082,7 +1086,7 @@ namespace TL [0xC3DFFC04] = typeof(ChatTheme), [0x3458F9C8] = typeof(ChatThemeUniqueGift), [0xE011E1C4] = null,//Account_ChatThemesNotModified - [0x16484857] = typeof(Account_ChatThemes), + [0xBE098173] = typeof(Account_ChatThemes), [0x7DBF8673] = typeof(SponsoredMessage), [0xFFDA656D] = typeof(Messages_SponsoredMessages), [0x1839490F] = null,//Messages_SponsoredMessagesEmpty @@ -1135,6 +1139,8 @@ namespace TL [0xF4997E42] = typeof(InputInvoiceBusinessBotTransferStars), [0xC39F5324] = typeof(InputInvoiceStarGiftResale), [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), + [0x3E77F614] = typeof(InputInvoicePremiumAuthCode), + [0x0923D8D1] = typeof(InputInvoiceStarGiftDropOriginalDetails), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1177,7 +1183,7 @@ namespace TL [0xFCFEB29C] = typeof(StickerKeyword), [0xB4073647] = typeof(Username), [0x023F109B] = typeof(ForumTopicDeleted), - [0x71701DA9] = typeof(ForumTopic), + [0xCDFF0ECA] = typeof(ForumTopic), [0x367617D3] = typeof(Messages_ForumTopics), [0x43B46B20] = typeof(DefaultHistoryTTL), [0x41BF109B] = typeof(ExportedContactToken), @@ -1265,6 +1271,8 @@ namespace TL [0xEDF3ADD0] = typeof(PublicForwardStory), [0x93037E20] = typeof(Stats_PublicForwards), [0xB54B5ACF] = typeof(PeerColor), + [0xB9C0639A] = typeof(PeerColorCollectible), + [0xB8EA86A9] = typeof(InputPeerColorCollectible), [0x26219A58] = typeof(Help_PeerColorSet), [0x767D61EB] = typeof(Help_PeerColorProfileSet), [0xADEC6EBE] = typeof(Help_PeerColorOption), @@ -1368,7 +1376,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x80AC53C3] = typeof(StarGift), - [0x1BEFE865] = typeof(StarGiftUnique), + [0xB0BF741B] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1392,12 +1400,12 @@ namespace TL [0x13ACFF19] = typeof(StarGiftAttributePattern), [0xD93D859C] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), - [0x167BD90B] = typeof(Payments_StarGiftUpgradePreview), + [0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0x19A9B572] = typeof(SavedStarGift), + [0x8983A452] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1444,6 +1452,7 @@ namespace TL [0x83268483] = null,//InputChatThemeEmpty [0xC93DE95C] = typeof(InputChatTheme), [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), + [0x99EA331D] = typeof(StarGiftUpgradePrice), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6fd580b..906cc13 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.214 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 214 + layer.216 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 Release Notes: $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) From 40bcf69bfb609236c37eb5bca6c0b402172a0535 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:30:02 +0100 Subject: [PATCH 313/336] Change UserStatusOffline.was_online to a DateTime --- src/TL.Schema.cs | 2 +- src/TL.Xtended.cs | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 45807d0..dc0549c 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -963,7 +963,7 @@ namespace TL public sealed partial class UserStatusOffline : UserStatus { /// Time the user was last seen online - public int was_online; + public DateTime was_online; } /// Online status: last seen recently See [TLDef(0x7B197DC8)] diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 630a370..9811d07 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -216,7 +216,7 @@ namespace TL /// a null value means userStatusEmpty = last seen a long time ago, more than a month (or blocked/deleted users) partial class UserStatus { internal abstract TimeSpan LastSeenAgo { get; } } partial class UserStatusOnline { internal override TimeSpan LastSeenAgo => TimeSpan.Zero; } - partial class UserStatusOffline { internal override TimeSpan LastSeenAgo => DateTime.UtcNow - new DateTime((was_online + 62135596800L) * 10000000, DateTimeKind.Utc); } + partial class UserStatusOffline { internal override TimeSpan LastSeenAgo => DateTime.UtcNow - was_online; } /// covers anything between 1 second and 2-3 days partial class UserStatusRecently { internal override TimeSpan LastSeenAgo => TimeSpan.FromDays(1); } /// between 2-3 and seven days @@ -690,8 +690,8 @@ namespace TL { System.Text.Json.JsonValueKind.True or System.Text.Json.JsonValueKind.False => new JsonBool { value = elem.GetBoolean() }, - System.Text.Json.JsonValueKind.Object => new JsonObject { value = elem.EnumerateObject().Select(FromJsonProperty).ToArray() }, - System.Text.Json.JsonValueKind.Array => new JsonArray { value = elem.EnumerateArray().Select(FromJsonElement).ToArray() }, + System.Text.Json.JsonValueKind.Object => new JsonObject { value = [.. elem.EnumerateObject().Select(FromJsonProperty)] }, + System.Text.Json.JsonValueKind.Array => new JsonArray { value = [.. elem.EnumerateArray().Select(FromJsonElement)] }, System.Text.Json.JsonValueKind.String => new JsonString { value = elem.GetString() }, System.Text.Json.JsonValueKind.Number => new JsonNumber { value = elem.GetDouble() }, _ => new JsonNull(), @@ -710,7 +710,7 @@ namespace TL sb.Append(i == 0 ? "" : ",").Append(value[i]); return sb.Append(']').ToString(); } - public object[] ToNativeArray() => value.Select(v => v.ToNative()).ToArray(); + public object[] ToNativeArray() => [.. value.Select(v => v.ToNative())]; public override object ToNative() { if (value.Length == 0) return Array.Empty(); From 9693037ef2023bfa08dcaf6dfa91933762eafc29 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:31:30 +0100 Subject: [PATCH 314/336] Added missing DownloadFileAsync(doc, videoSize) --- src/Client.Helpers.cs | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 6faa509..8a3768f 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -361,6 +361,18 @@ namespace WTelegram return thumbSize == null ? document.mime_type : "image/" + fileType; } + /// Download a document from Telegram into the outputStream + /// The document to download + /// Stream to write the file content to. This method does not close/dispose the stream + /// A specific size/version of the animated photo. Use photo.LargestVideoSize to download the largest version of the animated photo + /// (optional) Callback for tracking the progression of the transfer + /// MIME type of the document/thumbnail + public async Task DownloadFileAsync(Document document, Stream outputStream, VideoSize videoSize, ProgressCallback progress = null) + { + var fileLocation = document.ToFileLocation(videoSize); + return await DownloadFileAsync(fileLocation, outputStream, document.dc_id, videoSize.size, progress); + } + /// Download a file from Telegram into the outputStream /// Telegram file identifier, typically obtained with a .ToFileLocation() call /// Stream to write file content to. This method does not close/dispose the stream From 4ccfddd22e17b7f7178e20b04ade84881a575c43 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 00:36:24 +0100 Subject: [PATCH 315/336] Collect: Fix Channel losing participants_count --- src/Services.cs | 7 ++++++- src/UpdateManager.cs | 2 +- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index 4b8cd9d..a98c8fe 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -70,8 +70,13 @@ namespace TL foreach (var chat in chats) if (chat is not Channel channel) _chats[chat.ID] = chat; - else if (!channel.flags.HasFlag(Channel.Flags.min) || !_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel || prevChannel.flags.HasFlag(Channel.Flags.min)) + else if (!_chats.TryGetValue(channel.id, out var prevChat) || prevChat is not Channel prevChannel) _chats[channel.id] = channel; + else if (!channel.flags.HasFlag(Channel.Flags.min) || prevChannel.flags.HasFlag(Channel.Flags.min)) + { + if (channel.participants_count == 0) channel.participants_count = prevChannel.participants_count; // non-min channel can lack this info + _chats[channel.id] = channel; + } else { // update previously full channel from min channel: const Channel.Flags updated_flags = (Channel.Flags)0x7FDC0BE0; diff --git a/src/UpdateManager.cs b/src/UpdateManager.cs index 1f7e328..9446054 100644 --- a/src/UpdateManager.cs +++ b/src/UpdateManager.cs @@ -566,7 +566,7 @@ namespace WTelegram /// Save the current state of the manager to JSON file /// File path to write - /// Note: This does not save the the content of collected Users/Chats dictionaries + /// Note: This does not save the content of collected Users/Chats dictionaries public void SaveState(string statePath) => System.IO.File.WriteAllText(statePath, System.Text.Json.JsonSerializer.Serialize(State, Helpers.JsonOptions)); public static Dictionary LoadState(string statePath) => !System.IO.File.Exists(statePath) ? null From 9ec2f31f72f603eac65882a3255fa8f50dcccd5e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 31 Oct 2025 18:21:11 +0100 Subject: [PATCH 316/336] Delete alt-session on AUTH_KEY_UNREGISTERED for renegociation --- .github/workflows/dev.yml | 31 +++++++++++++++++++++++-------- .github/workflows/release.yml | 23 ++++++++++++++++++++--- src/Client.cs | 4 ++-- src/WTelegramClient.csproj | 4 ++-- 4 files changed, 47 insertions(+), 15 deletions(-) diff --git a/.github/workflows/dev.yml b/.github/workflows/dev.yml index 222fc7a..de5e145 100644 --- a/.github/workflows/dev.yml +++ b/.github/workflows/dev.yml @@ -12,14 +12,16 @@ env: jobs: build: + permissions: + id-token: write # enable GitHub OIDC token issuance for this job runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - fetch-depth: 100 + fetch-depth: 30 - name: Determine version run: | - git fetch --depth=100 --tags + git fetch --depth=30 --tags DESCR_TAG=$(git describe --tags) COMMITS=${DESCR_TAG#*-} COMMITS=${COMMITS%-*} @@ -29,19 +31,32 @@ jobs: if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION echo "VERSION=$VERSION" >> $GITHUB_ENV - - name: Setup .NET - uses: actions/setup-dotnet@v4 - with: - dotnet-version: 8.0.x + + # - name: Setup .NET + # uses: actions/setup-dotnet@v4 + # with: + # dotnet-version: 8.0.x - name: Pack - run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + run: | + RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A} + RELEASE_NOTES=${RELEASE_NOTES//\"/%22} + RELEASE_NOTES=${RELEASE_NOTES//,/%2C} + RELEASE_NOTES=${RELEASE_NOTES//;/%3B} + dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages # - name: Upload artifact # uses: actions/upload-artifact@v4 # with: # name: packages # path: packages/*.nupkg + + - name: NuGet login (OIDC → temp API key) + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} - name: Nuget push - run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Deployment Notification env: JSON: | diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 052eafb..7bdbcd1 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,7 +21,8 @@ jobs: build: runs-on: ubuntu-latest permissions: - contents: write # For git tag + contents: write # For git tag + id-token: write # enable GitHub OIDC token issuance for this job steps: - uses: actions/checkout@v4 with: @@ -37,19 +38,35 @@ jobs: if [[ "$RELEASE_VERSION" > "$NEXT_VERSION" ]] then VERSION=$RELEASE_VERSION; else VERSION=$NEXT_VERSION; fi echo Last tag: $LAST_TAG · Next version: $NEXT_VERSION · Release version: $RELEASE_VERSION · Build version: $VERSION echo "VERSION=$VERSION" >> $GITHUB_ENV + - name: Setup .NET uses: actions/setup-dotnet@v4 with: dotnet-version: 8.0.x - name: Pack - run: dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION "-p:ReleaseNotes=\"$RELEASE_NOTES\"" --output packages + run: | + RELEASE_NOTES=${RELEASE_NOTES//|/%0A} + RELEASE_NOTES=${RELEASE_NOTES// - /%0A- } + RELEASE_NOTES=${RELEASE_NOTES// /%0A%0A} + RELEASE_NOTES=${RELEASE_NOTES//$'\n'/%0A} + RELEASE_NOTES=${RELEASE_NOTES//\"/%22} + RELEASE_NOTES=${RELEASE_NOTES//,/%2C} + RELEASE_NOTES=${RELEASE_NOTES//;/%3B} + dotnet pack $PROJECT_PATH --configuration $CONFIGURATION -p:Version=$VERSION -p:ReleaseNotes="$RELEASE_NOTES" --output packages # - name: Upload artifact # uses: actions/upload-artifact@v4 # with: # name: packages # path: packages/*.nupkg + + - name: NuGet login (OIDC → temp API key) + uses: NuGet/login@v1 + id: login + with: + user: ${{ secrets.NUGET_USER }} - name: Nuget push - run: dotnet nuget push packages/*.nupkg --api-key ${{secrets.NUGETAPIKEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + run: dotnet nuget push packages/*.nupkg --api-key ${{steps.login.outputs.NUGET_API_KEY}} --skip-duplicate --source https://api.nuget.org/v3/index.json + - name: Git tag run: | git tag $VERSION diff --git a/src/Client.cs b/src/Client.cs index be24bf3..dc054e0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1477,7 +1477,7 @@ namespace WTelegram writer.Write(0L); // int64 auth_key_id = 0 (Unencrypted) writer.Write(msgId); // int64 message_id writer.Write(0); // int32 message_data_length (to be patched) - Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}..."); + Helpers.Log(1, $"{_dcSession.DcID}>Sending {msg.GetType().Name.TrimEnd('_')}"); writer.WriteTLObject(msg); // bytes message_data BinaryPrimitives.WriteInt32LittleEndian(memStream.GetBuffer().AsSpan(20), (int)memStream.Length - 24); // patch message_data_length } @@ -1629,7 +1629,7 @@ namespace WTelegram got503 = true; goto retry; } - else if (code == 401 && message == "SESSION_REVOKED" && !IsMainDC) // need to renegociate alt-DC auth + else if (code == 401 && !IsMainDC && message is "SESSION_REVOKED" or "AUTH_KEY_UNREGISTERED") // need to renegociate alt-DC auth { lock (_session) { diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 906cc13..bda3719 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -17,7 +17,7 @@ Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 Release Notes: -$(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) +$(ReleaseNotes) Copyright © Olivier Marcoux 2021-2025 MIT https://wiz0u.github.io/WTelegramClient @@ -27,7 +27,7 @@ $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "% git Telegram;MTProto;Client;Api;UserBot README.md - $(ReleaseNotes.Replace("|", "%0D%0A").Replace(" - ","%0D%0A- ").Replace(" ", "%0D%0A%0D%0A")) + $(ReleaseNotes) NETSDK1138;CS0419;CS1573;CS1591 TRACE;OBFUSCATION;MTPG From d6fdcab440f3c692724e95e4a85e4e5fdbd118de Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 5 Nov 2025 15:00:48 +0100 Subject: [PATCH 317/336] ToBytes TL.Serialization helper. Warning: do not use for long-term storage because TL structures can change in future layers and may not be deserializable --- generator/MTProtoGenerator.cs | 4 ++-- src/Client.cs | 2 +- src/Encryption.cs | 5 +---- src/TL.cs | 10 ++++++++++ 4 files changed, 14 insertions(+), 7 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index c9e71f0..f326c13 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -181,11 +181,11 @@ public class MTProtoGenerator : IIncrementalGenerator break; case "System.Collections.Generic.Dictionary": readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());"); break; case "System.Collections.Generic.Dictionary": readTL.AppendLine($"r.{member.Name} = reader.ReadTLDictionary();"); - writeTl.AppendLine($"writer.WriteTLVector({member.Name}.Values.ToArray());"); + writeTl.AppendLine($"writer.WriteTLVector({member.Name}?.Values.ToArray());"); break; case "object": readTL.AppendLine($"r.{member.Name} = reader.ReadTLObject();"); diff --git a/src/Client.cs b/src/Client.cs index dc054e0..47644e5 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1125,7 +1125,7 @@ namespace WTelegram { try { - var users = await this.Users_GetUsers(InputUser.Self); // this calls also reenable incoming Updates + var users = await this.Users_GetUsers(InputUser.Self); // this call also reenable incoming Updates var self = users[0] as User; if (self.id == long.Parse(botToken.Split(':')[0])) { diff --git a/src/Encryption.cs b/src/Encryption.cs index 4025d9e..501920b 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -247,10 +247,7 @@ namespace WTelegram var rsaParam = rsa.ExportParameters(false); if (rsaParam.Modulus[0] == 0) rsaParam.Modulus = rsaParam.Modulus[1..]; var publicKey = new RSAPublicKey { n = rsaParam.Modulus, e = rsaParam.Exponent }; - using var memStream = new MemoryStream(280); - using (var writer = new BinaryWriter(memStream)) - writer.WriteTLObject(publicKey); - var bareData = memStream.ToArray(); + var bareData = publicKey.ToBytes(); var fingerprint = BinaryPrimitives.ReadInt64LittleEndian(sha1.ComputeHash(bareData, 4, bareData.Length - 4).AsSpan(12)); // 64 lower-order bits of SHA1 PublicKeys[fingerprint] = publicKey; Helpers.Log(1, $"Loaded a public key with fingerprint {fingerprint:X}"); diff --git a/src/TL.cs b/src/TL.cs index 7c4b65d..b0e2f00 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -1,5 +1,6 @@ using System; using System.Collections.Generic; +using System.ComponentModel; using System.IO; using System.IO.Compression; using System.Linq; @@ -48,6 +49,15 @@ namespace TL public static class Serialization { + [EditorBrowsable(EditorBrowsableState.Never)] + public static byte[] ToBytes(this T obj) where T : IObject + { + using var ms = new MemoryStream(384); + using var writer = new BinaryWriter(ms); + writer.WriteTLObject(obj); + return ms.ToArray(); + } + public static void WriteTLObject(this BinaryWriter writer, T obj) where T : IObject { if (obj == null) { writer.WriteTLNull(typeof(T)); return; } From 30bc536ebc97ab6f7ff06d57be922ac6fb6bb61e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 9 Nov 2025 22:32:47 +0100 Subject: [PATCH 318/336] Removed annoying Peer implicit long operator (reverts #229) --- src/Client.cs | 4 ++-- src/TL.Xtended.cs | 1 - src/TL.cs | 8 ++++---- 3 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/Client.cs b/src/Client.cs index 47644e5..18a9b29 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -589,7 +589,7 @@ namespace WTelegram { var msg = new _Message(reader.ReadInt64(), reader.ReadInt32(), null) { bytes = reader.ReadInt32() }; messages.Add(msg); - if ((msg.seq_no & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); + if ((msg.seqno & 1) != 0) lock (_msgsToAck) _msgsToAck.Add(msg.msg_id); var pos = reader.BaseStream.Position; try { @@ -602,7 +602,7 @@ namespace WTelegram else { var obj = msg.body = reader.ReadTLObject(ctorNb); - Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seq_no & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); + Helpers.Log(1, $" → {obj.GetType().Name,-38} {MsgIdToStamp(msg.msg_id):u} {((msg.seqno & 1) != 0 ? "" : "(svc)")} {((msg.msg_id & 2) == 0 ? "" : "NAR")}"); } } catch (Exception ex) diff --git a/src/TL.Xtended.cs b/src/TL.Xtended.cs index 9811d07..e4ba9ad 100644 --- a/src/TL.Xtended.cs +++ b/src/TL.Xtended.cs @@ -148,7 +148,6 @@ namespace TL { public abstract long ID { get; } protected internal abstract IPeerInfo UserOrChat(Dictionary users, Dictionary chats); - public static implicit operator long(Peer peer) => peer.ID; } partial class PeerUser { diff --git a/src/TL.cs b/src/TL.cs index b0e2f00..135d972 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -218,10 +218,10 @@ namespace TL foreach (var msg in messages) { writer.Write(msg.msg_id); - writer.Write(msg.seq_no); + writer.Write(msg.seqno); var patchPos = writer.BaseStream.Position; writer.Write(0); // patched below - if ((msg.seq_no & 1) != 0) + if ((msg.seqno & 1) != 0) WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38} #{(short)msg.msg_id.GetHashCode():X4}"); else WTelegram.Helpers.Log(1, $" → {msg.body.GetType().Name.TrimEnd('_'),-38}"); @@ -464,10 +464,10 @@ namespace TL } [TLDef(0x5BB8E511)] //message#5bb8e511 msg_id:long seqno:int bytes:int body:Object = Message - public sealed partial class _Message(long msgId, int seqNo, IObject obj) : IObject + public sealed partial class _Message(long msgId, int seqno, IObject obj) : IObject { public long msg_id = msgId; - public int seq_no = seqNo; + public int seqno = seqno; public int bytes; public IObject body = obj; } From 4ad2f0a212f35a0954738b39c5826b506323b603 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Thu, 13 Nov 2025 07:45:57 +0100 Subject: [PATCH 319/336] Fix incorrect bare type for DestroyAuthKey, RpcDropAnswer, DestroySession --- src/TL.MTProto.cs | 22 ++++++++++------------ src/TL.Table.cs | 5 ++++- 2 files changed, 14 insertions(+), 13 deletions(-) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 86d6e90..4b6e052 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -109,15 +109,13 @@ namespace TL public Int128 new_nonce_hash3; } - public enum DestroyAuthKeyRes : uint - { - ///See - Ok = 0xF660E1D4, - ///See - None = 0x0A9F2259, - ///See - Fail = 0xEA109B13, - } + public abstract partial class DestroyAuthKeyRes : IObject { } + [TLDef(0xF660E1D4)] //destroy_auth_key_ok#f660e1d4 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyOk : DestroyAuthKeyRes { } + [TLDef(0x0A9F2259)] //destroy_auth_key_none#0a9f2259 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyNone : DestroyAuthKeyRes { } + [TLDef(0xEA109B13)] //destroy_auth_key_fail#ea109b13 = DestroyAuthKeyRes + public sealed partial class DestroyAuthKeyFail : DestroyAuthKeyRes { } [TLDef(0x62D6B459)] //msgs_ack#62d6b459 msg_ids:Vector = MsgsAck public sealed partial class MsgsAck : IObject @@ -327,12 +325,12 @@ namespace TL }); public static Task DestroyAuthKey(this Client client) - => client.InvokeBare(new DestroyAuthKey + => client.Invoke(new DestroyAuthKey { }); public static Task RpcDropAnswer(this Client client, long req_msg_id) - => client.InvokeBare(new Methods.RpcDropAnswer + => client.Invoke(new Methods.RpcDropAnswer { req_msg_id = req_msg_id, }); @@ -357,7 +355,7 @@ namespace TL }); public static Task DestroySession(this Client client, long session_id) - => client.InvokeBare(new DestroySession + => client.Invoke(new DestroySession { session_id = session_id, }); diff --git a/src/TL.Table.cs b/src/TL.Table.cs index dec7eeb..de3f2d5 100644 --- a/src/TL.Table.cs +++ b/src/TL.Table.cs @@ -41,7 +41,9 @@ namespace TL [0x3BCBF734] = typeof(DhGenOk), [0x46DC1FB9] = typeof(DhGenRetry), [0xA69DAE02] = typeof(DhGenFail), - [0x7ABE77EC] = typeof(Methods.Ping), + [0xF660E1D4] = typeof(DestroyAuthKeyOk), + [0x0A9F2259] = typeof(DestroyAuthKeyNone), + [0xEA109B13] = typeof(DestroyAuthKeyFail), [0x62D6B459] = typeof(MsgsAck), [0xA7EFF811] = typeof(BadMsgNotification), [0xEDAB447B] = typeof(BadServerSalt), @@ -66,6 +68,7 @@ namespace TL [0x37982646] = typeof(IpPortSecret), [0x4679B65F] = typeof(AccessPointRule), [0x5A592A6C] = typeof(Help_ConfigSimple), + [0x7ABE77EC] = typeof(Methods.Ping), // from TL.SchemaExtensions: [0x3FEDD339] = typeof(True), [0xC4B9F9BB] = typeof(Error), From e923d65d535307ad733ced4c45dc82eca4259093 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 18:21:15 +0100 Subject: [PATCH 320/336] Clamp TL stamps to 0..int.MaxValue, mapping edge to DateTime.Min/MaxValueaa --- src/TL.cs | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/TL.cs b/src/TL.cs index 135d972..0bb4583 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -325,13 +325,14 @@ namespace TL } internal static void WriteTLStamp(this BinaryWriter writer, DateTime datetime) - => writer.Write(datetime == DateTime.MaxValue ? int.MaxValue : (int)(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L)); + => writer.Write((int)Math.Min(Math.Max(datetime.ToUniversalTime().Ticks / 10000000 - 62135596800L, 0), int.MaxValue)); - internal static DateTime ReadTLStamp(this BinaryReader reader) + internal static DateTime ReadTLStamp(this BinaryReader reader) => reader.ReadInt32() switch { - int unixstamp = reader.ReadInt32(); - return unixstamp == int.MaxValue ? DateTime.MaxValue : new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc); - } + <= 0 => default, + int.MaxValue => DateTime.MaxValue, + int unixstamp => new((unixstamp + 62135596800L) * 10000000, DateTimeKind.Utc) + }; internal static void WriteTLString(this BinaryWriter writer, string str) { From bfc8e0e1b5f21c34572080479534cb1272262065 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 19:39:10 +0100 Subject: [PATCH 321/336] .NET 10 compatibility --- src/Encryption.cs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/Encryption.cs b/src/Encryption.cs index 501920b..c24845e 100644 --- a/src/Encryption.cs +++ b/src/Encryption.cs @@ -304,8 +304,8 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB var output = new byte[input.Length]; var prevBytes = (byte[])aes_iv.Clone(); var span = MemoryMarshal.Cast(input); - var sout = MemoryMarshal.Cast(output); - var prev = MemoryMarshal.Cast(prevBytes); + var sout = MemoryMarshal.Cast(output.AsSpan()); + var prev = MemoryMarshal.Cast(prevBytes.AsSpan()); if (!encrypt) { (prev[2], prev[0]) = (prev[0], prev[2]); (prev[3], prev[1]) = (prev[1], prev[3]); } for (int i = 0, count = input.Length / 8; i < count;) { @@ -556,7 +556,7 @@ j4WcDuXc2CTHgH8gFTNhp/Y8/SpDOhvn9QIDAQAB { count = count + 15 & ~15; var span = MemoryMarshal.Cast(buffer.AsSpan(offset, count)); - var prev = MemoryMarshal.Cast(_prevBytes); + var prev = MemoryMarshal.Cast(_prevBytes.AsSpan()); for (offset = 0, count /= 8; offset < count;) { prev[0] ^= span[offset]; prev[1] ^= span[offset + 1]; From 208ab626c1a1037275e3f4a5c5594d667df44ee7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 15 Nov 2025 22:45:36 +0100 Subject: [PATCH 322/336] API Layer 218: Stargift auctions, Story Live broadcast, Paid messages in Live/group calls, Message schedule_repeat_period, Saved Music privacy key, and more... --- README.md | 2 +- src/Services.cs | 2 +- src/TL.Schema.cs | 350 +++++++++++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 237 ++++++++++++++++++++++--- src/TL.Table.cs | 55 ++++-- src/WTelegramClient.csproj | 4 +- 6 files changed, 576 insertions(+), 74 deletions(-) diff --git a/README.md b/README.md index 895eedf..85bfbb0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-216-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-218-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/Services.cs b/src/Services.cs index a98c8fe..cac857b 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -56,7 +56,7 @@ namespace TL prevUser.lang_code = user.lang_code; // tdlib: updated if present ; tdesktop: ignored prevUser.emoji_status = user.emoji_status; // tdlib/tdesktop: updated //prevUser.usernames = user.usernames; // tdlib/tdesktop: not updated - if (user.stories_max_id > 0) + if (user.stories_max_id != null) prevUser.stories_max_id = user.stories_max_id; // tdlib: updated if > 0 ; tdesktop: not updated prevUser.color = user.color; // tdlib/tdesktop: updated prevUser.profile_color = user.profile_color; // tdlib/tdesktop: unimplemented yet diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index dc0549c..d5800b5 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -116,9 +116,10 @@ namespace TL /// Object defines a contact from the user's phone book. See Derived classes: public abstract partial class InputContact : IObject { } /// Phone contact. See - [TLDef(0xF392B7F4)] + [TLDef(0x6A1DC4BE)] public sealed partial class InputPhoneContact : InputContact { + public Flags flags; /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; /// Phone number @@ -127,6 +128,13 @@ namespace TL public string first_name; /// Contact's last name public string last_name; + [IfFlag(0)] public TextWithEntities note; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_note = 0x1, + } } /// Defines a file uploaded by the client. See Derived classes: , , @@ -781,7 +789,7 @@ namespace TL public long id; } /// Indicates info about a certain user. See - [TLDef(0x020B1422)] + [TLDef(0x31774388)] public sealed partial class User : UserBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -817,7 +825,7 @@ namespace TL /// Additional usernames.
When updating the
local peer database, apply changes to this field only if:
- The min flag is not set OR
- The min flag is set AND
-- The min flag of the locally cached user entry is set.
Changes to this flag (if the above conditions are respected) should invalidate the local cache for this user ID.
[IfFlag(32)] public Username[] usernames; /// ID of the maximum read story.
When updating the local peer database, do not apply changes to this field if the min flag of the incoming constructor is set.
- [IfFlag(37)] public int stories_max_id; + [IfFlag(37)] public RecentStory stories_max_id; /// The user's accent color. [IfFlag(40)] public PeerColorBase color; /// The user's profile color. @@ -1090,7 +1098,7 @@ namespace TL public override string Title => title; } /// Channel/supergroup info See - [TLDef(0xFE685355)] + [TLDef(0x1C32B11C)] public sealed partial class Channel : ChatBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1122,7 +1130,7 @@ namespace TL /// Additional usernames [IfFlag(32)] public Username[] usernames; /// ID of the maximum read story. - [IfFlag(36)] public int stories_max_id; + [IfFlag(36)] public RecentStory stories_max_id; /// The channel's accent color. [IfFlag(39)] public PeerColorBase color; /// The channel's profile color. @@ -1808,7 +1816,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x9815CEC8)] + [TLDef(0xB92F76CF)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1873,6 +1881,7 @@ namespace TL [IfFlag(38)] public long paid_message_stars; /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; + [IfFlag(42)] public int schedule_repeat_period; [Flags] public enum Flags : uint { @@ -1958,6 +1967,8 @@ namespace TL paid_suggested_post_stars = 0x100, /// Set if this is a suggested channel post » that was paid using Toncoins. paid_suggested_post_ton = 0x200, + /// Field has a value + has_schedule_repeat_period = 0x400, } /// ID of the message @@ -2388,6 +2399,18 @@ namespace TL has_completions = 0x1, } } + /// See + [TLDef(0xCA5CAB89)] + public sealed partial class MessageMediaVideoStream : MessageMedia + { + public Flags flags; + public InputGroupCallBase call; + + [Flags] public enum Flags : uint + { + rtmp_stream = 0x1, + } + } /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty @@ -2702,7 +2725,7 @@ namespace TL public string text; } /// Info about a gifted Telegram Premium subscription See - [TLDef(0x6C6274FA)] + [TLDef(0x48E91302)] public sealed partial class MessageActionGiftPremium : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2711,8 +2734,7 @@ namespace TL public string currency; /// Price of the gift 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 amount; - /// Duration of the gifted Telegram Premium subscription. - public int months; + public int days; /// If the gift was bought using a cryptocurrency, the cryptocurrency name. [IfFlag(0)] public string crypto_currency; /// If the gift was bought using a cryptocurrency, price of the gift in the smallest units of a cryptocurrency. @@ -2809,15 +2831,14 @@ namespace TL } } /// Contains a Telegram Premium giftcode link. See - [TLDef(0x56D03994)] + [TLDef(0x31C48347)] public sealed partial class MessageActionGiftCode : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Identifier of the channel/supergroup that created the gift code either directly or through a giveaway: if we import this giftcode link, we will also automatically boost this channel/supergroup. [IfFlag(1)] public Peer boost_peer; - /// Duration in months of the gifted Telegram Premium subscription. - public int months; + public int days; /// Slug of the Telegram Premium giftcode link public string slug; /// Three-letter ISO 4217 currency code @@ -2967,7 +2988,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0xF24DE7FA)] + [TLDef(0xDB596550)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -2992,6 +3013,7 @@ namespace TL [IfFlag(14)] public string prepaid_upgrade_hash; /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; + [IfFlag(18)] public Peer to_id; [Flags] public enum Flags : uint { @@ -3025,6 +3047,9 @@ namespace TL has_gift_msg_id = 0x8000, /// This service message is the notification of a separate pre-payment for the upgrade of a gift we own. upgrade_separate = 0x10000, + auction_acquired = 0x20000, + /// Field has a value + has_to_id = 0x40000, } } /// A gift » was upgraded to a collectible gift ». See @@ -5490,20 +5515,20 @@ namespace TL public int version; } /// A new groupcall was started See - [TLDef(0x97D64341)] + [TLDef(0x9D2216E0)] public sealed partial class UpdateGroupCall : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The channel/supergroup where this group call or livestream takes place - [IfFlag(0)] public long chat_id; + [IfFlag(1)] public Peer peer; /// Info about the group call or livestream public GroupCallBase call; [Flags] public enum Flags : uint { - /// Field has a value - has_chat_id = 0x1, + /// Field has a value + has_peer = 0x2, + live_story = 0x4, } } /// The Time-To-Live for messages sent by the current user in a specific chat has changed See @@ -6205,13 +6230,11 @@ namespace TL } } /// See - [TLDef(0x78C314E0)] + [TLDef(0xD8326F0D)] public sealed partial class UpdateGroupCallMessage : Update { public InputGroupCallBase call; - public Peer from_id; - public long random_id; - public TextWithEntities message; + public GroupCallMessage message; } /// See [TLDef(0xC957A766)] @@ -6247,6 +6270,27 @@ namespace TL has_order = 0x1, } } + /// See + [TLDef(0x3E85E92C)] + public sealed partial class UpdateDeleteGroupCallMessages : Update + { + public InputGroupCallBase call; + public int[] messages; + } + /// See + [TLDef(0x48E246C2)] + public sealed partial class UpdateStarGiftAuctionState : Update + { + public long gift_id; + public StarGiftAuctionStateBase state; + } + /// See + [TLDef(0xDC58F31E)] + public sealed partial class UpdateStarGiftAuctionUserState : Update + { + public long gift_id; + public StarGiftAuctionUserState user_state; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -7398,6 +7442,8 @@ namespace TL StarGiftsAutoSave = 0xE1732341, ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0xBDC597B4, + ///See + SavedMusic = 0x4DBE9226, } /// Privacy keys together with privacy rules » indicate what can or can't someone do and are specified by a constructor, and its input counterpart . See @@ -7429,6 +7475,8 @@ namespace TL StarGiftsAutoSave = 0x2CA4FDF8, ///Who can send you messages without paying, if paid messages » are enabled. NoPaidMessages = 0x17D348D2, + ///See + SavedMusic = 0xFF7A571B, } /// Privacy rules indicate who can or can't do something and are specified by a , and its input counterpart . See Derived classes: , , , , , , , , , , , @@ -14504,6 +14552,16 @@ namespace TL /// Gifts in the collection. public DocumentBase[] icons; } + /// See + [TLDef(0x034986AB)] + public sealed partial class WebPageAttributeStarGiftAuction : WebPageAttribute + { + public StarGiftBase gift; + public DateTime end_date; + public int center_color; + public int edge_color; + public int text_color; + } /// How users voted in a poll See [TLDef(0x4899484E)] @@ -15273,7 +15331,7 @@ namespace TL public override long AccessHash => access_hash; } /// Info about a group call or livestream See - [TLDef(0x553B0BA1)] + [TLDef(0xEFB2B617)] public sealed partial class GroupCall : GroupCallBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15300,6 +15358,8 @@ namespace TL public int version; /// Invitation link for the conference. [IfFlag(16)] public string invite_link; + [IfFlag(20)] public long send_paid_messages_stars; + [IfFlag(21)] public Peer default_send_as; [Flags] public enum Flags : uint { @@ -15338,6 +15398,10 @@ namespace TL messages_enabled = 0x20000, can_change_messages_enabled = 0x40000, min = 0x80000, + /// Field has a value + has_send_paid_messages_stars = 0x100000, + /// Field has a value + has_default_send_as = 0x200000, } /// Group call ID @@ -15373,7 +15437,7 @@ namespace TL } /// Info about a group call participant See - [TLDef(0xEBA636FE)] + [TLDef(0x2A3DC7AC)] public sealed partial class GroupCallParticipant : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -15396,6 +15460,7 @@ namespace TL [IfFlag(6)] public GroupCallParticipantVideo video; /// Info about the screen sharing stream the participant is currently broadcasting [IfFlag(14)] public GroupCallParticipantVideo presentation; + [IfFlag(16)] public long paid_stars_total; [Flags] public enum Flags : uint { @@ -15431,6 +15496,8 @@ namespace TL has_presentation = 0x4000, /// Whether this participant is currently broadcasting video video_joined = 0x8000, + /// Field has a value + has_paid_stars_total = 0x10000, } } @@ -16553,6 +16620,24 @@ namespace TL { public InputSavedStarGift stargift; } + /// See + [TLDef(0x1ECAFA10)] + public sealed partial class InputInvoiceStarGiftAuctionBid : InputInvoice + { + public Flags flags; + [IfFlag(3)] public InputPeer peer; + public long gift_id; + public long bid_amount; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + hide_name = 0x1, + has_message = 0x2, + update_bid = 0x4, + has_peer = 0x8, + } + } /// Exported invoice deep link See [TLDef(0xAED0CBD9)] @@ -17819,6 +17904,7 @@ namespace TL { /// Whether this story can only be viewed by our close friends, see here » for more info close_friends = 0x100, + live = 0x200, } /// Story ID @@ -18391,7 +18477,7 @@ namespace TL } /// Contains info about a Telegram Premium giftcode link. See - [TLDef(0x284A1096)] + [TLDef(0xEB983F8F)] public sealed partial class Payments_CheckedGiftCode : IObject, IPeerResolver { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -18404,8 +18490,7 @@ namespace TL [IfFlag(0)] public long to_id; /// Creation date of the gift code. public DateTime date; - /// Duration in months of the gifted Telegram Premium subscription. - public int months; + public int days; /// When was the giftcode imported, if it was imported. [IfFlag(1)] public DateTime used_date; /// Mentioned chats @@ -20171,6 +20256,8 @@ namespace TL /// Represents payment for a separate prepaid upgrade of a gift. stargift_prepaid_upgrade = 0x2000000, stargift_drop_original_details = 0x4000000, + phonegroup_message = 0x8000000, + stargift_auction_bid = 0x10000000, } } @@ -20555,7 +20642,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x80AC53C3)] + [TLDef(0x1B9A4D7F)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20592,6 +20679,8 @@ namespace TL [IfFlag(8)] public int per_user_remains; /// If set, the specified gift possibly cannot be sent until the specified date, see here » for the full flow. [IfFlag(9)] public DateTime locked_until_date; + [IfFlag(11)] public string auction_slug; + [IfFlag(11)] public int gifts_per_round; [Flags] public enum Flags : uint { @@ -20616,6 +20705,7 @@ namespace TL /// Field has a value has_locked_until_date = 0x200, peer_color_available = 0x400, + auction = 0x800, } /// Identifier of the gift @@ -21373,6 +21463,7 @@ namespace TL disallow_unique_stargifts = 0x4, /// Disallow the reception of gifted Telegram Premium subscriptions ». disallow_premium_gifts = 0x8, + disallow_stargifts_from_channels = 0x10, } } @@ -21538,13 +21629,13 @@ namespace TL } /// A completed todo list » item. See - [TLDef(0x4CC120B7)] + [TLDef(0x221BB5E4)] public sealed partial class TodoCompletion : IObject { /// The ID of the completed item. public int id; /// ID of the user that completed the item. - public long completed_by; + public Peer completed_by; /// When was the item completed. public DateTime date; } @@ -21824,4 +21915,203 @@ namespace TL public DateTime date; public long upgrade_stars; } + + /// See + [TLDef(0x1A8AFC7E)] + public sealed partial class GroupCallMessage : IObject + { + public Flags flags; + public int id; + public Peer from_id; + public DateTime date; + public TextWithEntities message; + [IfFlag(0)] public long paid_message_stars; + + [Flags] public enum Flags : uint + { + has_paid_message_stars = 0x1, + from_admin = 0x2, + } + } + + /// See + [TLDef(0xEE430C85)] + public sealed partial class GroupCallDonor : IObject + { + public Flags flags; + [IfFlag(3)] public Peer peer_id; + public long stars; + + [Flags] public enum Flags : uint + { + top = 0x1, + my = 0x2, + anonymous = 0x4, + has_peer_id = 0x8, + } + } + + /// See + [TLDef(0x9D1DBD26)] + public sealed partial class Phone_GroupCallStars : IObject, IPeerResolver + { + public long total_stars; + public GroupCallDonor[] top_donors; + public Dictionary chats; + public Dictionary users; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0x711D692D)] + public sealed partial class RecentStory : IObject + { + public Flags flags; + [IfFlag(1)] public int max_id; + + [Flags] public enum Flags : uint + { + live = 0x1, + has_max_id = 0x2, + } + } + + /// See + [TLDef(0x310240CC)] + public sealed partial class AuctionBidLevel : IObject + { + public int pos; + public long amount; + public DateTime date; + } + + /// See + /// a value means starGiftAuctionStateNotModified + public abstract partial class StarGiftAuctionStateBase : IObject + { + public virtual DateTime StartDate => default; + public virtual DateTime EndDate => default; + } + /// See + [TLDef(0x5DB04F4B)] + public sealed partial class StarGiftAuctionState : StarGiftAuctionStateBase + { + public int version; + public DateTime start_date; + public DateTime end_date; + public long min_bid_amount; + public AuctionBidLevel[] bid_levels; + public long[] top_bidders; + public DateTime next_round_at; + public int gifts_left; + public int current_round; + public int total_rounds; + + public override DateTime StartDate => start_date; + public override DateTime EndDate => end_date; + } + /// See + [TLDef(0x7D967C3A)] + public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase + { + public DateTime start_date; + public DateTime end_date; + public long average_price; + + public override DateTime StartDate => start_date; + public override DateTime EndDate => end_date; + } + + /// See + [TLDef(0x2EEED1C4)] + public sealed partial class StarGiftAuctionUserState : IObject + { + public Flags flags; + [IfFlag(0)] public long bid_amount; + [IfFlag(0)] public DateTime bid_date; + [IfFlag(0)] public long min_bid_amount; + [IfFlag(0)] public Peer bid_peer; + public int acquired_count; + + [Flags] public enum Flags : uint + { + has_bid_amount = 0x1, + returned = 0x2, + } + } + + /// See + [TLDef(0x0E98E474)] + public sealed partial class Payments_StarGiftAuctionState : IObject + { + public StarGiftBase gift; + public StarGiftAuctionStateBase state; + public StarGiftAuctionUserState user_state; + public int timeout; + public Dictionary users; + } + + /// See + [TLDef(0xAB60E20B)] + public sealed partial class StarGiftAuctionAcquiredGift : IObject + { + public Flags flags; + public Peer peer; + public DateTime date; + public long bid_amount; + public int round; + public int pos; + [IfFlag(1)] public TextWithEntities message; + + [Flags] public enum Flags : uint + { + name_hidden = 0x1, + has_message = 0x2, + } + } + + /// See + [TLDef(0x7D5BD1F0)] + public sealed partial class Payments_StarGiftAuctionAcquiredGifts : IObject, IPeerResolver + { + public StarGiftAuctionAcquiredGift[] gifts; + public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); + } + + /// See + [TLDef(0xD31BC45D)] + public sealed partial class StarGiftActiveAuctionState : IObject + { + public StarGiftBase gift; + public StarGiftAuctionStateBase state; + public StarGiftAuctionUserState user_state; + } + + /// See + /// a value means payments.starGiftActiveAuctionsNotModified + [TLDef(0x97F187D8)] + public sealed partial class Payments_StarGiftActiveAuctions : IObject + { + public StarGiftActiveAuctionState[] auctions; + public Dictionary users; + } + + /// See + public abstract partial class InputStarGiftAuctionBase : IObject { } + /// See + [TLDef(0x02E16C98)] + public sealed partial class InputStarGiftAuction : InputStarGiftAuctionBase + { + public long gift_id; + } + /// See + [TLDef(0x7AB58308)] + public sealed partial class InputStarGiftAuctionSlug : InputStarGiftAuctionBase + { + public string slug; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 95c6790..9d21f96 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -2009,10 +2009,10 @@ namespace TL /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMessage(this Client client, InputPeer peer, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool no_webpage = false, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMessage { - flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMessage.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (no_webpage ? 0x2 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, message = message, @@ -2020,6 +2020,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, @@ -2048,10 +2049,10 @@ namespace TL /// Specifies a message effect » to use for the message. /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) + public static Task Messages_SendMedia(this Client client, InputPeer peer, InputMedia media, string message, long random_id, InputReplyTo reply_to = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, long? allow_paid_stars = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool clear_draft = false, bool noforwards = false, bool update_stickersets_order = false, bool invert_media = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_SendMedia { - flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_SendMedia.Flags)((reply_to != null ? 0x1 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (suggested_post != null ? 0x400000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (clear_draft ? 0x80 : 0) | (noforwards ? 0x4000 : 0) | (update_stickersets_order ? 0x8000 : 0) | (invert_media ? 0x10000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), peer = peer, reply_to = reply_to, media = media, @@ -2060,6 +2061,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, effect = effect ?? default, @@ -2087,10 +2089,10 @@ namespace TL /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -2098,6 +2100,7 @@ namespace TL top_msg_id = top_msg_id ?? default, reply_to = reply_to, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, video_timestamp = video_timestamp ?? default, @@ -2637,10 +2640,10 @@ namespace TL /// Message entities for styled text /// Scheduled message date for scheduled messages /// If specified, edits a quick reply shortcut message, instead ». - public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) + public static Task Messages_EditMessage(this Client client, InputPeer peer, int id, string message = null, InputMedia media = null, ReplyMarkup reply_markup = null, MessageEntity[] entities = null, DateTime? schedule_date = null, int? schedule_repeat_period = null, int? quick_reply_shortcut_id = null, bool no_webpage = false, bool invert_media = false) => client.Invoke(new Messages_EditMessage { - flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (quick_reply_shortcut_id != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), + flags = (Messages_EditMessage.Flags)((message != null ? 0x800 : 0) | (media != null ? 0x4000 : 0) | (reply_markup != null ? 0x4 : 0) | (entities != null ? 0x8 : 0) | (schedule_date != null ? 0x8000 : 0) | (schedule_repeat_period != null ? 0x40000 : 0) | (quick_reply_shortcut_id != null ? 0x20000 : 0) | (no_webpage ? 0x2 : 0) | (invert_media ? 0x10000 : 0)), peer = peer, id = id, message = message, @@ -2648,6 +2651,7 @@ namespace TL reply_markup = reply_markup, entities = entities, schedule_date = schedule_date ?? default, + schedule_repeat_period = schedule_repeat_period ?? default, quick_reply_shortcut_id = quick_reply_shortcut_id ?? default, }); @@ -5595,10 +5599,10 @@ namespace TL /// Obtains a list of peers that can be used to send messages in a specific group See Possible codes: 400 (details) /// If set, fetches the list of peers that can be used to send paid reactions to messages of a specific peer. /// The group where we intend to send messages - public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false) + public static Task Channels_GetSendAs(this Client client, InputPeer peer, bool for_paid_reactions = false, bool for_live_stories = false) => client.Invoke(new Channels_GetSendAs { - flags = (Channels_GetSendAs.Flags)(for_paid_reactions ? 0x1 : 0), + flags = (Channels_GetSendAs.Flags)((for_paid_reactions ? 0x1 : 0) | (for_live_stories ? 0x2 : 0)), peer = peer, }); @@ -6777,6 +6781,29 @@ namespace TL gift_id = gift_id, }); + /// See + public static Task Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version) + => client.Invoke(new Payments_GetStarGiftAuctionState + { + auction = auction, + version = version, + }); + + /// See + public static Task Payments_GetStarGiftAuctionAcquiredGifts(this Client client, long gift_id) + => client.Invoke(new Payments_GetStarGiftAuctionAcquiredGifts + { + gift_id = gift_id, + }); + + /// See + /// a null value means payments.starGiftActiveAuctionsNotModified + public static Task Payments_GetStarGiftActiveAuctions(this Client client, long hash = default) + => client.Invoke(new Payments_GetStarGiftActiveAuctions + { + hash = hash, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -7082,13 +7109,14 @@ namespace TL /// Invalidate existing invite links /// Group call /// Whether all users will that join this group call are muted by default upon joining the group call - public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, bool reset_invite_hash = false) + public static Task Phone_ToggleGroupCallSettings(this Client client, InputGroupCallBase call, bool? join_muted = default, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool reset_invite_hash = false) => client.Invoke(new Phone_ToggleGroupCallSettings { - flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (reset_invite_hash ? 0x2 : 0)), + flags = (Phone_ToggleGroupCallSettings.Flags)((join_muted != default ? 0x1 : 0) | (messages_enabled != default ? 0x4 : 0) | (send_paid_messages_stars != null ? 0x8 : 0) | (reset_invite_hash ? 0x2 : 0)), call = call, join_muted = join_muted ?? default, messages_enabled = messages_enabled ?? default, + send_paid_messages_stars = send_paid_messages_stars ?? default, }); /// Get info about a group call See Possible codes: 400,403 (details) @@ -7250,9 +7278,10 @@ namespace TL /// Get RTMP URL and stream key for RTMP livestreams. Can be used even before creating the actual RTMP livestream with Phone_CreateGroupCall (the rtmp_stream flag must be set). See Possible codes: 400 (details) /// Peer to livestream into /// Whether to revoke the previous stream key or simply return the existing one - public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke) + public static Task Phone_GetGroupCallStreamRtmpUrl(this Client client, InputPeer peer, bool revoke, bool live_story = false) => client.Invoke(new Phone_GetGroupCallStreamRtmpUrl { + flags = (Phone_GetGroupCallStreamRtmpUrl.Flags)(live_story ? 0x1 : 0), peer = peer, revoke = revoke, }); @@ -7345,12 +7374,15 @@ namespace TL }); /// See - public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message) + public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message, long? allow_paid_stars = null, InputPeer send_as = null) => client.Invoke(new Phone_SendGroupCallMessage { + flags = (Phone_SendGroupCallMessage.Flags)((allow_paid_stars != null ? 0x1 : 0) | (send_as != null ? 0x2 : 0)), call = call, random_id = random_id, message = message, + allow_paid_stars = allow_paid_stars ?? default, + send_as = send_as, }); /// See @@ -7361,6 +7393,39 @@ namespace TL encrypted_message = encrypted_message, }); + /// See + public static Task Phone_DeleteGroupCallMessages(this Client client, InputGroupCallBase call, int[] messages, bool report_spam = false) + => client.Invoke(new Phone_DeleteGroupCallMessages + { + flags = (Phone_DeleteGroupCallMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + messages = messages, + }); + + /// See + public static Task Phone_DeleteGroupCallParticipantMessages(this Client client, InputGroupCallBase call, InputPeer participant, bool report_spam = false) + => client.Invoke(new Phone_DeleteGroupCallParticipantMessages + { + flags = (Phone_DeleteGroupCallParticipantMessages.Flags)(report_spam ? 0x1 : 0), + call = call, + participant = participant, + }); + + /// See + public static Task Phone_GetGroupCallStars(this Client client, InputGroupCallBase call) + => client.Invoke(new Phone_GetGroupCallStars + { + call = call, + }); + + /// See + public static Task Phone_SaveDefaultSendAs(this Client client, InputGroupCallBase call, InputPeer send_as) + => client.Invoke(new Phone_SaveDefaultSendAs + { + call = call, + send_as = send_as, + }); + /// Get localization pack strings See Possible codes: 400 (details) /// Platform identifier (i.e. android, tdesktop, etc). /// Either an ISO 639-1 language code or a language pack name obtained from a language pack link. @@ -7860,7 +7925,7 @@ namespace TL /// Get the IDs of the maximum read stories for a set of peers. See /// Peers - public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) + public static Task Stories_GetPeerMaxIDs(this Client client, params InputPeer[] id) => client.Invoke(new Stories_GetPeerMaxIDs { id = id, @@ -8003,6 +8068,20 @@ namespace TL limit = limit, }); + /// See + public static Task Stories_StartLive(this Client client, InputPeer peer, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool pinned = false, bool noforwards = false, bool rtmp_stream = false) + => client.Invoke(new Stories_StartLive + { + flags = (Stories_StartLive.Flags)((caption != null ? 0x1 : 0) | (entities != null ? 0x2 : 0) | (messages_enabled != default ? 0x40 : 0) | (send_paid_messages_stars != null ? 0x80 : 0) | (pinned ? 0x4 : 0) | (noforwards ? 0x10 : 0) | (rtmp_stream ? 0x20 : 0)), + peer = peer, + caption = caption, + entities = entities, + privacy_rules = privacy_rules, + random_id = random_id, + messages_enabled = messages_enabled ?? default, + send_paid_messages_stars = send_paid_messages_stars ?? default, + }); + /// Obtains info about the boosts that were applied to a certain channel or supergroup (admins only) See Possible codes: 400 (details) /// Whether to return only info about boosts received from gift codes and giveaways created by the channel/supergroup » /// The channel/supergroup @@ -9716,7 +9795,7 @@ namespace TL.Methods } } - [TLDef(0xFE05DC9A)] + [TLDef(0x545CD15A)] public sealed partial class Messages_SendMessage : IMethod { public Flags flags; @@ -9727,6 +9806,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; @@ -9752,10 +9832,11 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0xAC55D9C1)] + [TLDef(0x0330E77F)] public sealed partial class Messages_SendMedia : IMethod { public Flags flags; @@ -9767,6 +9848,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(18)] public long effect; @@ -9791,10 +9873,11 @@ namespace TL.Methods allow_paid_floodskip = 0x80000, has_allow_paid_stars = 0x200000, has_suggested_post = 0x400000, + has_schedule_repeat_period = 0x1000000, } } - [TLDef(0x978928CA)] + [TLDef(0x41D41ADE)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9805,6 +9888,7 @@ namespace TL.Methods [IfFlag(9)] public int top_msg_id; [IfFlag(22)] public InputReplyTo reply_to; [IfFlag(10)] public DateTime schedule_date; + [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; [IfFlag(20)] public int video_timestamp; @@ -9828,6 +9912,7 @@ namespace TL.Methods has_allow_paid_stars = 0x200000, has_reply_to = 0x400000, has_suggested_post = 0x800000, + has_schedule_repeat_period = 0x1000000, } } @@ -10256,7 +10341,7 @@ namespace TL.Methods public int id; } - [TLDef(0xDFD14005)] + [TLDef(0x51E842E1)] public sealed partial class Messages_EditMessage : IMethod { public Flags flags; @@ -10267,6 +10352,7 @@ namespace TL.Methods [IfFlag(2)] public ReplyMarkup reply_markup; [IfFlag(3)] public MessageEntity[] entities; [IfFlag(15)] public DateTime schedule_date; + [IfFlag(18)] public int schedule_repeat_period; [IfFlag(17)] public int quick_reply_shortcut_id; [Flags] public enum Flags : uint @@ -10279,6 +10365,7 @@ namespace TL.Methods has_schedule_date = 0x8000, invert_media = 0x10000, has_quick_reply_shortcut_id = 0x20000, + has_schedule_repeat_period = 0x40000, } } @@ -12752,6 +12839,7 @@ namespace TL.Methods [Flags] public enum Flags : uint { for_paid_reactions = 0x1, + for_live_stories = 0x2, } } @@ -13747,6 +13835,25 @@ namespace TL.Methods public long gift_id; } + [TLDef(0x5C9FF4D6)] + public sealed partial class Payments_GetStarGiftAuctionState : IMethod + { + public InputStarGiftAuctionBase auction; + public int version; + } + + [TLDef(0x6BA2CBEC)] + public sealed partial class Payments_GetStarGiftAuctionAcquiredGifts : IMethod + { + public long gift_id; + } + + [TLDef(0xA5D0514D)] + public sealed partial class Payments_GetStarGiftActiveAuctions : IMethod + { + public long hash; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { @@ -13993,19 +14100,21 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0xE9723804)] + [TLDef(0x974392F2)] public sealed partial class Phone_ToggleGroupCallSettings : IMethod { public Flags flags; public InputGroupCallBase call; [IfFlag(0)] public bool join_muted; [IfFlag(2)] public bool messages_enabled; + [IfFlag(3)] public long send_paid_messages_stars; [Flags] public enum Flags : uint { has_join_muted = 0x1, reset_invite_hash = 0x2, has_messages_enabled = 0x4, + has_send_paid_messages_stars = 0x8, } } @@ -14137,11 +14246,17 @@ namespace TL.Methods public InputGroupCallBase call; } - [TLDef(0xDEB3ABBF)] + [TLDef(0x5AF4C73A)] public sealed partial class Phone_GetGroupCallStreamRtmpUrl : IMethod { + public Flags flags; public InputPeer peer; public bool revoke; + + [Flags] public enum Flags : uint + { + live_story = 0x1, + } } [TLDef(0x41248786)] @@ -14218,12 +14333,21 @@ namespace TL.Methods public int limit; } - [TLDef(0x87893014)] - public sealed partial class Phone_SendGroupCallMessage : IMethod + [TLDef(0xB1D11410)] + public sealed partial class Phone_SendGroupCallMessage : IMethod { + public Flags flags; public InputGroupCallBase call; public long random_id; public TextWithEntities message; + [IfFlag(0)] public long allow_paid_stars; + [IfFlag(1)] public InputPeer send_as; + + [Flags] public enum Flags : uint + { + has_allow_paid_stars = 0x1, + has_send_as = 0x2, + } } [TLDef(0xE5AFA56D)] @@ -14233,6 +14357,45 @@ namespace TL.Methods public byte[] encrypted_message; } + [TLDef(0xF64F54F7)] + public sealed partial class Phone_DeleteGroupCallMessages : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public int[] messages; + + [Flags] public enum Flags : uint + { + report_spam = 0x1, + } + } + + [TLDef(0x1DBFECA0)] + public sealed partial class Phone_DeleteGroupCallParticipantMessages : IMethod + { + public Flags flags; + public InputGroupCallBase call; + public InputPeer participant; + + [Flags] public enum Flags : uint + { + report_spam = 0x1, + } + } + + [TLDef(0x6F636302)] + public sealed partial class Phone_GetGroupCallStars : IMethod + { + public InputGroupCallBase call; + } + + [TLDef(0x4167ADD1)] + public sealed partial class Phone_SaveDefaultSendAs : IMethod + { + public InputGroupCallBase call; + public InputPeer send_as; + } + [TLDef(0xF2F2330A)] public sealed partial class Langpack_GetLangPack : IMethod { @@ -14644,8 +14807,8 @@ namespace TL.Methods [TLDef(0x9B5AE7F9)] public sealed partial class Stories_GetAllReadPeerStories : IMethod { } - [TLDef(0x535983C3)] - public sealed partial class Stories_GetPeerMaxIDs : IMethod + [TLDef(0x78499170)] + public sealed partial class Stories_GetPeerMaxIDs : IMethod { public InputPeer[] id; } @@ -14761,6 +14924,30 @@ namespace TL.Methods public int limit; } + [TLDef(0xD069CCDE)] + public sealed partial class Stories_StartLive : IMethod + { + public Flags flags; + public InputPeer peer; + [IfFlag(0)] public string caption; + [IfFlag(1)] public MessageEntity[] entities; + public InputPrivacyRule[] privacy_rules; + public long random_id; + [IfFlag(6)] public bool messages_enabled; + [IfFlag(7)] public long send_paid_messages_stars; + + [Flags] public enum Flags : uint + { + has_caption = 0x1, + has_entities = 0x2, + pinned = 0x4, + noforwards = 0x10, + rtmp_stream = 0x20, + has_messages_enabled = 0x40, + has_send_paid_messages_stars = 0x80, + } + } + [TLDef(0x60F67660)] public sealed partial class Premium_GetBoostsList : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index de3f2d5..76ac918 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 = 216; // fetched 10/10/2025 20:01:17 + public const int Version = 218; // fetched 11/15/2025 21:06:24 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -84,7 +84,7 @@ namespace TL [0xF7C1B13F] = typeof(InputUserSelf), [0xF21158C6] = typeof(InputUser), [0x1DA448E2] = typeof(InputUserFromMessage), - [0xF392B7F4] = typeof(InputPhoneContact), + [0x6A1DC4BE] = typeof(InputPhoneContact), [0xF52FF27F] = typeof(InputFile), [0xFA4F0BB5] = typeof(InputFileBig), [0x62DC8B48] = typeof(InputFileStoryDocument), @@ -128,7 +128,7 @@ namespace TL [0x36C6019A] = typeof(PeerChat), [0xA2A5371E] = typeof(PeerChannel), [0xD3BC4B7A] = typeof(UserEmpty), - [0x020B1422] = typeof(User), + [0x31774388] = typeof(User), [0x4F11BAE1] = null,//UserProfilePhotoEmpty [0x82D1F706] = typeof(UserProfilePhoto), [0x09D05049] = null,//UserStatusEmpty @@ -140,7 +140,7 @@ namespace TL [0x29562865] = typeof(ChatEmpty), [0x41CBF256] = typeof(Chat), [0x6592A1A7] = typeof(ChatForbidden), - [0xFE685355] = typeof(Channel), + [0x1C32B11C] = typeof(Channel), [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0xE4E0B29D] = typeof(ChannelFull), @@ -152,7 +152,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x9815CEC8] = typeof(Message), + [0xB92F76CF] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -172,6 +172,7 @@ namespace TL [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), [0xA8852491] = typeof(MessageMediaPaidMedia), [0x8A53B014] = typeof(MessageMediaToDo), + [0xCA5CAB89] = typeof(MessageMediaVideoStream), [0xB6AEF7B0] = null,//MessageActionEmpty [0xBD47CBAD] = typeof(MessageActionChatCreate), [0xB5A1CE5A] = typeof(MessageActionChatEditTitle), @@ -204,13 +205,13 @@ namespace TL [0xEBBCA3CB] = typeof(MessageActionChatJoinedByRequest), [0x47DD8079] = typeof(MessageActionWebViewDataSentMe), [0xB4C38CB5] = typeof(MessageActionWebViewDataSent), - [0x6C6274FA] = typeof(MessageActionGiftPremium), + [0x48E91302] = typeof(MessageActionGiftPremium), [0x0D999256] = typeof(MessageActionTopicCreate), [0xC0944820] = typeof(MessageActionTopicEdit), [0x57DE635E] = typeof(MessageActionSuggestProfilePhoto), [0x31518E9B] = typeof(MessageActionRequestedPeer), [0x5060A3F4] = typeof(MessageActionSetChatWallPaper), - [0x56D03994] = typeof(MessageActionGiftCode), + [0x31C48347] = typeof(MessageActionGiftCode), [0xA80F51E4] = typeof(MessageActionGiveawayLaunch), [0x87E2F155] = typeof(MessageActionGiveawayResults), [0xCC02AA6D] = typeof(MessageActionBoostApply), @@ -218,7 +219,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0xF24DE7FA] = typeof(MessageActionStarGift), + [0xDB596550] = typeof(MessageActionStarGift), [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -381,7 +382,7 @@ namespace TL [0x5BB98608] = typeof(UpdatePinnedChannelMessages), [0xF89A6A4E] = typeof(UpdateChat), [0xF2EBDB4E] = typeof(UpdateGroupCallParticipants), - [0x97D64341] = typeof(UpdateGroupCall), + [0x9D2216E0] = typeof(UpdateGroupCall), [0xBB9BB9A5] = typeof(UpdatePeerHistoryTTL), [0xD087663A] = typeof(UpdateChatParticipant), [0x985D3ABB] = typeof(UpdateChannelParticipant), @@ -438,10 +439,13 @@ namespace TL [0x77B0E372] = typeof(UpdateReadMonoForumInbox), [0xA4A79376] = typeof(UpdateReadMonoForumOutbox), [0x9F812B08] = typeof(UpdateMonoForumNoPaidException), - [0x78C314E0] = typeof(UpdateGroupCallMessage), + [0xD8326F0D] = typeof(UpdateGroupCallMessage), [0xC957A766] = typeof(UpdateGroupCallEncryptedMessage), [0x683B2C52] = typeof(UpdatePinnedForumTopic), [0xDEF143D0] = typeof(UpdatePinnedForumTopics), + [0x3E85E92C] = typeof(UpdateDeleteGroupCallMessages), + [0x48E246C2] = typeof(UpdateStarGiftAuctionState), + [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1016,6 +1020,7 @@ namespace TL [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), + [0x034986AB] = typeof(WebPageAttributeStarGiftAuction), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1053,11 +1058,11 @@ namespace TL [0xE8FD8014] = typeof(PeerBlocked), [0x7FE91C14] = typeof(Stats_MessageStats), [0x7780BCB4] = typeof(GroupCallDiscarded), - [0x553B0BA1] = typeof(GroupCall), + [0xEFB2B617] = typeof(GroupCall), [0xD8AA840F] = typeof(InputGroupCall), [0xFE06823F] = typeof(InputGroupCallSlug), [0x8C10603F] = typeof(InputGroupCallInviteMessage), - [0xEBA636FE] = typeof(GroupCallParticipant), + [0x2A3DC7AC] = typeof(GroupCallParticipant), [0x9E727AAD] = typeof(Phone_GroupCall), [0xF47751B6] = typeof(Phone_GroupParticipants), [0x1662AF0B] = typeof(Messages_HistoryImport), @@ -1144,6 +1149,7 @@ namespace TL [0x9A0B48B8] = typeof(InputInvoiceStarGiftPrepaidUpgrade), [0x3E77F614] = typeof(InputInvoicePremiumAuthCode), [0x0923D8D1] = typeof(InputInvoiceStarGiftDropOriginalDetails), + [0x1ECAFA10] = typeof(InputInvoiceStarGiftAuctionBid), [0xAED0CBD9] = typeof(Payments_ExportedInvoice), [0xCFB9D957] = typeof(Messages_TranscribedAudio), [0x5334759C] = typeof(Help_PremiumPromo), @@ -1256,7 +1262,7 @@ namespace TL [0xCAE68768] = typeof(Stories_PeerStories), [0xFD5E12BD] = typeof(Messages_WebPage), [0x257E962B] = typeof(PremiumGiftCodeOption), - [0x284A1096] = typeof(Payments_CheckedGiftCode), + [0xEB983F8F] = typeof(Payments_CheckedGiftCode), [0x4367DAA0] = typeof(Payments_GiveawayInfo), [0xE175E66F] = typeof(Payments_GiveawayInfoResults), [0xB2539D54] = typeof(PrepaidGiveaway), @@ -1378,7 +1384,7 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x80AC53C3] = typeof(StarGift), + [0x1B9A4D7F] = typeof(StarGift), [0xB0BF741B] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), @@ -1435,7 +1441,7 @@ namespace TL [0xE7E82E12] = typeof(PendingSuggestion), [0xCBA9A52F] = typeof(TodoItem), [0x49B92A26] = typeof(TodoList), - [0x4CC120B7] = typeof(TodoCompletion), + [0x221BB5E4] = typeof(TodoCompletion), [0x0E8E37E5] = typeof(SuggestedPost), [0x1B0E4F07] = typeof(StarsRating), [0x9D6B13B0] = typeof(StarGiftCollection), @@ -1456,6 +1462,23 @@ namespace TL [0xC93DE95C] = typeof(InputChatTheme), [0x87E5DFE4] = typeof(InputChatThemeUniqueGift), [0x99EA331D] = typeof(StarGiftUpgradePrice), + [0x1A8AFC7E] = typeof(GroupCallMessage), + [0xEE430C85] = typeof(GroupCallDonor), + [0x9D1DBD26] = typeof(Phone_GroupCallStars), + [0x711D692D] = typeof(RecentStory), + [0x310240CC] = typeof(AuctionBidLevel), + [0xFE333952] = null,//StarGiftAuctionStateNotModified + [0x5DB04F4B] = typeof(StarGiftAuctionState), + [0x7D967C3A] = typeof(StarGiftAuctionStateFinished), + [0x2EEED1C4] = typeof(StarGiftAuctionUserState), + [0x0E98E474] = typeof(Payments_StarGiftAuctionState), + [0xAB60E20B] = typeof(StarGiftAuctionAcquiredGift), + [0x7D5BD1F0] = typeof(Payments_StarGiftAuctionAcquiredGifts), + [0xD31BC45D] = typeof(StarGiftActiveAuctionState), + [0xDB33DAD0] = null,//Payments_StarGiftActiveAuctionsNotModified + [0x97F187D8] = typeof(Payments_StarGiftActiveAuctions), + [0x02E16C98] = typeof(InputStarGiftAuction), + [0x7AB58308] = typeof(InputStarGiftAuctionSlug), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), @@ -1594,6 +1617,8 @@ namespace TL [typeof(Stories_Albums)] = 0x564EDAEB, //stories.albumsNotModified [typeof(Account_SavedMusicIds)] = 0x4FC81D6E, //account.savedMusicIdsNotModified [typeof(InputChatThemeBase)] = 0x83268483, //inputChatThemeEmpty + [typeof(StarGiftAuctionStateBase)] = 0xFE333952, //starGiftAuctionStateNotModified + [typeof(Payments_StarGiftActiveAuctions)]= 0xDB33DAD0, //payments.starGiftActiveAuctionsNotModified [typeof(DecryptedMessageMedia)] = 0x089F5C4A, //decryptedMessageMediaEmpty }; } diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index bda3719..c043406 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.216 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 216 + layer.218 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 218 Release Notes: $(ReleaseNotes) From d3ad4789a1739b4fff6a588033eea0ca9a2ba76c Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 5 Dec 2025 06:53:54 +0100 Subject: [PATCH 323/336] WTelegram.Helpers.JsonOptions can now serialize polymorph TL types (useful for logs). Deserialization is also possible in non-trimmed apps, but not recommended as structures can change. --- src/Helpers.cs | 82 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 81 insertions(+), 1 deletion(-) diff --git a/src/Helpers.cs b/src/Helpers.cs index d483cb6..ea7d0b5 100644 --- a/src/Helpers.cs +++ b/src/Helpers.cs @@ -27,8 +27,88 @@ namespace WTelegram public static readonly JsonSerializerOptions JsonOptions = new() { IncludeFields = true, WriteIndented = true, #if NET8_0_OR_GREATER TypeInfoResolver = JsonSerializer.IsReflectionEnabledByDefault ? null : WTelegramContext.Default, + Converters = { new TLJsonConverter(), new JsonStringEnumConverter() }, +#endif + IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingDefault }; + +#if NET8_0_OR_GREATER + public sealed class TLJsonConverter : JsonConverter + { + public override bool CanConvert(Type typeToConvert) + => typeToConvert.IsAbstract || typeToConvert == typeof(Dictionary) || typeToConvert == typeof(Dictionary); + public override object Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + if (typeToConvert == typeof(Dictionary)) + { + if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Expected array for users dictionary"); + var users = new Dictionary(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + { + var user = JsonSerializer.Deserialize(ref reader, options); + if (user != null) users[user.id] = user; + } + return users; + } + else if (typeToConvert == typeof(Dictionary)) + { + if (reader.TokenType != JsonTokenType.StartArray) throw new JsonException("Expected array for chats dictionary"); + var chats = new Dictionary(); + while (reader.Read() && reader.TokenType != JsonTokenType.EndArray) + { + var chat = (TL.ChatBase)Read(ref reader, typeof(TL.ChatBase), options); + if (chat != null) chats[chat.ID] = chat; + } + return chats; + } + else if (reader.TokenType == JsonTokenType.Null) + return null; + else if (reader.TokenType == JsonTokenType.StartObject) + { + var typeReader = reader; + if (!typeReader.Read() || typeReader.TokenType != JsonTokenType.PropertyName || typeReader.GetString() != "$") + throw new JsonException("Expected $ type property"); + if (!typeReader.Read() || typeReader.TokenType != JsonTokenType.String) + throw new JsonException("Invalid $ type property"); + var type = typeReader.GetString(); + var actualType = typeToConvert.Assembly.GetType("TL." + type); + if (!typeToConvert.IsAssignableFrom(actualType)) + throw new JsonException($"Incompatible $ type: {type} -> {typeToConvert}"); + return JsonSerializer.Deserialize(ref reader, actualType, options); + } + throw new JsonException($"Unexpected token type: {reader.TokenType}"); + } + public override void Write(Utf8JsonWriter writer, object value, JsonSerializerOptions options) + { + if (value is Dictionary users) + { + writer.WriteStartArray(); + foreach (var element in users.Values) + JsonSerializer.Serialize(writer, element, options); + writer.WriteEndArray(); + } + else if (value is Dictionary chats) + { + writer.WriteStartArray(); + foreach (var element in chats.Values) + Write(writer, element, options); + writer.WriteEndArray(); + } + else if (value is null) + writer.WriteNullValue(); + else + { + var actualType = value.GetType(); + var jsonObject = JsonSerializer.SerializeToElement(value, actualType, options); + writer.WriteStartObject(); + writer.WriteString("$", actualType.Name); + foreach (var property in jsonObject.EnumerateObject()) + if (char.IsLower(property.Name[0])) + property.WriteTo(writer); + writer.WriteEndObject(); + } + } + } #endif - IgnoreReadOnlyProperties = true, DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull }; private static readonly ConsoleColor[] LogLevelToColor = [ ConsoleColor.DarkGray, ConsoleColor.DarkCyan, ConsoleColor.Cyan, ConsoleColor.Yellow, ConsoleColor.Red, ConsoleColor.Magenta, ConsoleColor.DarkBlue ]; From 9c839128bbafa472e17782d1b18de7323bcbcdc1 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sun, 14 Dec 2025 20:24:02 +0100 Subject: [PATCH 324/336] Update to Telegram API Layer 220 - Added support for passkey-based authentication with new classes (`Passkey`, `Account_Passkeys`, etc.) and methods (`Auth_InitPasskeyLogin`, `Account_RegisterPasskey`, etc.). - Added new methods for handling star gift offers and upgrades (`Payments_ResolveStarGiftOffer`, `Payments_SendStarGiftOffer`, etc.). - Enhanced star gift functionality with new fields (`gift_num`, `upgrade_variants`, etc.), flags, and classes (`MessageActionStarGiftPurchaseOffer`, `StarGiftBackground`, etc.). - Updated `Messages_ForwardMessages` to include a new `effect` parameter. --- README.md | 2 +- src/TL.Schema.cs | 198 +++++++++++++++++++++++++++++++++---- src/TL.SchemaFuncs.cs | 155 ++++++++++++++++++++++++++++- src/TL.Table.cs | 35 ++++--- src/WTelegramClient.csproj | 4 +- 5 files changed, 360 insertions(+), 34 deletions(-) diff --git a/README.md b/README.md index 85bfbb0..3edbec0 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-218-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-220-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 d5800b5..8d88c61 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2988,7 +2988,7 @@ namespace TL } } /// You received a gift, see here » for more info. See - [TLDef(0xDB596550)] + [TLDef(0xEA2C31D3)] public sealed partial class MessageActionStarGift : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3014,6 +3014,7 @@ namespace TL /// For separate upgrades, the identifier of the message with the gift whose upgrade was prepaid (only valid for the receiver of the service message). [IfFlag(15)] public int gift_msg_id; [IfFlag(18)] public Peer to_id; + [IfFlag(19)] public int gift_num; [Flags] public enum Flags : uint { @@ -3050,6 +3051,8 @@ namespace TL auction_acquired = 0x20000, /// Field has a value has_to_id = 0x40000, + /// Field has a value + has_gift_num = 0x80000, } } /// A gift » was upgraded to a collectible gift ». See @@ -3107,6 +3110,7 @@ namespace TL /// Field has a value has_drop_original_details_stars = 0x1000, assigned = 0x2000, + from_offer = 0x4000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3252,6 +3256,34 @@ namespace TL { public Birthday birthday; } + /// See + [TLDef(0x774278D4)] + public sealed partial class MessageActionStarGiftPurchaseOffer : MessageAction + { + public Flags flags; + public StarGiftBase gift; + public StarsAmountBase price; + public DateTime expires_at; + + [Flags] public enum Flags : uint + { + accepted = 0x1, + declined = 0x2, + } + } + /// See + [TLDef(0x73ADA76B)] + public sealed partial class MessageActionStarGiftPurchaseOfferDeclined : MessageAction + { + public Flags flags; + public StarGiftBase gift; + public StarsAmountBase price; + + [Flags] public enum Flags : uint + { + expired = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -14553,14 +14585,11 @@ namespace TL public DocumentBase[] icons; } /// See - [TLDef(0x034986AB)] + [TLDef(0x01C641C2)] public sealed partial class WebPageAttributeStarGiftAuction : WebPageAttribute { public StarGiftBase gift; public DateTime end_date; - public int center_color; - public int edge_color; - public int text_color; } /// How users voted in a poll See @@ -20258,6 +20287,7 @@ namespace TL stargift_drop_original_details = 0x4000000, phonegroup_message = 0x8000000, stargift_auction_bid = 0x10000000, + offer = 0x20000000, } } @@ -20642,7 +20672,7 @@ namespace TL public virtual Peer ReleasedBy => default; } /// Represents a star gift, see here » for more info. See - [TLDef(0x1B9A4D7F)] + [TLDef(0x313A9547)] public sealed partial class StarGift : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20681,6 +20711,9 @@ namespace TL [IfFlag(9)] public DateTime locked_until_date; [IfFlag(11)] public string auction_slug; [IfFlag(11)] public int gifts_per_round; + [IfFlag(11)] public DateTime auction_start_date; + [IfFlag(12)] public int upgrade_variants; + [IfFlag(13)] public StarGiftBackground background; [Flags] public enum Flags : uint { @@ -20706,6 +20739,10 @@ namespace TL has_locked_until_date = 0x200, peer_color_available = 0x400, auction = 0x800, + /// Field has a value + has_upgrade_variants = 0x1000, + /// Field has a value + has_background = 0x2000, } /// Identifier of the gift @@ -20718,7 +20755,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0xB0BF741B)] + [TLDef(0x569D64C9)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20755,10 +20792,12 @@ namespace TL [IfFlag(8)] public long value_amount; /// Currency for the gift's price. [IfFlag(8)] public string value_currency; + [IfFlag(8)] public long value_usd_amount; /// The current chat where the associated chat theme is installed, if any (gift-based themes can only be installed in one chat at a time). [IfFlag(10)] public Peer theme_peer; [IfFlag(11)] public PeerColorBase peer_color; [IfFlag(12)] public Peer host_id; + [IfFlag(13)] public int offer_min_stars; [Flags] public enum Flags : uint { @@ -20778,7 +20817,7 @@ namespace TL require_premium = 0x40, /// Whether the gift can be bought only using Toncoins. resale_ton_only = 0x80, - /// Fields and have a value + /// Fields , and have a value has_value_amount = 0x100, /// A chat theme associated to this gift is available, see here » for more info on how to use it. theme_available = 0x200, @@ -20788,6 +20827,8 @@ namespace TL has_peer_color = 0x800, /// Field has a value has_host_id = 0x1000, + /// Field has a value + has_offer_min_stars = 0x2000, } /// Identifier of the collectible gift. @@ -21228,7 +21269,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0x8983A452)] + [TLDef(0xEAD6805E)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21262,6 +21303,7 @@ namespace TL /// Hash to prepay for a gift upgrade separately ». [IfFlag(16)] public string prepaid_upgrade_hash; [IfFlag(18)] public long drop_original_details_stars; + [IfFlag(19)] public int gift_num; [Flags] public enum Flags : uint { @@ -21303,6 +21345,8 @@ namespace TL upgrade_separate = 0x20000, /// Field has a value has_drop_original_details_stars = 0x40000, + /// Field has a value + has_gift_num = 0x80000, } } @@ -21946,7 +21990,6 @@ namespace TL { top = 0x1, my = 0x2, - anonymous = 0x4, has_peer_id = 0x8, } } @@ -21994,7 +22037,7 @@ namespace TL public virtual DateTime EndDate => default; } /// See - [TLDef(0x5DB04F4B)] + [TLDef(0x771A4E66)] public sealed partial class StarGiftAuctionState : StarGiftAuctionStateBase { public int version; @@ -22004,20 +22047,32 @@ namespace TL public AuctionBidLevel[] bid_levels; public long[] top_bidders; public DateTime next_round_at; + public int last_gift_num; public int gifts_left; public int current_round; public int total_rounds; + public StarGiftAuctionRound[] rounds; public override DateTime StartDate => start_date; public override DateTime EndDate => end_date; } /// See - [TLDef(0x7D967C3A)] + [TLDef(0x972DABBF)] public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase { + public Flags flags; public DateTime start_date; public DateTime end_date; public long average_price; + [IfFlag(0)] public int listed_count; + [IfFlag(1)] public int fragment_listed_count; + [IfFlag(1)] public string fragment_listed_url; + + [Flags] public enum Flags : uint + { + has_listed_count = 0x1, + has_fragment_listed_count = 0x2, + } public override DateTime StartDate => start_date; public override DateTime EndDate => end_date; @@ -22042,18 +22097,21 @@ namespace TL } /// See - [TLDef(0x0E98E474)] - public sealed partial class Payments_StarGiftAuctionState : IObject + [TLDef(0x6B39F4EC)] + public sealed partial class Payments_StarGiftAuctionState : IObject, IPeerResolver { public StarGiftBase gift; public StarGiftAuctionStateBase state; public StarGiftAuctionUserState user_state; public int timeout; public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See - [TLDef(0xAB60E20B)] + [TLDef(0x42B00348)] public sealed partial class StarGiftAuctionAcquiredGift : IObject { public Flags flags; @@ -22063,11 +22121,13 @@ namespace TL public int round; public int pos; [IfFlag(1)] public TextWithEntities message; + [IfFlag(2)] public int gift_num; [Flags] public enum Flags : uint { name_hidden = 0x1, has_message = 0x2, + has_gift_num = 0x4, } } @@ -22093,11 +22153,14 @@ namespace TL /// See /// a value means payments.starGiftActiveAuctionsNotModified - [TLDef(0x97F187D8)] - public sealed partial class Payments_StarGiftActiveAuctions : IObject + [TLDef(0xAEF6ABBC)] + public sealed partial class Payments_StarGiftActiveAuctions : IObject, IPeerResolver { public StarGiftActiveAuctionState[] auctions; public Dictionary users; + public Dictionary chats; + /// returns a or for the given Peer + public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } /// See @@ -22114,4 +22177,105 @@ namespace TL { public string slug; } + + /// See + [TLDef(0x98613EBF)] + public sealed partial class Passkey : IObject + { + public Flags flags; + public string id; + public string name; + public DateTime date; + [IfFlag(0)] public long software_emoji_id; + [IfFlag(1)] public DateTime last_usage_date; + + [Flags] public enum Flags : uint + { + has_software_emoji_id = 0x1, + has_last_usage_date = 0x2, + } + } + + /// See + [TLDef(0xF8E0AA1C)] + public sealed partial class Account_Passkeys : IObject + { + public Passkey[] passkeys; + } + + /// See + [TLDef(0xE16B5CE1)] + public sealed partial class Account_PasskeyRegistrationOptions : IObject + { + public DataJSON options; + } + + /// See + [TLDef(0xE2037789)] + public sealed partial class Auth_PasskeyLoginOptions : IObject + { + public DataJSON options; + } + + /// See + public abstract partial class InputPasskeyResponse : IObject + { + public DataJSON client_data; + } + /// See + [TLDef(0x3E63935C, inheritBefore = true)] + public sealed partial class InputPasskeyResponseRegister : InputPasskeyResponse + { + public byte[] attestation_data; + } + /// See + [TLDef(0xC31FC14A, inheritBefore = true)] + public sealed partial class InputPasskeyResponseLogin : InputPasskeyResponse + { + public byte[] authenticator_data; + public byte[] signature; + public string user_handle; + } + + /// See + public abstract partial class InputPasskeyCredential : IObject { } + /// See + [TLDef(0x3C27B78F)] + public sealed partial class InputPasskeyCredentialPublicKey : InputPasskeyCredential + { + public string id; + public string raw_id; + public InputPasskeyResponse response; + } + + /// See + [TLDef(0xAFF56398)] + public sealed partial class StarGiftBackground : IObject + { + public int center_color; + public int edge_color; + public int text_color; + } + + /// See + [TLDef(0x3AAE0528)] + public partial class StarGiftAuctionRound : IObject + { + public int num; + public int duration; + } + /// See + [TLDef(0x0AA021E5, inheritBefore = true)] + public sealed partial class StarGiftAuctionRoundExtendable : StarGiftAuctionRound + { + public int extend_top; + public int extend_window; + } + + /// See + [TLDef(0x46C6E36F)] + public sealed partial class Payments_StarGiftUpgradeAttributes : IObject + { + public StarGiftAttribute[] attributes; + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 9d21f96..5e2cdbc 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -396,6 +396,24 @@ namespace TL form_id = form_id, }); + /// See + public static Task Auth_InitPasskeyLogin(this Client client, int api_id, string api_hash) + => client.Invoke(new Auth_InitPasskeyLogin + { + api_id = api_id, + api_hash = api_hash, + }); + + /// See + public static Task Auth_FinishPasskeyLogin(this Client client, InputPasskeyCredential credential, int? from_dc_id = null, long? from_auth_key_id = null) + => client.Invoke(new Auth_FinishPasskeyLogin + { + flags = (Auth_FinishPasskeyLogin.Flags)((from_dc_id != null ? 0x1 : 0) | (from_auth_key_id != null ? 0x1 : 0)), + credential = credential, + from_dc_id = from_dc_id ?? default, + from_auth_key_id = from_auth_key_id ?? default, + }); + /// Register device to receive PUSH notifications See Possible codes: 400 (details) /// Avoid receiving (silent and invisible background) notifications. Useful to save battery. /// Device token type, see PUSH updates for the possible values. @@ -1510,6 +1528,32 @@ namespace TL hash = hash, }); + /// See + public static Task Account_InitPasskeyRegistration(this Client client) + => client.Invoke(new Account_InitPasskeyRegistration + { + }); + + /// See + public static Task Account_RegisterPasskey(this Client client, InputPasskeyCredential credential) + => client.Invoke(new Account_RegisterPasskey + { + credential = credential, + }); + + /// See + public static Task Account_GetPasskeys(this Client client) + => client.Invoke(new Account_GetPasskeys + { + }); + + /// See + public static Task Account_DeletePasskey(this Client client, string id) + => client.Invoke(new Account_DeletePasskey + { + id = id, + }); + /// Returns basic user info according to their identifiers. See [bots: ✓] Possible codes: 400 (details) /// List of user identifiers public static Task Users_GetUsers(this Client client, params InputUserBase[] id) @@ -2089,10 +2133,10 @@ namespace TL /// Start playing the video at the specified timestamp (seconds). /// For paid messages », specifies the amount of Telegram Stars the user has agreed to pay in order to send the message. /// Used to suggest a post to a channel, see here » for more info on the full flow. - public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) + public static Task Messages_ForwardMessages(this Client client, InputPeer from_peer, int[] id, long[] random_id, InputPeer to_peer, int? top_msg_id = null, DateTime? schedule_date = null, InputPeer send_as = null, InputQuickReplyShortcutBase quick_reply_shortcut = null, long? effect = null, int? video_timestamp = null, long? allow_paid_stars = null, InputReplyTo reply_to = null, SuggestedPost suggested_post = null, int? schedule_repeat_period = null, bool silent = false, bool background = false, bool with_my_score = false, bool drop_author = false, bool drop_media_captions = false, bool noforwards = false, bool allow_paid_floodskip = false) => client.Invoke(new Messages_ForwardMessages { - flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), + flags = (Messages_ForwardMessages.Flags)((top_msg_id != null ? 0x200 : 0) | (schedule_date != null ? 0x400 : 0) | (send_as != null ? 0x2000 : 0) | (quick_reply_shortcut != null ? 0x20000 : 0) | (effect != null ? 0x40000 : 0) | (video_timestamp != null ? 0x100000 : 0) | (allow_paid_stars != null ? 0x200000 : 0) | (reply_to != null ? 0x400000 : 0) | (suggested_post != null ? 0x800000 : 0) | (schedule_repeat_period != null ? 0x1000000 : 0) | (silent ? 0x20 : 0) | (background ? 0x40 : 0) | (with_my_score ? 0x100 : 0) | (drop_author ? 0x800 : 0) | (drop_media_captions ? 0x1000 : 0) | (noforwards ? 0x4000 : 0) | (allow_paid_floodskip ? 0x80000 : 0)), from_peer = from_peer, id = id, random_id = random_id, @@ -2103,6 +2147,7 @@ namespace TL schedule_repeat_period = schedule_repeat_period ?? default, send_as = send_as, quick_reply_shortcut = quick_reply_shortcut, + effect = effect ?? default, video_timestamp = video_timestamp ?? default, allow_paid_stars = allow_paid_stars ?? default, suggested_post = suggested_post, @@ -6804,6 +6849,34 @@ namespace TL hash = hash, }); + /// See + public static Task Payments_ResolveStarGiftOffer(this Client client, int offer_msg_id, bool decline = false) + => client.Invoke(new Payments_ResolveStarGiftOffer + { + flags = (Payments_ResolveStarGiftOffer.Flags)(decline ? 0x1 : 0), + offer_msg_id = offer_msg_id, + }); + + /// See + public static Task Payments_SendStarGiftOffer(this Client client, InputPeer peer, string slug, StarsAmountBase price, int duration, long random_id, long? allow_paid_stars = null) + => client.Invoke(new Payments_SendStarGiftOffer + { + flags = (Payments_SendStarGiftOffer.Flags)(allow_paid_stars != null ? 0x1 : 0), + peer = peer, + slug = slug, + price = price, + duration = duration, + random_id = random_id, + allow_paid_stars = allow_paid_stars ?? default, + }); + + /// See + public static Task Payments_GetStarGiftUpgradeAttributes(this Client client, long gift_id) + => client.Invoke(new Payments_GetStarGiftUpgradeAttributes + { + gift_id = gift_id, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -8489,6 +8562,27 @@ namespace TL.Methods public long form_id; } + [TLDef(0x518AD0B7)] + public sealed partial class Auth_InitPasskeyLogin : IMethod + { + public int api_id; + public string api_hash; + } + + [TLDef(0x9857AD07)] + public sealed partial class Auth_FinishPasskeyLogin : IMethod + { + public Flags flags; + public InputPasskeyCredential credential; + [IfFlag(0)] public int from_dc_id; + [IfFlag(0)] public long from_auth_key_id; + + [Flags] public enum Flags : uint + { + has_from_dc_id = 0x1, + } + } + [TLDef(0xEC86017A)] public sealed partial class Account_RegisterDevice : IMethod { @@ -9392,6 +9486,24 @@ namespace TL.Methods public long hash; } + [TLDef(0x429547E8)] + public sealed partial class Account_InitPasskeyRegistration : IMethod { } + + [TLDef(0x55B41FD6)] + public sealed partial class Account_RegisterPasskey : IMethod + { + public InputPasskeyCredential credential; + } + + [TLDef(0xEA1F0C52)] + public sealed partial class Account_GetPasskeys : IMethod { } + + [TLDef(0xF5B5563F)] + public sealed partial class Account_DeletePasskey : IMethod + { + public string id; + } + [TLDef(0x0D91A548)] public sealed partial class Users_GetUsers : IMethod { @@ -9877,7 +9989,7 @@ namespace TL.Methods } } - [TLDef(0x41D41ADE)] + [TLDef(0x13704A7C)] public sealed partial class Messages_ForwardMessages : IMethod { public Flags flags; @@ -9891,6 +10003,7 @@ namespace TL.Methods [IfFlag(24)] public int schedule_repeat_period; [IfFlag(13)] public InputPeer send_as; [IfFlag(17)] public InputQuickReplyShortcutBase quick_reply_shortcut; + [IfFlag(18)] public long effect; [IfFlag(20)] public int video_timestamp; [IfFlag(21)] public long allow_paid_stars; [IfFlag(23)] public SuggestedPost suggested_post; @@ -9907,6 +10020,7 @@ namespace TL.Methods has_send_as = 0x2000, noforwards = 0x4000, has_quick_reply_shortcut = 0x20000, + has_effect = 0x40000, allow_paid_floodskip = 0x80000, has_video_timestamp = 0x100000, has_allow_paid_stars = 0x200000, @@ -13854,6 +13968,41 @@ namespace TL.Methods public long hash; } + [TLDef(0xE9CE781C)] + public sealed partial class Payments_ResolveStarGiftOffer : IMethod + { + public Flags flags; + public int offer_msg_id; + + [Flags] public enum Flags : uint + { + decline = 0x1, + } + } + + [TLDef(0x8FB86B41)] + public sealed partial class Payments_SendStarGiftOffer : IMethod + { + public Flags flags; + public InputPeer peer; + public string slug; + public StarsAmountBase price; + public int duration; + public long random_id; + [IfFlag(0)] public long allow_paid_stars; + + [Flags] public enum Flags : uint + { + has_allow_paid_stars = 0x1, + } + } + + [TLDef(0x6D038B58)] + public sealed partial class Payments_GetStarGiftUpgradeAttributes : IMethod + { + public long gift_id; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 76ac918..7e253c3 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 = 218; // fetched 11/15/2025 21:06:24 + public const int Version = 220; // fetched 12/06/2025 13:11:05 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -219,7 +219,7 @@ namespace TL [0x41B3E202] = typeof(MessageActionPaymentRefunded), [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), - [0xDB596550] = typeof(MessageActionStarGift), + [0xEA2C31D3] = typeof(MessageActionStarGift), [0x95728543] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), @@ -231,6 +231,8 @@ namespace TL [0x69F916F8] = typeof(MessageActionSuggestedPostRefund), [0xA8A3C699] = typeof(MessageActionGiftTon), [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), + [0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer), + [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -1020,7 +1022,7 @@ namespace TL [0x50CC03D3] = typeof(WebPageAttributeStickerSet), [0xCF6F6DB8] = typeof(WebPageAttributeUniqueStarGift), [0x31CAD303] = typeof(WebPageAttributeStarGiftCollection), - [0x034986AB] = typeof(WebPageAttributeStarGiftAuction), + [0x01C641C2] = typeof(WebPageAttributeStarGiftAuction), [0x4899484E] = typeof(Messages_VotesList), [0xF568028A] = typeof(BankCardOpenUrl), [0x3E24E573] = typeof(Payments_BankCardData), @@ -1384,8 +1386,8 @@ namespace TL [0x4BA3A95A] = typeof(MessageReactor), [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), - [0x1B9A4D7F] = typeof(StarGift), - [0xB0BF741B] = typeof(StarGiftUnique), + [0x313A9547] = typeof(StarGift), + [0x569D64C9] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1414,7 +1416,7 @@ namespace TL [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0x8983A452] = typeof(SavedStarGift), + [0xEAD6805E] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1468,17 +1470,28 @@ namespace TL [0x711D692D] = typeof(RecentStory), [0x310240CC] = typeof(AuctionBidLevel), [0xFE333952] = null,//StarGiftAuctionStateNotModified - [0x5DB04F4B] = typeof(StarGiftAuctionState), - [0x7D967C3A] = typeof(StarGiftAuctionStateFinished), + [0x771A4E66] = typeof(StarGiftAuctionState), + [0x972DABBF] = typeof(StarGiftAuctionStateFinished), [0x2EEED1C4] = typeof(StarGiftAuctionUserState), - [0x0E98E474] = typeof(Payments_StarGiftAuctionState), - [0xAB60E20B] = typeof(StarGiftAuctionAcquiredGift), + [0x6B39F4EC] = typeof(Payments_StarGiftAuctionState), + [0x42B00348] = typeof(StarGiftAuctionAcquiredGift), [0x7D5BD1F0] = typeof(Payments_StarGiftAuctionAcquiredGifts), [0xD31BC45D] = typeof(StarGiftActiveAuctionState), [0xDB33DAD0] = null,//Payments_StarGiftActiveAuctionsNotModified - [0x97F187D8] = typeof(Payments_StarGiftActiveAuctions), + [0xAEF6ABBC] = typeof(Payments_StarGiftActiveAuctions), [0x02E16C98] = typeof(InputStarGiftAuction), [0x7AB58308] = typeof(InputStarGiftAuctionSlug), + [0x98613EBF] = typeof(Passkey), + [0xF8E0AA1C] = typeof(Account_Passkeys), + [0xE16B5CE1] = typeof(Account_PasskeyRegistrationOptions), + [0xE2037789] = typeof(Auth_PasskeyLoginOptions), + [0x3E63935C] = typeof(InputPasskeyResponseRegister), + [0xC31FC14A] = typeof(InputPasskeyResponseLogin), + [0x3C27B78F] = typeof(InputPasskeyCredentialPublicKey), + [0xAFF56398] = typeof(StarGiftBackground), + [0x3AAE0528] = typeof(StarGiftAuctionRound), + [0x0AA021E5] = typeof(StarGiftAuctionRoundExtendable), + [0x46C6E36F] = typeof(Payments_StarGiftUpgradeAttributes), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index c043406..8eaa0c5 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.218 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 218 + layer.220 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 220 Release Notes: $(ReleaseNotes) From 1912632722f01be5a91afaba7cb4da8025a3613e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 22 Dec 2025 02:34:29 +0100 Subject: [PATCH 325/336] Immediate remigrate to MainDC in case reconnection is only possible through a different DcID --- src/Client.cs | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/Client.cs b/src/Client.cs index 18a9b29..ce16017 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -871,6 +871,7 @@ namespace WTelegram { _cts = new(); IPEndPoint endpoint = null; + bool needMigrate = false; byte[] preamble, secret = null; int dcId = _dcSession?.DcID ?? 0; if (dcId == 0) dcId = 2; @@ -943,6 +944,7 @@ namespace WTelegram { endpoint = GetDefaultEndpoint(out defaultDc); // re-ask callback for an address if (!triedEndpoints.Add(endpoint)) throw; + needMigrate = _dcSession.DataCenter.id == _session.MainDC && defaultDc != _session.MainDC; _dcSession.Client = null; // is it address for a known DCSession? _dcSession = _session.DCSessions.Values.FirstOrDefault(dcs => dcs.EndPoint.Equals(endpoint)); @@ -1001,6 +1003,7 @@ namespace WTelegram _session.DCSessions[TLConfig.this_dc] = _dcSession; } if (_session.MainDC == 0) _session.MainDC = TLConfig.this_dc; + else if (needMigrate) await MigrateToDC(_session.MainDC); } } finally From 3f531f4966f40c3c778f515bc37d67c7d478185e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:07:04 +0100 Subject: [PATCH 326/336] Collect: updated list of merged flags --- src/Services.cs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Services.cs b/src/Services.cs index cac857b..7d452f2 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -32,12 +32,17 @@ namespace TL { // update previously full user from min user: // see https://github.com/tdlib/td/blob/master/td/telegram/UserManager.cpp#L2689 // and https://github.com/telegramdesktop/tdesktop/blob/dev/Telegram/SourceFiles/data/data_session.cpp#L515 - const User.Flags updated_flags = (User.Flags)0x5DAFE000; - const User.Flags2 updated_flags2 = (User.Flags2)0x711; + const User.Flags updated_flags = User.Flags.deleted | User.Flags.bot | User.Flags.bot_chat_history | + User.Flags.bot_nochats | User.Flags.verified | User.Flags.restricted | User.Flags.has_bot_inline_placeholder | + User.Flags.bot_inline_geo | User.Flags.support | User.Flags.scam | User.Flags.fake | User.Flags.bot_attach_menu | + User.Flags.premium | User.Flags.has_emoji_status; + const User.Flags2 updated_flags2 = User.Flags2.has_usernames | User.Flags2.stories_unavailable | + User.Flags2.has_color | User.Flags2.has_profile_color | User.Flags2.contact_require_premium | + User.Flags2.bot_business | User.Flags2.bot_has_main_app | User.Flags2.bot_forum_view; // tdlib updated flags: deleted | bot | bot_chat_history | bot_nochats | verified | bot_inline_geo // | support | scam | fake | bot_attach_menu | premium // tdesktop non-updated flags: bot | bot_chat_history | bot_nochats | bot_attach_menu - // updated flags2: stories_unavailable (tdlib) | contact_require_premium (tdesktop) + // updated flags2: stories_unavailable | main_app | bot_business | bot_forum_view (tdlib) | contact_require_premium (tdesktop) prevUser.flags = (prevUser.flags & ~updated_flags) | (user.flags & updated_flags); prevUser.flags2 = (prevUser.flags2 & ~updated_flags2) | (user.flags2 & updated_flags2); prevUser.first_name ??= user.first_name; // tdlib: not updated ; tdesktop: updated only if unknown From 8fe9a485eeacd29625764fcec166fa35258837ea Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 13:45:53 +0100 Subject: [PATCH 327/336] updated copyright year --- README.md | 2 +- src/WTelegramClient.csproj | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 3edbec0..9cd653c 100644 --- a/README.md +++ b/README.md @@ -206,4 +206,4 @@ the [Examples codes](https://wiz0u.github.io/WTelegramClient/EXAMPLES) and still If you like this library, you can [buy me a coffee](https://buymeacoffee.com/wizou) ❤ This will help the project keep going. -© 2021-2025 Olivier Marcoux +© 2021-2026 Olivier Marcoux diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 8eaa0c5..6caf009 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -18,7 +18,7 @@ Release Notes: $(ReleaseNotes) - Copyright © Olivier Marcoux 2021-2025 + Copyright © Olivier Marcoux 2021-2026 MIT https://wiz0u.github.io/WTelegramClient logo.png From 0c5f589c548b8fc4f6356da6903d343d163f171e Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 3 Jan 2026 18:43:39 +0100 Subject: [PATCH 328/336] Update to Telegram API layer 221 - New objects (InputMediaStakeDice, Messages_EmojiGameOutcome, Messages_EmojiGameInfo, UpdateEmojiGameInfo, InputPasskeyCredentialFirebasePNV) - New methods (messages.getEmojiGameInfo, messages.summarizeText). - Updated Message flags and MessageMediaDice fields. --- README.md | 2 +- src/TL.Schema.cs | 66 ++++++++++++++++++++++++++++++++++++-- src/TL.SchemaFuncs.cs | 33 +++++++++++++++++++ src/TL.Table.cs | 12 +++++-- src/WTelegramClient.csproj | 4 +-- 5 files changed, 109 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 9cd653c..75fd39d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-220-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-221-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 8d88c61..38271ea 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -528,6 +528,14 @@ namespace TL /// The todo list. public TodoList todo; } + /// See + [TLDef(0xF3A9244A)] + public sealed partial class InputMediaStakeDice : InputMedia + { + public string game_hash; + public long ton_amount; + public byte[] client_seed; + } /// Defines a new group profile photo. See Derived classes: , /// a value means inputChatPhotoEmpty @@ -1816,7 +1824,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0xB92F76CF)] + [TLDef(0x9CB490E9)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1882,6 +1890,7 @@ namespace TL /// Used to suggest a post to a channel, see here » for more info on the full flow. [IfFlag(39)] public SuggestedPost suggested_post; [IfFlag(42)] public int schedule_repeat_period; + [IfFlag(43)] public string summary_from_language; [Flags] public enum Flags : uint { @@ -1969,6 +1978,8 @@ namespace TL paid_suggested_post_ton = 0x200, /// Field has a value has_schedule_repeat_period = 0x400, + /// Field has a value + has_summary_from_language = 0x800, } /// ID of the message @@ -2264,13 +2275,21 @@ namespace TL public PollResults results; } /// Dice-based animated sticker See - [TLDef(0x3F7EE58B)] + [TLDef(0x08CBEC07)] public sealed partial class MessageMediaDice : MessageMedia { + public Flags flags; /// Dice value public int value; /// The emoji, for now 🏀, 🎲 and 🎯 are supported public string emoticon; + [IfFlag(0)] public Messages_EmojiGameOutcome game_outcome; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_game_outcome = 0x1, + } } /// Represents a forwarded story or a story mention. See [TLDef(0x68CB6283)] @@ -6323,6 +6342,12 @@ namespace TL public long gift_id; public StarGiftAuctionUserState user_state; } + /// See + [TLDef(0xFB9C547A)] + public sealed partial class UpdateEmojiGameInfo : Update + { + public Messages_EmojiGameInfo info; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -22247,6 +22272,12 @@ namespace TL public string raw_id; public InputPasskeyResponse response; } + /// See + [TLDef(0x5B1CCB28)] + public sealed partial class InputPasskeyCredentialFirebasePNV : InputPasskeyCredential + { + public string pnv_token; + } /// See [TLDef(0xAFF56398)] @@ -22278,4 +22309,35 @@ namespace TL { public StarGiftAttribute[] attributes; } + + /// See + [TLDef(0xDA2AD647)] + public sealed partial class Messages_EmojiGameOutcome : IObject + { + public byte[] seed; + public long stake_ton_amount; + public long ton_amount; + } + + /// See + public abstract partial class Messages_EmojiGameInfo : IObject { } + /// See + [TLDef(0x59E65335)] + public sealed partial class Messages_EmojiGameUnavailable : Messages_EmojiGameInfo { } + /// See + [TLDef(0x44E56023)] + public sealed partial class Messages_EmojiGameDiceInfo : Messages_EmojiGameInfo + { + public Flags flags; + public string game_hash; + public long prev_stake; + public int current_streak; + public int[] params_; + [IfFlag(0)] public int plays_left; + + [Flags] public enum Flags : uint + { + has_plays_left = 0x1, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 5e2cdbc..ebcc49a 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -4857,6 +4857,22 @@ namespace TL top_msg_id = top_msg_id, }, peer is InputPeerChannel ipc ? ipc.channel_id : 0); + /// See + public static Task Messages_GetEmojiGameInfo(this Client client) + => client.Invoke(new Messages_GetEmojiGameInfo + { + }); + + /// See + public static Task Messages_SummarizeText(this Client client, InputPeer peer, int id, string to_lang = null) + => client.Invoke(new Messages_SummarizeText + { + flags = (Messages_SummarizeText.Flags)(to_lang != null ? 0x1 : 0), + peer = peer, + id = id, + to_lang = to_lang, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -12349,6 +12365,23 @@ namespace TL.Methods public int top_msg_id; } + [TLDef(0xFB7E8CA7)] + public sealed partial class Messages_GetEmojiGameInfo : IMethod { } + + [TLDef(0x9D4104E2)] + public sealed partial class Messages_SummarizeText : IMethod + { + public Flags flags; + public InputPeer peer; + public int id; + [IfFlag(0)] public string to_lang; + + [Flags] public enum Flags : uint + { + has_to_lang = 0x1, + } + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 7e253c3..9c8fa3b 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 = 220; // fetched 12/06/2025 13:11:05 + public const int Version = 221; // fetched 01/03/2026 17:38:29 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -107,6 +107,7 @@ namespace TL [0xC21B8849] = typeof(InputMediaWebPage), [0xC4103386] = typeof(InputMediaPaidMedia), [0x9FC55FDE] = typeof(InputMediaTodo), + [0xF3A9244A] = typeof(InputMediaStakeDice), [0x1CA48F57] = null,//InputChatPhotoEmpty [0xBDCDAEC0] = typeof(InputChatUploadedPhoto), [0x8953AD37] = typeof(InputChatPhoto), @@ -152,7 +153,7 @@ namespace TL [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0xB92F76CF] = typeof(Message), + [0x9CB490E9] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -166,7 +167,7 @@ namespace TL [0xF6A548D3] = typeof(MessageMediaInvoice), [0xB940C666] = typeof(MessageMediaGeoLive), [0x4BD6E798] = typeof(MessageMediaPoll), - [0x3F7EE58B] = typeof(MessageMediaDice), + [0x08CBEC07] = typeof(MessageMediaDice), [0x68CB6283] = typeof(MessageMediaStory), [0xAA073BEB] = typeof(MessageMediaGiveaway), [0xCEAA3EA1] = typeof(MessageMediaGiveawayResults), @@ -448,6 +449,7 @@ namespace TL [0x3E85E92C] = typeof(UpdateDeleteGroupCallMessages), [0x48E246C2] = typeof(UpdateStarGiftAuctionState), [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), + [0xFB9C547A] = typeof(UpdateEmojiGameInfo), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -1488,10 +1490,14 @@ namespace TL [0x3E63935C] = typeof(InputPasskeyResponseRegister), [0xC31FC14A] = typeof(InputPasskeyResponseLogin), [0x3C27B78F] = typeof(InputPasskeyCredentialPublicKey), + [0x5B1CCB28] = typeof(InputPasskeyCredentialFirebasePNV), [0xAFF56398] = typeof(StarGiftBackground), [0x3AAE0528] = typeof(StarGiftAuctionRound), [0x0AA021E5] = typeof(StarGiftAuctionRoundExtendable), [0x46C6E36F] = typeof(Payments_StarGiftUpgradeAttributes), + [0xDA2AD647] = typeof(Messages_EmojiGameOutcome), + [0x59E65335] = typeof(Messages_EmojiGameUnavailable), + [0x44E56023] = typeof(Messages_EmojiGameDiceInfo), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 6caf009..524af21 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.220 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 220 + layer.221 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 221 Release Notes: $(ReleaseNotes) From c60c9cb7af7c4696dd13c0c01845c57c186eb8e3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 3 Feb 2026 02:34:33 +0100 Subject: [PATCH 329/336] fix warnings/suggests --- README.md | 2 +- src/Client.Helpers.cs | 4 ++-- src/Client.cs | 2 ++ src/Compat.cs | 2 +- src/WTelegramClient.csproj | 2 +- 5 files changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 75fd39d..dc55f6f 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,7 @@ [![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) -## *_Telegram Client API library written 100% in C# and .NET_* +## *Telegram Client API library written 100% in C# and .NET* This library allows you to connect to Telegram and control a user programmatically (or a bot, but [WTelegramBot](https://www.nuget.org/packages/WTelegramBot) is much easier for that). All the Telegram Client APIs (MTProto) are supported so you can do everything the user could do with a full Telegram GUI client. diff --git a/src/Client.Helpers.cs b/src/Client.Helpers.cs index 8a3768f..eb0f8a6 100644 --- a/src/Client.Helpers.cs +++ b/src/Client.Helpers.cs @@ -899,8 +899,8 @@ namespace WTelegram var mc = await this.Channels_GetChannels(new InputChannel(chatId, 0)); if (!mc.chats.TryGetValue(chatId, out chat)) throw new WTException($"Channel {chatId} not found"); - else if (chats != null) - chats[chatId] = chat; + else + chats?[chatId] = chat; } } else diff --git a/src/Client.cs b/src/Client.cs index ce16017..316dfc0 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -391,7 +391,9 @@ namespace WTelegram _reactorReconnects = 0; if (_reactorReconnects == 0) throw; +#pragma warning disable CA2016 await Task.Delay(5000); +#pragma warning restore CA2016 if (_networkStream == null) return; // Dispose has been called in-between await ConnectAsync(); // start a new reactor after 5 secs lock (_pendingRpcs) // retry all pending requests diff --git a/src/Compat.cs b/src/Compat.cs index 4e9f9dc..31f26d8 100644 --- a/src/Compat.cs +++ b/src/Compat.cs @@ -75,7 +75,7 @@ namespace WTelegram static class Convert { internal static string ToHexString(byte[] data) => BitConverter.ToString(data).Replace("-", ""); - internal static byte[] FromHexString(string hex) => Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16)).ToArray(); + internal static byte[] FromHexString(string hex) => [.. Enumerable.Range(0, hex.Length / 2).Select(i => System.Convert.ToByte(hex.Substring(i * 2, 2), 16))]; } public class RandomNumberGenerator { diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 524af21..02e519b 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -28,7 +28,7 @@ $(ReleaseNotes) Telegram;MTProto;Client;Api;UserBot README.md $(ReleaseNotes) - NETSDK1138;CS0419;CS1573;CS1591 + NETSDK1138;CS0419;CS1573;CS1591;CA1850 TRACE;OBFUSCATION;MTPG From 3d4be8ee9a89d677be86a4ace48f31462b403cef Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 6 Feb 2026 20:27:00 +0100 Subject: [PATCH 330/336] Update to Telegram API layer 222: gift crafting, keyboard buttons style, getFutureCreatorAfterLeave and more... --- README.md | 2 +- src/TL.Schema.cs | 363 ++++++++++++++++++++++++++++++++----- src/TL.SchemaFuncs.cs | 53 +++++- src/TL.Table.cs | 63 ++++--- src/WTelegramClient.csproj | 4 +- 5 files changed, 406 insertions(+), 79 deletions(-) diff --git a/README.md b/README.md index dc55f6f..d0baa0d 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-221-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-222-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 38271ea..e0f1216 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -936,6 +936,7 @@ namespace TL /// Field has a value has_send_paid_messages_stars = 0x8000, bot_forum_view = 0x10000, + bot_forum_can_manage_topics = 0x20000, } } @@ -1278,6 +1279,7 @@ namespace TL broadcast = 0x20, /// Is this a supergroup megagroup = 0x100, + monoforum = 0x400, /// Field has a value has_until_date = 0x10000, } @@ -3075,7 +3077,7 @@ namespace TL } } /// A gift » was upgraded to a collectible gift ». See - [TLDef(0x95728543)] + [TLDef(0xE6C31522)] public sealed partial class MessageActionStarGiftUnique : MessageAction { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -3099,6 +3101,7 @@ namespace TL /// If set, indicates that the current gift can't be resold » yet: the owner will be able to put it up for sale at the specified unixtime. [IfFlag(10)] public DateTime can_resell_at; [IfFlag(12)] public long drop_original_details_stars; + [IfFlag(15)] public DateTime can_craft_at; [Flags] public enum Flags : uint { @@ -3130,6 +3133,9 @@ namespace TL has_drop_original_details_stars = 0x1000, assigned = 0x2000, from_offer = 0x4000, + /// Field has a value + has_can_craft_at = 0x8000, + craft = 0x10000, } } /// Sent from peer A to B, indicates that A refunded all stars B previously paid to send messages to A, see here » for more info on paid messages. See @@ -3303,6 +3309,18 @@ namespace TL expired = 0x1, } } + /// See + [TLDef(0xB07ED085)] + public sealed partial class MessageActionNewCreatorPending : MessageAction + { + public long new_creator_id; + } + /// See + [TLDef(0xE188503B)] + public sealed partial class MessageActionChangeCreator : MessageAction + { + public long new_creator_id; + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -6348,6 +6366,9 @@ namespace TL { public Messages_EmojiGameInfo info; } + /// See + [TLDef(0xAC072444)] + public sealed partial class UpdateStarGiftCraftFail : Update { } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8477,32 +8498,57 @@ namespace TL /// Bot or inline keyboard buttons See Derived classes: , , , , , , , , , , , , , , , , , public abstract partial class KeyboardButtonBase : IObject { + public virtual KeyboardButtonStyle Style => default; /// Button text public virtual string Text => default; } /// Bot keyboard button See - [TLDef(0xA2FA4880)] - public partial class KeyboardButton : KeyboardButtonBase + [TLDef(0x7D170CFF)] + public sealed partial class KeyboardButton : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// URL button See - [TLDef(0x258AFF05, inheritBefore = true)] - public sealed partial class KeyboardButtonUrl : KeyboardButton + [TLDef(0xD80C25EC)] + public sealed partial class KeyboardButtonUrl : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button label + public string text; /// URL public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button label + public override string Text => text; } /// Callback button See - [TLDef(0x35BBDB6B)] + [TLDef(0xE62BC960)] public sealed partial class KeyboardButtonCallback : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// Callback data @@ -8512,27 +8558,59 @@ namespace TL { /// Whether the user should verify his identity by entering his 2FA SRP parameters to the Messages_GetBotCallbackAnswer method. NOTE: telegram and the bot WILL NOT have access to the plaintext password, thanks to SRP. This button is mainly used by the official @botfather bot, for verifying the user's identity before transferring ownership of a bot to another user. requires_password = 0x1, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Button to request a user's phone number See - [TLDef(0xB16A6C29)] - public sealed partial class KeyboardButtonRequestPhone : KeyboardButton + [TLDef(0x417EFD8F)] + public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to request a user's geolocation See - [TLDef(0xFC796B3F)] - public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButton + [TLDef(0xAA40F94D)] + public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See - [TLDef(0x93B9FBB5)] + [TLDef(0x991399FC)] public sealed partial class KeyboardButtonSwitchInline : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button label public string text; /// The inline query to use @@ -8546,27 +8624,59 @@ namespace TL same_peer = 0x1, /// Field has a value has_peer_types = 0x2, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button label public override string Text => text; } /// Button to start a game See - [TLDef(0x50F41CCF)] - public sealed partial class KeyboardButtonGame : KeyboardButton + [TLDef(0x89C590F9)] + public sealed partial class KeyboardButtonGame : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to buy a product See - [TLDef(0xAFD93FBB)] - public sealed partial class KeyboardButtonBuy : KeyboardButton + [TLDef(0x3FA53905)] + public sealed partial class KeyboardButtonBuy : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0x10B78D29)] + [TLDef(0xF51006F9)] public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button label public string text; /// New text of the button in forwarded messages. @@ -8580,17 +8690,21 @@ namespace TL { /// Field has a value has_fwd_text = 0x1, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button label public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See - [TLDef(0xD02E7FD4)] + [TLDef(0x68013E72)] public sealed partial class InputKeyboardButtonUrlAuth : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// New text of the button in forwarded messages. @@ -8606,74 +8720,154 @@ namespace TL request_write_access = 0x1, /// Field has a value has_fwd_text = 0x2, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// A button that allows the user to create and send a poll when pressed; available only in private See - [TLDef(0xBBC7515D)] - public sealed partial class KeyboardButtonRequestPoll : KeyboardButton + [TLDef(0x7A11D782)] + public sealed partial class KeyboardButtonRequestPoll : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// If set, only quiz polls can be sent [IfFlag(0)] public bool quiz; + /// Button text + public string text; [Flags] public enum Flags : uint { /// Field has a value has_quiz = 0x1, + /// Field has a value + has_style = 0x400, } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0xE988037B)] + [TLDef(0x7D5E07C7)] public sealed partial class InputKeyboardButtonUserProfile : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// User ID public InputUserBase user_id; + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0x308660C1, inheritBefore = true)] - public sealed partial class KeyboardButtonUserProfile : KeyboardButton + [TLDef(0xC0FD5D09)] + public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// User ID public long user_id; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See - [TLDef(0x13767230, inheritBefore = true)] - public partial class KeyboardButtonWebView : KeyboardButton + [TLDef(0xE846B1A0)] + public sealed partial class KeyboardButtonWebView : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// Web app url public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See - [TLDef(0xA0C0505C)] - public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonWebView + [TLDef(0xE15C4370)] + public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; + /// Web app URL + public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See - [TLDef(0x53D7BFD8, inheritBefore = true)] - public sealed partial class KeyboardButtonRequestPeer : KeyboardButton + [TLDef(0x5B0F15F5)] + public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button text + public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; /// Maximum number of peers that can be chosen. public int max_quantity; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button text + public override string Text => text; } ///
Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer. See - [TLDef(0xC9662D05)] + [TLDef(0x02B78156)] public sealed partial class InputKeyboardButtonRequestPeer : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; /// Button text public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. @@ -8691,17 +8885,34 @@ namespace TL username_requested = 0x2, /// Set this flag to request the peer's photo (if any). photo_requested = 0x4, + /// Field has a value + has_style = 0x400, } + public override KeyboardButtonStyle Style => style; /// Button text public override string Text => text; } /// Clipboard button: when clicked, the attached text must be copied to the clipboard. See - [TLDef(0x75D2698E, inheritBefore = true)] - public sealed partial class KeyboardButtonCopy : KeyboardButton + [TLDef(0xBCC4AF10)] + public sealed partial class KeyboardButtonCopy : KeyboardButtonBase { + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Title of the button + public string text; /// The text that will be copied to the clipboard public string copy_text; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Title of the button + public override string Text => text; } /// Inline keyboard row See @@ -14253,7 +14464,7 @@ namespace TL /// a value means urlAuthResultDefault public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See - [TLDef(0x92D33A0E)] + [TLDef(0x32FABF1A)] public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14262,19 +14473,33 @@ namespace TL public UserBase bot; /// The domain name of the website on which the user will log in. public string domain; + [IfFlag(2)] public string browser; + [IfFlag(2)] public string platform; + [IfFlag(2)] public string ip; + [IfFlag(2)] public string region; [Flags] public enum Flags : uint { /// Whether the bot would like to send messages to the user request_write_access = 0x1, + request_phone_number = 0x2, + /// Fields , , and have a value + has_browser = 0x4, } } /// Details about an accepted authorization request, for more info click here » See - [TLDef(0x8F8C0E4E)] + [TLDef(0x623A8FA0)] public sealed partial class UrlAuthResultAccepted : UrlAuthResult { + public Flags flags; /// The URL name of the website on which the user has logged in. - public string url; + [IfFlag(0)] public string url; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_url = 0x1, + } } /// Geographical location of supergroup (geogroups) See @@ -20780,7 +21005,7 @@ namespace TL public override Peer ReleasedBy => released_by; } /// Represents a collectible star gift, see here » for more info. See - [TLDef(0x569D64C9)] + [TLDef(0x85F0A9CD)] public sealed partial class StarGiftUnique : StarGiftBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -20823,6 +21048,7 @@ namespace TL [IfFlag(11)] public PeerColorBase peer_color; [IfFlag(12)] public Peer host_id; [IfFlag(13)] public int offer_min_stars; + [IfFlag(16)] public int craft_chance_permille; [Flags] public enum Flags : uint { @@ -20854,6 +21080,10 @@ namespace TL has_host_id = 0x1000, /// Field has a value has_offer_min_stars = 0x2000, + burned = 0x4000, + crafted = 0x8000, + /// Field has a value + has_craft_chance_permille = 0x10000, } /// Identifier of the collectible gift. @@ -21176,29 +21406,33 @@ namespace TL /// An attribute of a collectible gift ». See Derived classes: , , , public abstract partial class StarGiftAttribute : IObject { } /// The model of a collectible gift ». See - [TLDef(0x39D99013)] + [TLDef(0x565251E2)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + public Flags flags; /// Name of the model public string name; /// The sticker representing the upgraded gift public DocumentBase document; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; + + [Flags] public enum Flags : uint + { + crafted = 0x1, + } } /// A sticker applied on the backdrop of a collectible gift » using a repeating pattern. See - [TLDef(0x13ACFF19)] + [TLDef(0x4E7085EA)] public sealed partial class StarGiftAttributePattern : StarGiftAttribute { /// Name of the symbol public string name; /// The symbol public DocumentBase document; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } /// The backdrop of a collectible gift ». See - [TLDef(0xD93D859C)] + [TLDef(0x9F2504E4)] public sealed partial class StarGiftAttributeBackdrop : StarGiftAttribute { /// Name of the backdrop @@ -21213,8 +21447,7 @@ namespace TL public int pattern_color; /// Color of the text on the backdrop in RGB24 format. public int text_color; - /// The number of upgraded gifts that receive this backdrop for each 1000 gifts upgraded. - public int rarity_permille; + public StarGiftAttributeRarityBase rarity; } /// Info about the sender, receiver and message attached to the original gift », before it was upgraded to a collectible gift ». See [TLDef(0xE0BFF26C)] @@ -21294,7 +21527,7 @@ namespace TL } /// Represents a gift owned by a peer. See - [TLDef(0xEAD6805E)] + [TLDef(0x41DF43FC)] public sealed partial class SavedStarGift : IObject { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -21329,6 +21562,7 @@ namespace TL [IfFlag(16)] public string prepaid_upgrade_hash; [IfFlag(18)] public long drop_original_details_stars; [IfFlag(19)] public int gift_num; + [IfFlag(20)] public DateTime can_craft_at; [Flags] public enum Flags : uint { @@ -21372,6 +21606,8 @@ namespace TL has_drop_original_details_stars = 0x40000, /// Field has a value has_gift_num = 0x80000, + /// Field has a value + has_can_craft_at = 0x100000, } } @@ -22340,4 +22576,41 @@ namespace TL has_plays_left = 0x1, } } + + /// See + public abstract partial class StarGiftAttributeRarityBase : IObject { } + /// See + [TLDef(0x36437737)] + public sealed partial class StarGiftAttributeRarity : StarGiftAttributeRarityBase + { + public int permille; + } + /// See + [TLDef(0xDBCE6389)] + public sealed partial class StarGiftAttributeRarityUncommon : StarGiftAttributeRarityBase { } + /// See + [TLDef(0xF08D516B)] + public sealed partial class StarGiftAttributeRarityRare : StarGiftAttributeRarityBase { } + /// See + [TLDef(0x78FBF3A8)] + public sealed partial class StarGiftAttributeRarityEpic : StarGiftAttributeRarityBase { } + /// See + [TLDef(0xCEF7E7A8)] + public sealed partial class StarGiftAttributeRarityLegendary : StarGiftAttributeRarityBase { } + + /// See + [TLDef(0x4FDD3430)] + public sealed partial class KeyboardButtonStyle : IObject + { + public Flags flags; + [IfFlag(3)] public long icon; + + [Flags] public enum Flags : uint + { + bg_primary = 0x1, + bg_danger = 0x2, + bg_success = 0x4, + has_icon = 0x8, + } + } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index ebcc49a..c7ded16 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3308,10 +3308,10 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false) + public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false, bool share_phone_number = false) => client.Invoke(new Messages_AcceptUrlAuth { - flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0)), + flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, @@ -5914,6 +5914,13 @@ namespace TL tab = tab, }); + /// See + public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) + => client.Invoke(new Channels_GetFutureCreatorAfterLeave + { + channel = channel, + }); + /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -6743,10 +6750,10 @@ namespace TL /// Optionally filter gifts with the specified attributes. If no attributes of a specific type are specified, all attributes of that type are allowed. /// Offset for pagination. If not equal to an empty string, .counters will not be set to avoid returning the counters every time a new page is fetched. /// Maximum number of results to return, see pagination - public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false) + public static Task Payments_GetResaleStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue, long? attributes_hash = null, StarGiftAttributeId[] attributes = null, bool sort_by_price = false, bool sort_by_num = false, bool for_craft = false) => client.Invoke(new Payments_GetResaleStarGifts { - flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0)), + flags = (Payments_GetResaleStarGifts.Flags)((attributes_hash != null ? 0x1 : 0) | (attributes != null ? 0x8 : 0) | (sort_by_price ? 0x2 : 0) | (sort_by_num ? 0x4 : 0) | (for_craft ? 0x10 : 0)), attributes_hash = attributes_hash ?? default, gift_id = gift_id, attributes = attributes, @@ -6893,6 +6900,22 @@ namespace TL gift_id = gift_id, }); + /// See + public static Task Payments_GetCraftStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue) + => client.Invoke(new Payments_GetCraftStarGifts + { + gift_id = gift_id, + offset = offset, + limit = limit, + }); + + /// See + public static Task Payments_CraftStarGift(this Client client, params InputSavedStarGift[] stargift) + => client.Invoke(new Payments_CraftStarGift + { + stargift = stargift, + }); + /// Create a stickerset. See [bots: ✓] Possible codes: 400 (details) /// Whether this is a mask stickerset /// Whether this is a custom emoji stickerset. @@ -11060,6 +11083,7 @@ namespace TL.Methods write_allowed = 0x1, has_peer = 0x2, has_url = 0x4, + share_phone_number = 0x8, } } @@ -13190,6 +13214,12 @@ namespace TL.Methods public ProfileTab tab; } + [TLDef(0xA00918AF)] + public sealed partial class Channels_GetFutureCreatorAfterLeave : IMethod + { + public InputChannelBase channel; + } + [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { @@ -13911,6 +13941,7 @@ namespace TL.Methods sort_by_price = 0x2, sort_by_num = 0x4, has_attributes = 0x8, + for_craft = 0x10, } } @@ -14036,6 +14067,20 @@ namespace TL.Methods public long gift_id; } + [TLDef(0xFD05DD00)] + public sealed partial class Payments_GetCraftStarGifts : IMethod + { + public long gift_id; + public string offset; + public int limit; + } + + [TLDef(0xB0F9684F)] + public sealed partial class Payments_CraftStarGift : IMethod + { + public InputSavedStarGift[] stargift; + } + [TLDef(0x9021AB67)] public sealed partial class Stickers_CreateStickerSet : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 9c8fa3b..58c89c4 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 = 221; // fetched 01/03/2026 17:38:29 + public const int Version = 222; // fetched 02/06/2026 19:18:24 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -221,7 +221,7 @@ namespace TL [0x45D5B021] = typeof(MessageActionGiftStars), [0xB00C47A2] = typeof(MessageActionPrizeStars), [0xEA2C31D3] = typeof(MessageActionStarGift), - [0x95728543] = typeof(MessageActionStarGiftUnique), + [0xE6C31522] = typeof(MessageActionStarGiftUnique), [0xAC1F1FCD] = typeof(MessageActionPaidMessagesRefunded), [0x84B88578] = typeof(MessageActionPaidMessagesPrice), [0x2FFE2F7A] = typeof(MessageActionConferenceCall), @@ -234,6 +234,8 @@ namespace TL [0x2C8F2A25] = typeof(MessageActionSuggestBirthday), [0x774278D4] = typeof(MessageActionStarGiftPurchaseOffer), [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), + [0xB07ED085] = typeof(MessageActionNewCreatorPending), + [0xE188503B] = typeof(MessageActionChangeCreator), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -450,6 +452,7 @@ namespace TL [0x48E246C2] = typeof(UpdateStarGiftAuctionState), [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xFB9C547A] = typeof(UpdateEmojiGameInfo), + [0xAC072444] = typeof(UpdateStarGiftCraftFail), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -594,24 +597,24 @@ namespace TL [0xD3F924EB] = null,//Messages_StickerSetNotModified [0xC27AC8C7] = typeof(BotCommand), [0x4D8A0299] = typeof(BotInfo), - [0xA2FA4880] = typeof(KeyboardButton), - [0x258AFF05] = typeof(KeyboardButtonUrl), - [0x35BBDB6B] = typeof(KeyboardButtonCallback), - [0xB16A6C29] = typeof(KeyboardButtonRequestPhone), - [0xFC796B3F] = typeof(KeyboardButtonRequestGeoLocation), - [0x93B9FBB5] = typeof(KeyboardButtonSwitchInline), - [0x50F41CCF] = typeof(KeyboardButtonGame), - [0xAFD93FBB] = typeof(KeyboardButtonBuy), - [0x10B78D29] = typeof(KeyboardButtonUrlAuth), - [0xD02E7FD4] = typeof(InputKeyboardButtonUrlAuth), - [0xBBC7515D] = typeof(KeyboardButtonRequestPoll), - [0xE988037B] = typeof(InputKeyboardButtonUserProfile), - [0x308660C1] = typeof(KeyboardButtonUserProfile), - [0x13767230] = typeof(KeyboardButtonWebView), - [0xA0C0505C] = typeof(KeyboardButtonSimpleWebView), - [0x53D7BFD8] = typeof(KeyboardButtonRequestPeer), - [0xC9662D05] = typeof(InputKeyboardButtonRequestPeer), - [0x75D2698E] = typeof(KeyboardButtonCopy), + [0x7D170CFF] = typeof(KeyboardButton), + [0xD80C25EC] = typeof(KeyboardButtonUrl), + [0xE62BC960] = typeof(KeyboardButtonCallback), + [0x417EFD8F] = typeof(KeyboardButtonRequestPhone), + [0xAA40F94D] = typeof(KeyboardButtonRequestGeoLocation), + [0x991399FC] = typeof(KeyboardButtonSwitchInline), + [0x89C590F9] = typeof(KeyboardButtonGame), + [0x3FA53905] = typeof(KeyboardButtonBuy), + [0xF51006F9] = typeof(KeyboardButtonUrlAuth), + [0x68013E72] = typeof(InputKeyboardButtonUrlAuth), + [0x7A11D782] = typeof(KeyboardButtonRequestPoll), + [0x7D5E07C7] = typeof(InputKeyboardButtonUserProfile), + [0xC0FD5D09] = typeof(KeyboardButtonUserProfile), + [0xE846B1A0] = typeof(KeyboardButtonWebView), + [0xE15C4370] = typeof(KeyboardButtonSimpleWebView), + [0x5B0F15F5] = typeof(KeyboardButtonRequestPeer), + [0x02B78156] = typeof(InputKeyboardButtonRequestPeer), + [0xBCC4AF10] = typeof(KeyboardButtonCopy), [0x77608B83] = typeof(KeyboardButtonRow), [0xA03E5B85] = typeof(ReplyKeyboardHide), [0x86B40B08] = typeof(ReplyKeyboardForceReply), @@ -999,8 +1002,8 @@ namespace TL [0xFBD2C296] = typeof(InputFolderPeer), [0xE9BAA668] = typeof(FolderPeer), [0xE844EBFF] = typeof(Messages_SearchCounter), - [0x92D33A0E] = typeof(UrlAuthResultRequest), - [0x8F8C0E4E] = typeof(UrlAuthResultAccepted), + [0x32FABF1A] = typeof(UrlAuthResultRequest), + [0x623A8FA0] = typeof(UrlAuthResultAccepted), [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty [0x209B82DB] = typeof(ChannelLocation), @@ -1389,7 +1392,7 @@ namespace TL [0x94CE852A] = typeof(StarsGiveawayOption), [0x54236209] = typeof(StarsGiveawayWinnersOption), [0x313A9547] = typeof(StarGift), - [0x569D64C9] = typeof(StarGiftUnique), + [0x85F0A9CD] = typeof(StarGiftUnique), [0xA388A368] = null,//Payments_StarGiftsNotModified [0x2ED82995] = typeof(Payments_StarGifts), [0x7903E3D9] = typeof(MessageReportOption), @@ -1409,16 +1412,16 @@ namespace TL [0x82C9E290] = typeof(Messages_FoundStickers), [0xB0CD6617] = typeof(BotVerifierSettings), [0xF93CD45C] = typeof(BotVerification), - [0x39D99013] = typeof(StarGiftAttributeModel), - [0x13ACFF19] = typeof(StarGiftAttributePattern), - [0xD93D859C] = typeof(StarGiftAttributeBackdrop), + [0x565251E2] = typeof(StarGiftAttributeModel), + [0x4E7085EA] = typeof(StarGiftAttributePattern), + [0x9F2504E4] = typeof(StarGiftAttributeBackdrop), [0xE0BFF26C] = typeof(StarGiftAttributeOriginalDetails), [0x3DE1DFED] = typeof(Payments_StarGiftUpgradePreview), [0x62D706B8] = typeof(Users_Users), [0x315A4974] = typeof(Users_UsersSlice), [0x416C56E8] = typeof(Payments_UniqueStarGift), [0x8C9A88AC] = typeof(Messages_WebPagePreview), - [0xEAD6805E] = typeof(SavedStarGift), + [0x41DF43FC] = typeof(SavedStarGift), [0x95F389B1] = typeof(Payments_SavedStarGifts), [0x69279795] = typeof(InputSavedStarGiftUser), [0xF101AA7F] = typeof(InputSavedStarGiftChat), @@ -1498,6 +1501,12 @@ namespace TL [0xDA2AD647] = typeof(Messages_EmojiGameOutcome), [0x59E65335] = typeof(Messages_EmojiGameUnavailable), [0x44E56023] = typeof(Messages_EmojiGameDiceInfo), + [0x36437737] = typeof(StarGiftAttributeRarity), + [0xDBCE6389] = typeof(StarGiftAttributeRarityUncommon), + [0xF08D516B] = typeof(StarGiftAttributeRarityRare), + [0x78FBF3A8] = typeof(StarGiftAttributeRarityEpic), + [0xCEF7E7A8] = typeof(StarGiftAttributeRarityLegendary), + [0x4FDD3430] = typeof(KeyboardButtonStyle), // from TL.Secret: [0x6ABD9782] = typeof(Layer143.DecryptedMessageMediaDocument), [0x020DF5D0] = typeof(Layer101.MessageEntityBlockquote), diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index 02e519b..aef2b5c 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.221 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 221 + layer.222 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 222 Release Notes: $(ReleaseNotes) From 42fed132054ce8dcd6e9d06242b08c068c02f605 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Fri, 27 Feb 2026 16:40:53 +0100 Subject: [PATCH 331/336] Making method Invoke virtual for library add-ons. --- src/Client.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Client.cs b/src/Client.cs index 316dfc0..fbeb56b 100644 --- a/src/Client.cs +++ b/src/Client.cs @@ -1584,7 +1584,7 @@ namespace WTelegram /// Expected type of the returned object /// TL method structure /// Wait for the reply and return the resulting object, or throws an RpcException if an error was replied - public async Task Invoke(IMethod query) + public virtual async Task Invoke(IMethod query) { if (_dcSession.withoutUpdates && query is not IMethod and not IMethod) query = new TL.Methods.InvokeWithoutUpdates { query = query }; From bd311a3a4fb276b9415aaa2f2c87c9a7480130fe Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Mar 2026 16:25:35 +0100 Subject: [PATCH 332/336] TLDef.inheritBefore => inheritAt --- generator/MTProtoGenerator.cs | 7 ++-- src/TL.MTProto.cs | 20 +++++------ src/TL.Schema.cs | 66 +++++++++++++++++------------------ src/TL.Secret.cs | 2 +- src/TL.cs | 23 +++++++++--- 5 files changed, 66 insertions(+), 52 deletions(-) diff --git a/generator/MTProtoGenerator.cs b/generator/MTProtoGenerator.cs index f326c13..44c7c35 100644 --- a/generator/MTProtoGenerator.cs +++ b/generator/MTProtoGenerator.cs @@ -112,11 +112,12 @@ public class MTProtoGenerator : IIncrementalGenerator .AppendLine("\t\t{") .AppendLine($"\t\t\twriter.Write(0x{id:X8});"); var members = symbol.GetMembers().ToList(); + int inheritIndex = 0; for (var parent = symbol.BaseType; parent != object_; parent = parent.BaseType) { - var inheritBefore = (bool?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritBefore").Value.Value ?? false; - if (inheritBefore) members.InsertRange(0, parent.GetMembers()); - else members.AddRange(parent.GetMembers()); + var inheritAt = (int?)tldef.NamedArguments.FirstOrDefault(k => k.Key == "inheritAt").Value.Value ?? -1; + if (inheritAt >= 0) members.InsertRange(inheritIndex += inheritAt, parent.GetMembers()); + else { inheritIndex = members.Count; members.AddRange(parent.GetMembers()); } tldef = parent.GetAttributes().FirstOrDefault(a => a.AttributeClass == tlDefAttribute); } foreach (var member in members.OfType()) diff --git a/src/TL.MTProto.cs b/src/TL.MTProto.cs index 4b6e052..de10b70 100644 --- a/src/TL.MTProto.cs +++ b/src/TL.MTProto.cs @@ -25,17 +25,17 @@ namespace TL public Int128 server_nonce; public Int256 new_nonce; } - [TLDef(0xA9F55F95, inheritBefore = true)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data + [TLDef(0xA9F55F95, inheritAt = 0)] //p_q_inner_data_dc#a9f55f95 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int = P_Q_inner_data public sealed partial class PQInnerDataDc : PQInnerData { public int dc; } - [TLDef(0x3C6A84D4, inheritBefore = true)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data + [TLDef(0x3C6A84D4, inheritAt = 0)] //p_q_inner_data_temp#3c6a84d4 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 expires_in:int = P_Q_inner_data public sealed partial class PQInnerDataTemp : PQInnerData { public int expires_in; } - [TLDef(0x56FDDF88, inheritBefore = true)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data + [TLDef(0x56FDDF88, inheritAt = 0)] //p_q_inner_data_temp_dc#56fddf88 pq:bytes p:bytes q:bytes nonce:int128 server_nonce:int128 new_nonce:int256 dc:int expires_in:int = P_Q_inner_data public sealed partial class PQInnerDataTempDc : PQInnerData { public int dc; @@ -57,12 +57,12 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x79CB045D, inheritBefore = true)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params + [TLDef(0x79CB045D, inheritAt = 0)] //server_DH_params_fail#79cb045d nonce:int128 server_nonce:int128 new_nonce_hash:int128 = Server_DH_Params public sealed partial class ServerDHParamsFail : ServerDHParams { public Int128 new_nonce_hash; } - [TLDef(0xD0E8075C, inheritBefore = true)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params + [TLDef(0xD0E8075C, inheritAt = 0)] //server_DH_params_ok#d0e8075c nonce:int128 server_nonce:int128 encrypted_answer:bytes = Server_DH_Params public sealed partial class ServerDHParamsOk : ServerDHParams { public byte[] encrypted_answer; @@ -93,17 +93,17 @@ namespace TL public Int128 nonce; public Int128 server_nonce; } - [TLDef(0x3BCBF734, inheritBefore = true)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer + [TLDef(0x3BCBF734, inheritAt = 0)] //dh_gen_ok#3bcbf734 nonce:int128 server_nonce:int128 new_nonce_hash1:int128 = Set_client_DH_params_answer public sealed partial class DhGenOk : SetClientDHParamsAnswer { public Int128 new_nonce_hash1; } - [TLDef(0x46DC1FB9, inheritBefore = true)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer + [TLDef(0x46DC1FB9, inheritAt = 0)] //dh_gen_retry#46dc1fb9 nonce:int128 server_nonce:int128 new_nonce_hash2:int128 = Set_client_DH_params_answer public sealed partial class DhGenRetry : SetClientDHParamsAnswer { public Int128 new_nonce_hash2; } - [TLDef(0xA69DAE02, inheritBefore = true)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer + [TLDef(0xA69DAE02, inheritAt = 0)] //dh_gen_fail#a69dae02 nonce:int128 server_nonce:int128 new_nonce_hash3:int128 = Set_client_DH_params_answer public sealed partial class DhGenFail : SetClientDHParamsAnswer { public Int128 new_nonce_hash3; @@ -130,7 +130,7 @@ namespace TL public int bad_msg_seqno; public int error_code; } - [TLDef(0xEDAB447B, inheritBefore = true)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification + [TLDef(0xEDAB447B, inheritAt = 0)] //bad_server_salt#edab447b bad_msg_id:long bad_msg_seqno:int error_code:int new_server_salt:long = BadMsgNotification public sealed partial class BadServerSalt : BadMsgNotification { public long new_server_salt; @@ -267,7 +267,7 @@ namespace TL public int ipv4; public int port; } - [TLDef(0x37982646, inheritBefore = true)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort + [TLDef(0x37982646, inheritAt = 0)] //ipPortSecret#37982646 ipv4:int port:int secret:bytes = IpPort public sealed partial class IpPortSecret : IpPort { public byte[] secret; diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e0f1216..e5d7470 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -2732,7 +2732,7 @@ namespace TL [TLDef(0xEBBCA3CB)] public sealed partial class MessageActionChatJoinedByRequest : MessageAction { } /// Data from an opened reply keyboard bot mini app was relayed to the bot that owns it (bot side service message). See - [TLDef(0x47DD8079, inheritBefore = true)] + [TLDef(0x47DD8079, inheritAt = 0)] public sealed partial class MessageActionWebViewDataSentMe : MessageActionWebViewDataSent { /// Relayed data. @@ -4401,7 +4401,7 @@ namespace TL } /// Affected part of communication history with the user or in a chat. See - [TLDef(0xB45C69D1, inheritBefore = true)] + [TLDef(0xB45C69D1, inheritAt = 0)] public partial class Messages_AffectedHistory : Messages_AffectedMessages { /// If a parameter contains positive value, it is necessary to repeat the method call using the given value; during the proceeding of all the history the value itself shall gradually decrease @@ -4531,7 +4531,7 @@ namespace TL } } /// The user is preparing a message in a group; typing, recording, uploading, etc. This update is valid for 6 seconds. If no further updates of this kind are received after 6 seconds, it should be considered that the user stopped doing whatever they were doing See - [TLDef(0x83487AF0, inheritBefore = true)] + [TLDef(0x83487AF0, inheritAt = 0)] public sealed partial class UpdateChatUserTyping : UpdateChat { /// Peer that started typing (can be the chat itself, in case of anonymous admins). @@ -4547,14 +4547,14 @@ namespace TL public ChatParticipantsBase participants; } /// Contact status update. See - [TLDef(0xE5BDF8DE, inheritBefore = true)] + [TLDef(0xE5BDF8DE, inheritAt = 0)] public sealed partial class UpdateUserStatus : UpdateUser { /// New status public UserStatus status; } /// Changes the user's first name, last name and username. See - [TLDef(0xA7848924, inheritBefore = true)] + [TLDef(0xA7848924, inheritAt = 0)] public sealed partial class UpdateUserName : UpdateUser { /// New first name. Corresponds to the new value of real_first_name field of the . @@ -4625,7 +4625,7 @@ namespace TL public DateTime date; } /// New group member. See - [TLDef(0x3DDA5451, inheritBefore = true)] + [TLDef(0x3DDA5451, inheritAt = 0)] public sealed partial class UpdateChatParticipantAdd : UpdateChat { /// ID of the new member @@ -4638,7 +4638,7 @@ namespace TL public int version; } /// A member has left the group. See - [TLDef(0xE32F3D77, inheritBefore = true)] + [TLDef(0xE32F3D77, inheritAt = 0)] public sealed partial class UpdateChatParticipantDelete : UpdateChat { /// ID of the user @@ -4699,7 +4699,7 @@ namespace TL public PrivacyRule[] rules; } /// A user's phone number was changed See - [TLDef(0x05492A13, inheritBefore = true)] + [TLDef(0x05492A13, inheritAt = 0)] public sealed partial class UpdateUserPhone : UpdateUser { /// New phone number @@ -4861,7 +4861,7 @@ namespace TL public override void SetPTS(int new_pts, int new_pts_count) => (pts, pts_count) = (new_pts, new_pts_count); } /// The view counter of a message in a channel has changed See - [TLDef(0xF226AC08, inheritBefore = true)] + [TLDef(0xF226AC08, inheritAt = 0)] public sealed partial class UpdateChannelMessageViews : UpdateChannel { /// ID of the message @@ -4870,7 +4870,7 @@ namespace TL public int views; } /// Admin permissions of a user in a basic group were changed See - [TLDef(0xD7CA61A2, inheritBefore = true)] + [TLDef(0xD7CA61A2, inheritAt = 0)] public sealed partial class UpdateChatParticipantAdmin : UpdateChat { /// ID of the (de)admined user @@ -5254,7 +5254,7 @@ namespace TL [TLDef(0x7084A7BE)] public sealed partial class UpdateContactsReset : Update { } /// The history of a channel/supergroup was hidden. See - [TLDef(0xB23FC698, inheritBefore = true)] + [TLDef(0xB23FC698, inheritAt = 0)] public sealed partial class UpdateChannelAvailableMessages : UpdateChannel { /// Identifier of a maximum unavailable message in a channel due to hidden history. @@ -5437,7 +5437,7 @@ namespace TL public byte[] data; } /// The forward counter of a message in a channel has changed See - [TLDef(0xD29A27F4, inheritBefore = true)] + [TLDef(0xD29A27F4, inheritAt = 0)] public sealed partial class UpdateChannelMessageForwards : UpdateChannel { /// ID of the message @@ -5836,7 +5836,7 @@ namespace TL [TLDef(0xFB4C496C)] public sealed partial class UpdateReadFeaturedEmojiStickers : Update { } /// The emoji status of a certain user has changed See - [TLDef(0x28373599, inheritBefore = true)] + [TLDef(0x28373599, inheritAt = 0)] public sealed partial class UpdateUserEmojiStatus : UpdateUser { /// New emoji status @@ -5946,7 +5946,7 @@ namespace TL public override void SetPTS(int new_qts, int _) => qts = new_qts; } /// Users may also choose to display messages from all topics as if they were sent to a normal group, using a "View as messages" setting in the local client.
This setting only affects the current account, and is synced to other logged in sessions using the Channels_ToggleViewForumAsMessages method; invoking this method will update the value of the view_forum_as_messages flag of or and emit an . See
- [TLDef(0x07B68920, inheritBefore = true)] + [TLDef(0x07B68920, inheritAt = 0)] public sealed partial class UpdateChannelViewForumAsMessages : UpdateChannel { /// The new value of the toggle. @@ -6080,7 +6080,7 @@ namespace TL public MessageBase message; } /// One or more messages in a quick reply shortcut » were deleted. See - [TLDef(0x566FE7CD, inheritBefore = true)] + [TLDef(0x566FE7CD, inheritAt = 0)] public sealed partial class UpdateDeleteQuickReplyMessages : UpdateDeleteQuickReply { /// IDs of the deleted messages. @@ -7272,7 +7272,7 @@ namespace TL public DateTime date; } /// Message with a file enclosure sent to a protected chat See - [TLDef(0x9493FF32, inheritBefore = true)] + [TLDef(0x9493FF32, inheritAt = 0)] public sealed partial class Messages_SentEncryptedFile : Messages_SentEncryptedMessage { /// Attached file @@ -9026,28 +9026,28 @@ namespace TL [TLDef(0x28A20571)] public sealed partial class MessageEntityCode : MessageEntity { } /// Message entity representing a preformatted codeblock, allowing the user to specify a programming language for the codeblock. See - [TLDef(0x73924BE0, inheritBefore = true)] + [TLDef(0x73924BE0, inheritAt = 0)] public sealed partial class MessageEntityPre : MessageEntity { /// Programming language of the code public string language; } /// Message entity representing a text url: for in-text urls like https://google.com use . See - [TLDef(0x76A6D327, inheritBefore = true)] + [TLDef(0x76A6D327, inheritAt = 0)] public sealed partial class MessageEntityTextUrl : MessageEntity { /// The actual URL public string url; } /// Message entity representing a user mention: for creating a mention use . See - [TLDef(0xDC7B1140, inheritBefore = true)] + [TLDef(0xDC7B1140, inheritAt = 0)] public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned public long user_id; } /// Message entity that can be used to create a user user mention: received mentions use the , instead. See - [TLDef(0x208E68C9, inheritBefore = true)] + [TLDef(0x208E68C9, inheritAt = 0)] public sealed partial class InputMessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned @@ -9072,7 +9072,7 @@ namespace TL [TLDef(0x32CA960F)] public sealed partial class MessageEntitySpoiler : MessageEntity { } /// Represents a custom emoji.
Note that this entity must wrap exactly one regular emoji (the one contained in .alt) in the related text, otherwise the server will ignore it. See
- [TLDef(0xC8CF05F8, inheritBefore = true)] + [TLDef(0xC8CF05F8, inheritAt = 0)] public sealed partial class MessageEntityCustomEmoji : MessageEntity { /// Document ID of the custom emoji, use Messages_GetCustomEmojiDocuments to fetch the emoji animation and the actual emoji it represents. @@ -12993,28 +12993,28 @@ namespace TL [TLDef(0x46E1D13D)] public sealed partial class RecentMeUrlUnknown : RecentMeUrl { } /// Recent t.me link to a user See - [TLDef(0xB92C09E2, inheritBefore = true)] + [TLDef(0xB92C09E2, inheritAt = 0)] public sealed partial class RecentMeUrlUser : RecentMeUrl { /// User ID public long user_id; } /// Recent t.me link to a chat See - [TLDef(0xB2DA71D2, inheritBefore = true)] + [TLDef(0xB2DA71D2, inheritAt = 0)] public sealed partial class RecentMeUrlChat : RecentMeUrl { /// Chat ID public long chat_id; } /// Recent t.me invite link to a chat See - [TLDef(0xEB49081D, inheritBefore = true)] + [TLDef(0xEB49081D, inheritAt = 0)] public sealed partial class RecentMeUrlChatInvite : RecentMeUrl { /// Chat invitation public ChatInviteBase chat_invite; } /// Recent t.me stickerset installation URL See - [TLDef(0xBC0A57DC, inheritBefore = true)] + [TLDef(0xBC0A57DC, inheritAt = 0)] public sealed partial class RecentMeUrlStickerSet : RecentMeUrl { /// Stickerset @@ -13881,14 +13881,14 @@ namespace TL public string num; } /// Ordered list of text items See - [TLDef(0x5E068047, inheritBefore = true)] + [TLDef(0x5E068047, inheritAt = 0)] public sealed partial class PageListOrderedItemText : PageListOrderedItem { /// Text public RichText text; } /// Ordered list of IV blocks See - [TLDef(0x98DD8936, inheritBefore = true)] + [TLDef(0x98DD8936, inheritAt = 0)] public sealed partial class PageListOrderedItemBlocks : PageListOrderedItem { /// Item contents @@ -15864,7 +15864,7 @@ namespace TL } /// Messages found and affected by changes See - [TLDef(0xEF8D3E6C, inheritBefore = true)] + [TLDef(0xEF8D3E6C, inheritAt = 0)] public sealed partial class Messages_AffectedFoundMessages : Messages_AffectedHistory { /// Affected message IDs @@ -16077,7 +16077,7 @@ namespace TL [TLDef(0x3FD863D1)] public sealed partial class BotCommandScopePeerAdmins : BotCommandScopePeer { } /// The specified bot commands will be valid only for a specific user in the specified group or supergroup. See - [TLDef(0x0A1321F3, inheritBefore = true)] + [TLDef(0x0A1321F3, inheritAt = 0)] public sealed partial class BotCommandScopePeerUser : BotCommandScopePeer { /// The user @@ -17366,7 +17366,7 @@ namespace TL public string email; } /// The email was verified correctly, and a login code was just sent to it. See - [TLDef(0xE1BB0D61, inheritBefore = true)] + [TLDef(0xE1BB0D61, inheritAt = 0)] public sealed partial class Account_EmailVerifiedLogin : Account_EmailVerified { /// Info about the sent login code @@ -22484,13 +22484,13 @@ namespace TL public DataJSON client_data; } /// See - [TLDef(0x3E63935C, inheritBefore = true)] + [TLDef(0x3E63935C, inheritAt = 0)] public sealed partial class InputPasskeyResponseRegister : InputPasskeyResponse { public byte[] attestation_data; } /// See - [TLDef(0xC31FC14A, inheritBefore = true)] + [TLDef(0xC31FC14A, inheritAt = 0)] public sealed partial class InputPasskeyResponseLogin : InputPasskeyResponse { public byte[] authenticator_data; @@ -22532,7 +22532,7 @@ namespace TL public int duration; } /// See - [TLDef(0x0AA021E5, inheritBefore = true)] + [TLDef(0x0AA021E5, inheritAt = 0)] public sealed partial class StarGiftAuctionRoundExtendable : StarGiftAuctionRound { public int extend_top; diff --git a/src/TL.Secret.cs b/src/TL.Secret.cs index 0bc2a97..4988782 100644 --- a/src/TL.Secret.cs +++ b/src/TL.Secret.cs @@ -571,7 +571,7 @@ namespace TL } /// Message entity representing a user mention: for creating a mention use . See - [TLDef(0x352DCA58, inheritBefore = true)] + [TLDef(0x352DCA58, inheritAt = 0)] public sealed partial class MessageEntityMentionName : MessageEntity { /// Identifier of the user that was mentioned diff --git a/src/TL.cs b/src/TL.cs index 0bb4583..2f12b19 100644 --- a/src/TL.cs +++ b/src/TL.cs @@ -24,7 +24,7 @@ namespace TL public sealed class TLDefAttribute(uint ctorNb) : Attribute { public readonly uint CtorNb = ctorNb; - public bool inheritBefore; + public int inheritAt = -1; } [AttributeUsage(AttributeTargets.Field)] @@ -68,8 +68,7 @@ namespace TL var tlDef = type.GetCustomAttribute(); var ctorNb = tlDef.CtorNb; writer.Write(ctorNb); - IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); - if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + var fields = GetTLFields(type, tlDef); ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -98,8 +97,7 @@ namespace TL if (type == null) return null; // nullable ctor (class meaning is associated with null) var tlDef = type.GetCustomAttribute(); var obj = Activator.CreateInstance(type, true); - IEnumerable fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public); - if (tlDef.inheritBefore) fields = fields.GroupBy(f => f.DeclaringType).Reverse().SelectMany(g => g); + var fields = GetTLFields(type, tlDef); ulong flags = 0; IfFlagAttribute ifFlag; foreach (var field in fields) @@ -115,6 +113,16 @@ namespace TL #endif } +#if !MTPG + static IEnumerable GetTLFields(Type type, TLDefAttribute tlDef) + { + if (!(tlDef?.inheritAt >= 0)) return type.GetFields(BindingFlags.Instance | BindingFlags.Public); + var fields = type.GetFields(BindingFlags.Instance | BindingFlags.Public | BindingFlags.DeclaredOnly); + if (type.IsAbstract || type.BaseType == typeof(IObject)) return fields; + var subfields = GetTLFields(type.BaseType, type.BaseType.GetCustomAttribute()); + return fields.Take(tlDef.inheritAt).Concat(subfields).Concat(fields.Skip(tlDef.inheritAt)); + } +#else public static IMethod ReadTLMethod(this BinaryReader reader) { uint ctorNb = reader.ReadUInt32(); @@ -125,6 +133,7 @@ namespace TL method = new BoolMethod { query = method }; return (IMethod)method; } +#endif internal static void WriteTLValue(this BinaryWriter writer, object value, Type valueType) { @@ -490,6 +499,10 @@ namespace TL public sealed class BoolMethod : IMethod { public IObject query; +#if MTPG public void WriteTL(BinaryWriter writer) => query.WriteTL(writer); +#else + public void WriteTL(BinaryWriter writer) => writer.WriteTLObject(query); +#endif } } From 59425a910a005e57df01d428de9b40dc361b5af3 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Mon, 2 Mar 2026 18:28:15 +0100 Subject: [PATCH 333/336] api doc --- src/TL.Schema.cs | 84 ++++++++++++++++++++++++++++++++++--------- src/TL.SchemaFuncs.cs | 71 +++++++++++++++++++----------------- 2 files changed, 105 insertions(+), 50 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index e5d7470..cd05e81 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -119,6 +119,7 @@ namespace TL [TLDef(0x6A1DC4BE)] public sealed partial class InputPhoneContact : InputContact { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// An arbitrary 64-bit integer: it should be set, for example, to an incremental number when using Contacts_ImportContacts, in order to retry importing only the contacts that weren't imported successfully, according to the client_ids returned in .retry_contacts. public long client_id; @@ -171,7 +172,7 @@ namespace TL public InputDocument id; } - /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , + /// Defines media content of a message. See Derived classes: , , , , , , , , , , , , , , , , , , /// a value means inputMediaEmpty public abstract partial class InputMedia : IObject { } /// Photo See @@ -2072,7 +2073,7 @@ namespace TL public override int TtlPeriod => ttl_period; } - /// Media See Derived classes: , , , , , , , , , , , , , , , , + /// Media See Derived classes: , , , , , , , , , , , , , , , , , /// a value means messageMediaEmpty public abstract partial class MessageMedia : IObject { } /// Attached photo. See @@ -2280,6 +2281,7 @@ namespace TL [TLDef(0x08CBEC07)] public sealed partial class MessageMediaDice : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Dice value public int value; @@ -2424,6 +2426,7 @@ namespace TL [TLDef(0xCA5CAB89)] public sealed partial class MessageMediaVideoStream : MessageMedia { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public InputGroupCallBase call; @@ -2433,7 +2436,7 @@ namespace TL } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -3285,6 +3288,7 @@ namespace TL [TLDef(0x774278D4)] public sealed partial class MessageActionStarGiftPurchaseOffer : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; public StarsAmountBase price; @@ -3300,6 +3304,7 @@ namespace TL [TLDef(0x73ADA76B)] public sealed partial class MessageActionStarGiftPurchaseOfferDeclined : MessageAction { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public StarGiftBase gift; public StarsAmountBase price; @@ -4470,7 +4475,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4517,6 +4522,7 @@ namespace TL [TLDef(0x2A17BF5C)] public sealed partial class UpdateUserTyping : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// User id public long user_id; @@ -6317,6 +6323,7 @@ namespace TL [TLDef(0x683B2C52)] public sealed partial class UpdatePinnedForumTopic : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public int topic_id; @@ -6330,12 +6337,14 @@ namespace TL [TLDef(0xDEF143D0)] public sealed partial class UpdatePinnedForumTopics : Update { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; [IfFlag(0)] public int[] order; [Flags] public enum Flags : uint { + /// Field has a value has_order = 0x1, } } @@ -7375,7 +7384,7 @@ namespace TL public int top_msg_id; } - /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , + /// User actions. Use this to provide users with detailed info about their chat partner's actions: typing or sending attachments of all kinds. See Derived classes: , , , , , , , , , , , , , , , , , , public abstract partial class SendMessageAction : IObject { } /// User is typing. See [TLDef(0x16BF744E)] @@ -7926,7 +7935,7 @@ namespace TL public string display_url; /// Hash used for caching, for more info click here public int hash; - /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

+ /// Type of the web page. One of the following:

- app
- article
- document
- gif
- photo
- profile
- telegram_album
- telegram_auction
- telegram_background
- telegram_bot
- telegram_botapp
- telegram_call
- telegram_channel
- telegram_channel_boost
- telegram_channel_direct
- telegram_channel_request
- telegram_chat
- telegram_chat_request
- telegram_chatlist
- telegram_collection
- telegram_community
- telegram_giftcode
- telegram_group_boost
- telegram_livestream
- telegram_megagroup
- telegram_megagroup_request
- telegram_message
- telegram_nft
- telegram_stickerset
- telegram_story
- telegram_story_album
- telegram_theme
- telegram_user
- telegram_videochat
- telegram_voicechat
- video

[IfFlag(0)] public string type; /// Short name of the site (e.g., Google Docs, App Store) [IfFlag(1)] public string site_name; @@ -8506,6 +8515,7 @@ namespace TL [TLDef(0x7D170CFF)] public sealed partial class KeyboardButton : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8525,6 +8535,7 @@ namespace TL [TLDef(0xD80C25EC)] public sealed partial class KeyboardButtonUrl : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button label @@ -8570,6 +8581,7 @@ namespace TL [TLDef(0x417EFD8F)] public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8589,6 +8601,7 @@ namespace TL [TLDef(0xAA40F94D)] public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8636,6 +8649,7 @@ namespace TL [TLDef(0x89C590F9)] public sealed partial class KeyboardButtonGame : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8655,6 +8669,7 @@ namespace TL [TLDef(0x3FA53905)] public sealed partial class KeyboardButtonBuy : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8756,6 +8771,7 @@ namespace TL [TLDef(0x7D5E07C7)] public sealed partial class InputKeyboardButtonUserProfile : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8777,6 +8793,7 @@ namespace TL [TLDef(0xC0FD5D09)] public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8798,6 +8815,7 @@ namespace TL [TLDef(0xE846B1A0)] public sealed partial class KeyboardButtonWebView : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8819,6 +8837,7 @@ namespace TL [TLDef(0xE15C4370)] public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8840,6 +8859,7 @@ namespace TL [TLDef(0x5B0F15F5)] public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Button text @@ -8897,6 +8917,7 @@ namespace TL [TLDef(0xBCC4AF10)] public sealed partial class KeyboardButtonCopy : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(10)] public KeyboardButtonStyle style; /// Title of the button @@ -14491,6 +14512,7 @@ namespace TL [TLDef(0x623A8FA0)] public sealed partial class UrlAuthResultAccepted : UrlAuthResult { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// The URL name of the website on which the user has logged in. [IfFlag(0)] public string url; @@ -14763,7 +14785,7 @@ namespace TL } } - /// Webpage attributes See Derived classes: , , , , + /// Webpage attributes See Derived classes: , , , , , public abstract partial class WebPageAttribute : IObject { } /// Page theme See [TLDef(0x54B56617)] @@ -16745,7 +16767,7 @@ namespace TL Broadcast = 0x7BFBDEFC, } - /// An invoice See Derived classes: , , , , , , , , , , , + /// An invoice See Derived classes: , , , , , , , , , , , , , , public abstract partial class InputInvoice : IObject { } /// An invoice contained in a message or paid media ». See [TLDef(0xC5B56859)] @@ -16903,6 +16925,7 @@ namespace TL [TLDef(0x1ECAFA10)] public sealed partial class InputInvoiceStarGiftAuctionBid : InputInvoice { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public InputPeer peer; public long gift_id; @@ -16912,8 +16935,10 @@ namespace TL [Flags] public enum Flags : uint { hide_name = 0x1, + /// Field has a value has_message = 0x2, update_bid = 0x4, + /// Field has a value has_peer = 0x8, } } @@ -19172,7 +19197,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// Represents a color palette ». See Derived classes: + /// Represents a color palette ». See Derived classes: , , public abstract partial class PeerColorBase : IObject { } /// Represents a color palette ». See [TLDef(0xB54B5ACF)] @@ -19197,6 +19222,7 @@ namespace TL [TLDef(0xB9C0639A)] public sealed partial class PeerColorCollectible : PeerColorBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public long collectible_id; public long gift_emoji_id; @@ -19208,7 +19234,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_dark_accent_color = 0x1, + /// Field has a value has_dark_colors = 0x2, } } @@ -20254,13 +20282,13 @@ namespace TL { /// Localized description of the option. public string text; - /// Option identifier to pass to Channels_ReportSponsoredMessage. + /// Option identifier to pass to Messages_ReportSponsoredMessage. public byte[] option; } /// Status of the method call used to report a sponsored message ». See Derived classes: , , public abstract partial class Channels_SponsoredMessageReportResult : IObject { } - /// The user must choose a report option from the localized options available in options, and after selection, Channels_ReportSponsoredMessage must be invoked again, passing the option's option field to the option param of the method. See + /// The user must choose a report option from the localized options available in options, and after selection, Messages_ReportSponsoredMessage must be invoked again, passing the option's option field to the option param of the method. See [TLDef(0x846F9E42)] public sealed partial class Channels_SponsoredMessageReportResultChooseOption : Channels_SponsoredMessageReportResult { @@ -21409,6 +21437,7 @@ namespace TL [TLDef(0x565251E2)] public sealed partial class StarGiftAttributeModel : StarGiftAttribute { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; /// Name of the model public string name; @@ -22225,6 +22254,7 @@ namespace TL [TLDef(0x1A8AFC7E)] public sealed partial class GroupCallMessage : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public int id; public Peer from_id; @@ -22234,6 +22264,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_paid_message_stars = 0x1, from_admin = 0x2, } @@ -22243,6 +22274,7 @@ namespace TL [TLDef(0xEE430C85)] public sealed partial class GroupCallDonor : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public Peer peer_id; public long stars; @@ -22251,6 +22283,7 @@ namespace TL { top = 0x1, my = 0x2, + /// Field has a value has_peer_id = 0x8, } } @@ -22271,12 +22304,14 @@ namespace TL [TLDef(0x711D692D)] public sealed partial class RecentStory : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(1)] public int max_id; [Flags] public enum Flags : uint { live = 0x1, + /// Field has a value has_max_id = 0x2, } } @@ -22290,7 +22325,7 @@ namespace TL public DateTime date; } - /// See + /// See Derived classes: , /// a value means starGiftAuctionStateNotModified public abstract partial class StarGiftAuctionStateBase : IObject { @@ -22321,6 +22356,7 @@ namespace TL [TLDef(0x972DABBF)] public sealed partial class StarGiftAuctionStateFinished : StarGiftAuctionStateBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public DateTime start_date; public DateTime end_date; @@ -22331,7 +22367,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_listed_count = 0x1, + /// Fields and have a value has_fragment_listed_count = 0x2, } @@ -22343,6 +22381,7 @@ namespace TL [TLDef(0x2EEED1C4)] public sealed partial class StarGiftAuctionUserState : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(0)] public long bid_amount; [IfFlag(0)] public DateTime bid_date; @@ -22352,6 +22391,7 @@ namespace TL [Flags] public enum Flags : uint { + /// Fields , , and have a value has_bid_amount = 0x1, returned = 0x2, } @@ -22375,6 +22415,7 @@ namespace TL [TLDef(0x42B00348)] public sealed partial class StarGiftAuctionAcquiredGift : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public Peer peer; public DateTime date; @@ -22387,7 +22428,9 @@ namespace TL [Flags] public enum Flags : uint { name_hidden = 0x1, + /// Field has a value has_message = 0x2, + /// Field has a value has_gift_num = 0x4, } } @@ -22424,7 +22467,7 @@ namespace TL public IPeerInfo UserOrChat(Peer peer) => peer?.UserOrChat(users, chats); } - /// See + /// See Derived classes: , public abstract partial class InputStarGiftAuctionBase : IObject { } /// See [TLDef(0x02E16C98)] @@ -22443,6 +22486,7 @@ namespace TL [TLDef(0x98613EBF)] public sealed partial class Passkey : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string id; public string name; @@ -22452,7 +22496,9 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_software_emoji_id = 0x1, + /// Field has a value has_last_usage_date = 0x2, } } @@ -22478,7 +22524,7 @@ namespace TL public DataJSON options; } - /// See + /// See Derived classes: , public abstract partial class InputPasskeyResponse : IObject { public DataJSON client_data; @@ -22498,7 +22544,7 @@ namespace TL public string user_handle; } - /// See + /// See Derived classes: , public abstract partial class InputPasskeyCredential : IObject { } /// See [TLDef(0x3C27B78F)] @@ -22555,7 +22601,7 @@ namespace TL public long ton_amount; } - /// See + /// See Derived classes: , public abstract partial class Messages_EmojiGameInfo : IObject { } /// See [TLDef(0x59E65335)] @@ -22564,6 +22610,7 @@ namespace TL [TLDef(0x44E56023)] public sealed partial class Messages_EmojiGameDiceInfo : Messages_EmojiGameInfo { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; public string game_hash; public long prev_stake; @@ -22573,11 +22620,12 @@ namespace TL [Flags] public enum Flags : uint { + /// Field has a value has_plays_left = 0x1, } } - /// See + /// See Derived classes: , , , , public abstract partial class StarGiftAttributeRarityBase : IObject { } /// See [TLDef(0x36437737)] @@ -22602,6 +22650,7 @@ namespace TL [TLDef(0x4FDD3430)] public sealed partial class KeyboardButtonStyle : IObject { + /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; [IfFlag(3)] public long icon; @@ -22610,6 +22659,7 @@ namespace TL bg_primary = 0x1, bg_danger = 0x2, bg_success = 0x4, + /// Field has a value has_icon = 0x8, } } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index c7ded16..72fb740 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -387,7 +387,7 @@ namespace TL mnc = mnc, }); - /// See + /// See Possible codes: 400 (details) public static Task Auth_CheckPaidAuth(this Client client, string phone_number, string phone_code_hash, long form_id) => client.Invoke(new Auth_CheckPaidAuth { @@ -396,7 +396,7 @@ namespace TL form_id = form_id, }); - /// See + /// See Possible codes: 400,500 (details) public static Task Auth_InitPasskeyLogin(this Client client, int api_id, string api_hash) => client.Invoke(new Auth_InitPasskeyLogin { @@ -404,7 +404,7 @@ namespace TL api_hash = api_hash, }); - /// See + /// See Possible codes: 400,500 (details) public static Task Auth_FinishPasskeyLogin(this Client client, InputPasskeyCredential credential, int? from_dc_id = null, long? from_auth_key_id = null) => client.Invoke(new Auth_FinishPasskeyLogin { @@ -1528,13 +1528,13 @@ namespace TL hash = hash, }); - /// See + /// See Possible codes: 403 (details) public static Task Account_InitPasskeyRegistration(this Client client) => client.Invoke(new Account_InitPasskeyRegistration { }); - /// See + /// See Possible codes: 400 (details) public static Task Account_RegisterPasskey(this Client client, InputPasskeyCredential credential) => client.Invoke(new Account_RegisterPasskey { @@ -1588,7 +1588,7 @@ namespace TL id = id, }); - /// Get songs pinned to the user's profile, see here » for more info. See Possible codes: 400 (details) + /// Get songs pinned to the user's profile, see here » for more info. See [bots: ✓] Possible codes: 400 (details) /// The ID of the user. /// Offset for pagination. /// Maximum number of results to return, see pagination @@ -1612,7 +1612,7 @@ namespace TL documents = documents, }); - /// See + /// See Possible codes: 400 (details) public static Task Users_SuggestBirthday(this Client client, InputUserBase id, Birthday birthday) => client.Invoke(new Users_SuggestBirthday { @@ -1879,7 +1879,7 @@ namespace TL q = q, }); - /// See + /// See Possible codes: 400 (details) public static Task Contacts_UpdateContactNote(this Client client, InputUserBase id, TextWithEntities note) => client.Invoke(new Contacts_UpdateContactNote { @@ -1915,7 +1915,7 @@ namespace TL hash = hash, }); - /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406 (details) + /// Returns the conversation history with one interlocutor / within a chat See Possible codes: 400,406,500 (details) /// Target peer /// Only return messages starting from the specified message ID /// Only return messages sent before the specified date @@ -2243,7 +2243,7 @@ namespace TL user_id = user_id, }); - /// Creates a new chat. See Possible codes: 400,403,500 (details) + /// Creates a new chat. See Possible codes: 400,406,500 (details) /// List of user IDs to be invited /// Chat name /// Time-to-live of all messages that will be sent in the chat: once message.date+message.ttl_period === time(), the message will be deleted on the server, and must be deleted locally as well. You can use Messages_SetDefaultHistoryTTL to edit this value later. @@ -2290,7 +2290,7 @@ namespace TL key_fingerprint = key_fingerprint, }); - /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400 (details) + /// Cancels a request for creation and/or delete info on secret chat. See Possible codes: 400,500 (details) /// Whether to delete the entire chat history for the other user as well /// Secret chat ID public static Task Messages_DiscardEncryption(this Client client, int chat_id, bool delete_history = false) @@ -3085,7 +3085,7 @@ namespace TL hash = hash, }); - /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,420,500 (details) + /// Send an album or grouped media See [bots: ✓] Possible codes: 400,403,406,420,500 (details) /// Whether to send the album silently (no notification triggered) /// Send in background? /// Whether to clear drafts @@ -4863,7 +4863,7 @@ namespace TL { }); - /// See + /// See Possible codes: 400 (details) public static Task Messages_SummarizeText(this Client client, InputPeer peer, int id, string to_lang = null) => client.Invoke(new Messages_SummarizeText { @@ -5367,7 +5367,7 @@ namespace TL channel = channel, }); - /// Create a supergroup/channel. See Possible codes: 400,403,500 (details) + /// Create a supergroup/channel. See Possible codes: 400,406,500 (details) /// Whether to create a channel /// Whether to create a supergroup /// Whether the supergroup is being created to import messages from a foreign chat service using Messages_InitHistoryImport @@ -5842,7 +5842,7 @@ namespace TL restricted = restricted, }); - /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 420 (details) + /// Globally search for posts from public channels » (including those we aren't a member of) containing either a specific hashtag, or a full text query. See Possible codes: 403,420 (details) /// The hashtag to search, without the # character. /// The full text query: each user has a limited amount of free full text search slots, after which payment is required, see here » for more info on the full flow. /// Initially 0, then set to the next_rate parameter of messages.messagesSlice, or if that is absent, the date of the last returned message. @@ -5914,7 +5914,7 @@ namespace TL tab = tab, }); - /// See + /// See Possible codes: 400 (details) public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) => client.Invoke(new Channels_GetFutureCreatorAfterLeave { @@ -6674,7 +6674,7 @@ namespace TL slug = slug, }); - /// Fetch the full list of gifts owned by a peer. See Possible codes: 400 (details) + /// Fetch the full list of gifts owned by a peer. See [bots: ✓] Possible codes: 400 (details) /// Exclude gifts not pinned on the profile. /// Exclude gifts pinned on the profile. /// Exclude gifts that do not have the .limited flag set. @@ -6849,7 +6849,7 @@ namespace TL gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftAuctionState(this Client client, InputStarGiftAuctionBase auction, int version) => client.Invoke(new Payments_GetStarGiftAuctionState { @@ -6857,7 +6857,7 @@ namespace TL version = version, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftAuctionAcquiredGifts(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftAuctionAcquiredGifts { @@ -6872,7 +6872,7 @@ namespace TL hash = hash, }); - /// See + /// See [bots: ✓] Possible codes: 400 (details) public static Task Payments_ResolveStarGiftOffer(this Client client, int offer_msg_id, bool decline = false) => client.Invoke(new Payments_ResolveStarGiftOffer { @@ -6880,7 +6880,8 @@ namespace TL offer_msg_id = offer_msg_id, }); - /// See + /// See Possible codes: 400 (details) + /// You can use public static Task Payments_SendStarGiftOffer(this Client client, InputPeer peer, string slug, StarsAmountBase price, int duration, long random_id, long? allow_paid_stars = null) => client.Invoke(new Payments_SendStarGiftOffer { @@ -6893,14 +6894,15 @@ namespace TL allow_paid_stars = allow_paid_stars ?? default, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_GetStarGiftUpgradeAttributes(this Client client, long gift_id) => client.Invoke(new Payments_GetStarGiftUpgradeAttributes { gift_id = gift_id, }); - /// See + /// See Possible codes: 400 (details) + /// Maximum number of results to return, see pagination public static Task Payments_GetCraftStarGifts(this Client client, long gift_id, string offset, int limit = int.MaxValue) => client.Invoke(new Payments_GetCraftStarGifts { @@ -6909,7 +6911,7 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) public static Task Payments_CraftStarGift(this Client client, params InputSavedStarGift[] stargift) => client.Invoke(new Payments_CraftStarGift { @@ -7052,7 +7054,7 @@ namespace TL { }); - /// Start a telegram phone call See Possible codes: 400,403 (details) + /// Start a telegram phone call See Possible codes: 400,403,500 (details) /// Whether to start a video call /// Destination of the phone call /// Random ID to avoid resending the same object @@ -7168,7 +7170,7 @@ namespace TL schedule_date = schedule_date ?? default, }); - /// Join a group call See Possible codes: 400,403 (details) + /// Join a group call See Possible codes: 400,403,500 (details) /// If set, the user will be muted by default upon joining. /// If set, the user's video will be disabled by default upon joining. /// The group call @@ -7485,7 +7487,8 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) + /// You can use public static Task Phone_SendGroupCallMessage(this Client client, InputGroupCallBase call, long random_id, TextWithEntities message, long? allow_paid_stars = null, InputPeer send_as = null) => client.Invoke(new Phone_SendGroupCallMessage { @@ -7497,7 +7500,7 @@ namespace TL send_as = send_as, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_SendGroupCallEncryptedMessage(this Client client, InputGroupCallBase call, byte[] encrypted_message) => client.Invoke(new Phone_SendGroupCallEncryptedMessage { @@ -7505,7 +7508,7 @@ namespace TL encrypted_message = encrypted_message, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_DeleteGroupCallMessages(this Client client, InputGroupCallBase call, int[] messages, bool report_spam = false) => client.Invoke(new Phone_DeleteGroupCallMessages { @@ -7514,7 +7517,7 @@ namespace TL messages = messages, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_DeleteGroupCallParticipantMessages(this Client client, InputGroupCallBase call, InputPeer participant, bool report_spam = false) => client.Invoke(new Phone_DeleteGroupCallParticipantMessages { @@ -7523,14 +7526,14 @@ namespace TL participant = participant, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_GetGroupCallStars(this Client client, InputGroupCallBase call) => client.Invoke(new Phone_GetGroupCallStars { call = call, }); - /// See + /// See Possible codes: 400 (details) public static Task Phone_SaveDefaultSendAs(this Client client, InputGroupCallBase call, InputPeer send_as) => client.Invoke(new Phone_SaveDefaultSendAs { @@ -8180,7 +8183,9 @@ namespace TL limit = limit, }); - /// See + /// See Possible codes: 400 (details) + /// Message entities for styled text + /// You can use public static Task Stories_StartLive(this Client client, InputPeer peer, InputPrivacyRule[] privacy_rules, long random_id, string caption = null, MessageEntity[] entities = null, bool? messages_enabled = default, long? send_paid_messages_stars = null, bool pinned = false, bool noforwards = false, bool rtmp_stream = false) => client.Invoke(new Stories_StartLive { From f8b0fd48b1154523039f5369680d4b55d8c1fe58 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Tue, 3 Mar 2026 12:45:45 +0100 Subject: [PATCH 334/336] Update to Telegram API layer 223 - New types (e.g., MessageActionNoForwardsToggle, UpdateChatParticipantRank, MessageEntityFormattedDate) - New methods (e.g., Messages_EditChatCreator, Messages_EditChatParticipantRank). - Enhanced URL auth and admin methods with new parameters and flags. - Refactored keyboard button and MediaArea types for improved inheritance. --- README.md | 2 +- src/TL.Schema.cs | 397 ++++++++++++++----------------------- src/TL.SchemaFuncs.cs | 152 ++++++++++---- src/TL.Table.cs | 23 ++- src/WTelegramClient.csproj | 4 +- 5 files changed, 276 insertions(+), 302 deletions(-) diff --git a/README.md b/README.md index d0baa0d..05aecf3 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -[![API Layer](https://img.shields.io/badge/API_Layer-222-blueviolet)](https://corefork.telegram.org/methods) +[![API Layer](https://img.shields.io/badge/API_Layer-223-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 cd05e81..6f8ea40 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -1689,33 +1689,54 @@ namespace TL { /// Member user ID public virtual long UserId => default; + public virtual string Rank => default; } /// Group member. See - [TLDef(0xC02D4007)] + [TLDef(0x38E79FDE)] public partial class ChatParticipant : ChatParticipantBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; /// Member user ID public long user_id; /// ID of the user that added the member to the group public long inviter_id; /// Date added to the group public DateTime date; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_rank = 0x1, + } /// Member user ID public override long UserId => user_id; + public override string Rank => rank; } /// Represents the creator of the group See - [TLDef(0xE46BCEE4)] + [TLDef(0xE1F867B8)] public sealed partial class ChatParticipantCreator : ChatParticipantBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; /// ID of the user that created the group public long user_id; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_rank = 0x1, + } /// ID of the user that created the group public override long UserId => user_id; + public override string Rank => rank; } /// Chat admin See - [TLDef(0xA0933F5B)] + [TLDef(0x0360D5D2)] public sealed partial class ChatParticipantAdmin : ChatParticipant { } @@ -1827,7 +1848,7 @@ namespace TL public override Peer Peer => peer_id; } /// A message See - [TLDef(0x9CB490E9)] + [TLDef(0x3AE56482)] public sealed partial class Message : MessageBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -1840,6 +1861,7 @@ namespace TL [IfFlag(8)] public Peer from_id; /// Supergroups only, contains the number of boosts this user has given the current supergroup, and should be shown in the UI in the header of the message.
Only present for incoming messages from non-anonymous supergroup members that have boosted the supergroup.
Note that this counter should be locally overridden for non-anonymous outgoing messages, according to the current value of .boosts_applied, to ensure the value is correct even for messages sent by the current user before a supergroup was boosted (or after a boost has expired or the number of boosts has changed); do not update this value for incoming messages from other users, even if their boosts have changed.
[IfFlag(29)] public int from_boosts_applied; + [IfFlag(44)] public string from_rank; /// Peer ID, the chat where this message was sent public Peer peer_id; /// Messages from a saved messages dialog » will have peer= and the saved_peer_id flag set to the ID of the saved dialog.
Messages from a monoforum » will have peer=ID of the monoforum and the saved_peer_id flag set to the ID of a topic.
@@ -1983,6 +2005,8 @@ namespace TL has_schedule_repeat_period = 0x400, /// Field has a value has_summary_from_language = 0x800, + /// Field has a value + has_from_rank = 0x1000, } /// ID of the message @@ -2099,7 +2123,7 @@ namespace TL } /// Attached map. See [TLDef(0x56E0D474)] - public sealed partial class MessageMediaGeo : MessageMedia + public partial class MessageMediaGeo : MessageMedia { /// GeoPoint public GeoPoint geo; @@ -2246,13 +2270,11 @@ namespace TL } } /// Indicates a live geolocation See - [TLDef(0xB940C666)] - public sealed partial class MessageMediaGeoLive : MessageMedia + [TLDef(0xB940C666, inheritAt = 1)] + public sealed partial class MessageMediaGeoLive : MessageMediaGeo { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// Geolocation - public GeoPoint geo; /// For live locations, a direction in which the location moves, in degrees; 1-360 [IfFlag(0)] public int heading; /// Validity period of provided geolocation @@ -2436,7 +2458,7 @@ namespace TL } } - /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object describing actions connected to a service message. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , /// a value means messageActionEmpty public abstract partial class MessageAction : IObject { } /// Group created See @@ -3326,6 +3348,27 @@ namespace TL { public long new_creator_id; } + /// See + [TLDef(0xBF7D6572)] + public sealed partial class MessageActionNoForwardsToggle : MessageAction + { + public bool prev_value; + public bool new_value; + } + /// See + [TLDef(0x3E2793BA)] + public sealed partial class MessageActionNoForwardsRequest : MessageAction + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + public bool prev_value; + public bool new_value; + + [Flags] public enum Flags : uint + { + expired = 0x1, + } + } /// Chat info. See Derived classes: , public abstract partial class DialogBase : IObject @@ -4148,6 +4191,8 @@ namespace TL has_saved_music = 0x200000, /// Field has a value has_note = 0x400000, + noforwards_my_enabled = 0x800000, + noforwards_peer_enabled = 0x1000000, } } @@ -4475,7 +4520,7 @@ namespace TL [TLDef(0x1BB00451)] public sealed partial class InputMessagesFilterPinned : MessagesFilter { } - /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Object contains info on events occurred. See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class Update : IObject { public virtual (long mbox_id, int pts, int pts_count) GetMBox() => default; @@ -4894,25 +4939,15 @@ namespace TL public Messages_StickerSet stickerset; } /// The order of stickersets was changed See - [TLDef(0x0BB2D201)] - public sealed partial class UpdateStickerSetsOrder : Update + [TLDef(0x0BB2D201, inheritAt = 0)] + public sealed partial class UpdateStickerSetsOrder : UpdateStickerSets { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; /// New sticker order by sticker ID public long[] order; - - [Flags] public enum Flags : uint - { - /// Whether the updated stickers are mask stickers - masks = 0x1, - /// Whether the updated stickers are custom emoji stickers - emojis = 0x2, - } } /// Installed stickersets have changed, the client should refetch them as described in the docs. See [TLDef(0x31C24808)] - public sealed partial class UpdateStickerSets : Update + public partial class UpdateStickerSets : Update { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -6378,6 +6413,14 @@ namespace TL /// See [TLDef(0xAC072444)] public sealed partial class UpdateStarGiftCraftFail : Update { } + /// See + [TLDef(0xBD8367B9, inheritAt = 0)] + public sealed partial class UpdateChatParticipantRank : UpdateChat + { + public long user_id; + public string rank; + public int version; + } /// Updates state. See [TLDef(0xA56C2A3E)] @@ -8513,7 +8556,7 @@ namespace TL } /// Bot keyboard button See [TLDef(0x7D170CFF)] - public sealed partial class KeyboardButton : KeyboardButtonBase + public partial class KeyboardButton : KeyboardButtonBase { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; @@ -8532,26 +8575,11 @@ namespace TL public override string Text => text; } /// URL button See - [TLDef(0xD80C25EC)] - public sealed partial class KeyboardButtonUrl : KeyboardButtonBase + [TLDef(0xD80C25EC, inheritAt = 0)] + public sealed partial class KeyboardButtonUrl : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button label - public string text; /// URL public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button label - public override string Text => text; } /// Callback button See [TLDef(0xE62BC960)] @@ -8579,43 +8607,13 @@ namespace TL } /// Button to request a user's phone number See [TLDef(0x417EFD8F)] - public sealed partial class KeyboardButtonRequestPhone : KeyboardButtonBase + public sealed partial class KeyboardButtonRequestPhone : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to request a user's geolocation See [TLDef(0xAA40F94D)] - public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButtonBase + public sealed partial class KeyboardButtonRequestGeoLocation : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to force a user to switch to inline mode: pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. See [TLDef(0x991399FC)] @@ -8647,71 +8645,24 @@ namespace TL } /// Button to start a game See [TLDef(0x89C590F9)] - public sealed partial class KeyboardButtonGame : KeyboardButtonBase + public sealed partial class KeyboardButtonGame : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to buy a product See [TLDef(0x3FA53905)] - public sealed partial class KeyboardButtonBuy : KeyboardButtonBase + public sealed partial class KeyboardButtonBuy : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0xF51006F9)] - public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase + [TLDef(0xF51006F9, inheritAt = 0)] + public sealed partial class KeyboardButtonUrlAuth : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button label - public string text; /// New text of the button in forwarded messages. - [IfFlag(0)] public string fwd_text; + public string fwd_text; /// An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.

NOTE: Services must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
public string url; /// ID of the button to pass to Messages_RequestUrlAuth public int button_id; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_fwd_text = 0x1, - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button label - public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0x68013E72)] @@ -8790,96 +8741,34 @@ namespace TL public override string Text => text; } /// Button that links directly to a user profile See - [TLDef(0xC0FD5D09)] - public sealed partial class KeyboardButtonUserProfile : KeyboardButtonBase + [TLDef(0xC0FD5D09, inheritAt = 0)] + public sealed partial class KeyboardButtonUserProfile : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// User ID public long user_id; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to open a bot mini app using Messages_RequestWebView, sending over user information after user confirmation. See - [TLDef(0xE846B1A0)] - public sealed partial class KeyboardButtonWebView : KeyboardButtonBase + [TLDef(0xE846B1A0, inheritAt = 0)] + public partial class KeyboardButtonWebView : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// Web app url public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Button to open a bot mini app using Messages_RequestSimpleWebView, without sending user information to the web app. See [TLDef(0xE15C4370)] - public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonBase + public sealed partial class KeyboardButtonSimpleWebView : KeyboardButtonWebView { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; - /// Web app URL - public string url; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } /// Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer See - [TLDef(0x5B0F15F5)] - public sealed partial class KeyboardButtonRequestPeer : KeyboardButtonBase + [TLDef(0x5B0F15F5, inheritAt = 0)] + public sealed partial class KeyboardButtonRequestPeer : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Button text - public string text; /// Button ID, to be passed to Messages_SendBotRequestedPeer. public int button_id; /// Filtering criteria to use for the peer selection list shown to the user.
The list should display all existing peers of the specified type, and should also offer an option for the user to create and immediately use one or more (up to max_quantity) peers of the specified type, if needed.
public RequestPeerType peer_type; /// Maximum number of peers that can be chosen. public int max_quantity; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Button text - public override string Text => text; } ///
Prompts the user to select and share one or more peers with the bot using Messages_SendBotRequestedPeer. See [TLDef(0x02B78156)] @@ -8914,26 +8803,11 @@ namespace TL public override string Text => text; } /// Clipboard button: when clicked, the attached text must be copied to the clipboard. See - [TLDef(0xBCC4AF10)] - public sealed partial class KeyboardButtonCopy : KeyboardButtonBase + [TLDef(0xBCC4AF10, inheritAt = 0)] + public sealed partial class KeyboardButtonCopy : KeyboardButton { - /// Extra bits of information, use flags.HasFlag(...) to test for those - public Flags flags; - [IfFlag(10)] public KeyboardButtonStyle style; - /// Title of the button - public string text; /// The text that will be copied to the clipboard public string copy_text; - - [Flags] public enum Flags : uint - { - /// Field has a value - has_style = 0x400, - } - - public override KeyboardButtonStyle Style => style; - /// Title of the button - public override string Text => text; } /// Inline keyboard row See @@ -9011,7 +8885,7 @@ namespace TL public KeyboardButtonRow[] rows; } - /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , + /// Message entities, representing styled text in a message See Derived classes: , , , , , , , , , , , , , , , , , , , , , public abstract partial class MessageEntity : IObject { /// Offset of message entity within message (in UTF-16 code units) @@ -9112,6 +8986,24 @@ namespace TL collapsed = 0x1, } } + /// See + [TLDef(0x904AC7C7, inheritAt = 1)] + public sealed partial class MessageEntityFormattedDate : MessageEntity + { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + public DateTime date; + + [Flags] public enum Flags : uint + { + relative = 0x1, + short_time = 0x2, + long_time = 0x4, + short_date = 0x8, + long_date = 0x10, + day_of_week = 0x20, + } + } /// Represents a channel See Derived classes: , /// a value means inputChannelEmpty @@ -9275,7 +9167,7 @@ namespace TL /// Channel participant See Derived classes: , , , , , public abstract partial class ChannelParticipantBase : IObject { } /// Channel/supergroup participant See - [TLDef(0xCB397619)] + [TLDef(0x1BD54456)] public sealed partial class ChannelParticipant : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9286,15 +9178,18 @@ namespace TL public DateTime date; /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(0)] public DateTime subscription_until_date; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { /// Field has a value has_subscription_until_date = 0x1, + /// Field has a value + has_rank = 0x4, } } /// Myself See - [TLDef(0x4F607BEF)] + [TLDef(0xA9478A1A)] public sealed partial class ChannelParticipantSelf : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9307,6 +9202,7 @@ namespace TL public DateTime date; /// If set, contains the expiration date of the current Telegram Star subscription period » for the specified participant. [IfFlag(1)] public DateTime subscription_until_date; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { @@ -9314,6 +9210,8 @@ namespace TL via_request = 0x1, /// Field has a value has_subscription_until_date = 0x2, + /// Field has a value + has_rank = 0x4, } } /// Channel/supergroup creator See @@ -9365,7 +9263,7 @@ namespace TL } } /// Banned/kicked user See - [TLDef(0x6DF8014E)] + [TLDef(0xD5F0AD91)] public sealed partial class ChannelParticipantBanned : ChannelParticipantBase { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -9378,11 +9276,14 @@ namespace TL public DateTime date; /// Banned rights public ChatBannedRights banned_rights; + [IfFlag(2)] public string rank; [Flags] public enum Flags : uint { /// Whether the user has left the group left = 0x1, + /// Field has a value + has_rank = 0x4, } } /// A participant that left the channel/supergroup See @@ -12499,7 +12400,7 @@ namespace TL } } - /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , + /// Channel admin log event See Derived classes: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , public abstract partial class ChannelAdminLogEventAction : IObject { } /// Channel/supergroup title was changed See [TLDef(0xE6DFB825)] @@ -12902,6 +12803,14 @@ namespace TL /// New value of the toggle public bool new_value; } + /// See + [TLDef(0x5806B4EC)] + public sealed partial class ChannelAdminLogEventActionParticipantEditRank : ChannelAdminLogEventAction + { + public long user_id; + public string prev_rank; + public string new_rank; + } /// Admin log event See [TLDef(0x1FAD68CD)] @@ -12978,6 +12887,7 @@ namespace TL forums = 0x20000, /// Telegram Star subscription extension events » sub_extend = 0x40000, + edit_rank = 0x80000, } } @@ -14158,6 +14068,7 @@ namespace TL delete_stories = 0x10000, /// If set, allows the admin to manage the direct messages monoforum » and decline suggested posts ». manage_direct_messages = 0x20000, + manage_ranks = 0x40000, } } @@ -14212,6 +14123,7 @@ namespace TL send_docs = 0x1000000, /// If set, does not allow a user to send text messages in a supergroup/chat. send_plain = 0x2000000, + edit_rank = 0x4000000, } } @@ -14485,7 +14397,7 @@ namespace TL /// a value means urlAuthResultDefault public abstract partial class UrlAuthResult : IObject { } /// Details about the authorization request, for more info click here » See - [TLDef(0x32FABF1A)] + [TLDef(0xF8F8EB1E)] public sealed partial class UrlAuthResultRequest : UrlAuthResult { /// Extra bits of information, use flags.HasFlag(...) to test for those @@ -14498,6 +14410,8 @@ namespace TL [IfFlag(2)] public string platform; [IfFlag(2)] public string ip; [IfFlag(2)] public string region; + [IfFlag(3)] public string[] match_codes; + [IfFlag(4)] public long user_id_hint; [Flags] public enum Flags : uint { @@ -14506,6 +14420,11 @@ namespace TL request_phone_number = 0x2, /// Fields , , and have a value has_browser = 0x4, + /// Field has a value + has_match_codes = 0x8, + /// Field has a value + has_user_id_hint = 0x10, + match_codes_first = 0x20, } } /// Details about an accepted authorization request, for more info click here » See @@ -18581,13 +18500,15 @@ namespace TL } /// Represents a story media area » See Derived classes: , , , , , , , , - public abstract partial class MediaArea : IObject { } - /// Represents a location tag attached to a story, with additional venue information. See - [TLDef(0xBE82DB9C)] - public sealed partial class MediaAreaVenue : MediaArea + public abstract partial class MediaArea : IObject { /// The size and location of the media area corresponding to the location sticker on top of the story media. public MediaAreaCoordinates coordinates; + } + /// Represents a location tag attached to a story, with additional venue information. See + [TLDef(0xBE82DB9C, inheritAt = 0)] + public sealed partial class MediaAreaVenue : MediaArea + { /// Coordinates of the venue public GeoPoint geo; /// Venue name @@ -18602,24 +18523,20 @@ namespace TL public string venue_type; } /// Represents a location tag attached to a story, with additional venue information. See - [TLDef(0xB282217F)] + [TLDef(0xB282217F, inheritAt = 0)] public sealed partial class InputMediaAreaVenue : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The query_id from , see here » for more info. public long query_id; /// The id of the chosen result, see here » for more info. public string result_id; } /// Represents a geolocation tag attached to a story. See - [TLDef(0xCAD5452D)] + [TLDef(0xCAD5452D, inheritAt = 1)] public sealed partial class MediaAreaGeoPoint : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The size and position of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// Coordinates of the geolocation tag. public GeoPoint geo; /// Optional textual representation of the address. @@ -18632,13 +18549,11 @@ namespace TL } } /// Represents a reaction bubble. See - [TLDef(0x14455871)] + [TLDef(0x14455871, inheritAt = 1)] public sealed partial class MediaAreaSuggestedReaction : MediaArea { /// Extra bits of information, use flags.HasFlag(...) to test for those public Flags flags; - /// The coordinates of the media area corresponding to the reaction button. - public MediaAreaCoordinates coordinates; /// The reaction that should be sent when this area is clicked. public Reaction reaction; @@ -18651,42 +18566,34 @@ namespace TL } } /// Represents a channel post. See - [TLDef(0x770416AF)] + [TLDef(0x770416AF, inheritAt = 0)] public sealed partial class MediaAreaChannelPost : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The channel that posted the message public long channel_id; /// ID of the channel message public int msg_id; } /// Represents a channel post See - [TLDef(0x2271F2BF)] + [TLDef(0x2271F2BF, inheritAt = 0)] public sealed partial class InputMediaAreaChannelPost : MediaArea { - /// The size and location of the media area corresponding to the location sticker on top of the story media. - public MediaAreaCoordinates coordinates; /// The channel that posted the message public InputChannelBase channel; /// ID of the channel message public int msg_id; } /// Represents a URL media area. See - [TLDef(0x37381085)] + [TLDef(0x37381085, inheritAt = 0)] public sealed partial class MediaAreaUrl : MediaArea { - /// The size and location of the media area corresponding to the URL button on top of the story media. - public MediaAreaCoordinates coordinates; /// URL to open when clicked. public string url; } /// Represents a weather widget ». See - [TLDef(0x49A6549C)] + [TLDef(0x49A6549C, inheritAt = 0)] public sealed partial class MediaAreaWeather : MediaArea { - /// The size and location of the media area corresponding to the widget on top of the story media. - public MediaAreaCoordinates coordinates; /// Weather emoji, should be rendered as an animated emoji. public string emoji; /// Temperature in degrees Celsius. @@ -18695,11 +18602,9 @@ namespace TL public int color; } /// Represents a collectible gift ». See - [TLDef(0x5787686D)] + [TLDef(0x5787686D, inheritAt = 0)] public sealed partial class MediaAreaStarGift : MediaArea { - /// Coordinates of the media area. - public MediaAreaCoordinates coordinates; /// slug from .slug, that can be resolved as specified here ». public string slug; } diff --git a/src/TL.SchemaFuncs.cs b/src/TL.SchemaFuncs.cs index 72fb740..985dec3 100644 --- a/src/TL.SchemaFuncs.cs +++ b/src/TL.SchemaFuncs.cs @@ -3291,14 +3291,15 @@ namespace TL /// The ID of the button with the authorization request /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null) + public static Task Messages_RequestUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, string in_app_origin = null) => client.Invoke(new Messages_RequestUrlAuth { - flags = (Messages_RequestUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0)), + flags = (Messages_RequestUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (in_app_origin != null ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, url = url, + in_app_origin = in_app_origin, }); /// Use this to accept a Seamless Telegram Login authorization request, for more info click here » See @@ -3308,14 +3309,15 @@ namespace TL /// ID of the login button /// URL used for link URL authorization, click here for more info » /// a null value means urlAuthResultDefault - public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, bool write_allowed = false, bool share_phone_number = false) + public static Task Messages_AcceptUrlAuth(this Client client, InputPeer peer = null, int? msg_id = null, int? button_id = null, string url = null, string match_code = null, bool write_allowed = false, bool share_phone_number = false) => client.Invoke(new Messages_AcceptUrlAuth { - flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), + flags = (Messages_AcceptUrlAuth.Flags)((peer != null ? 0x2 : 0) | (msg_id != null ? 0x2 : 0) | (button_id != null ? 0x2 : 0) | (url != null ? 0x4 : 0) | (match_code != null ? 0x10 : 0) | (write_allowed ? 0x1 : 0) | (share_phone_number ? 0x8 : 0)), peer = peer, msg_id = msg_id ?? default, button_id = button_id ?? default, url = url, + match_code = match_code, }); /// Should be called after the user hides the report spam/add as contact bar of a new chat, effectively prevents the user from executing the actions specified in the action bar ». See Possible codes: 400 (details) @@ -3754,11 +3756,13 @@ namespace TL /// Enable or disable content protection on a channel or chat See Possible codes: 400 (details) /// The chat or channel /// Enable or disable content protection - public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled) + public static Task Messages_ToggleNoForwards(this Client client, InputPeer peer, bool enabled, int? request_msg_id = null) => client.Invoke(new Messages_ToggleNoForwards { + flags = (Messages_ToggleNoForwards.Flags)(request_msg_id != null ? 0x1 : 0), peer = peer, enabled = enabled, + request_msg_id = request_msg_id ?? default, }); /// Change the default peer that should be used when sending messages, reactions, poll votes to a specific group See Possible codes: 400 (details) @@ -4873,6 +4877,46 @@ namespace TL to_lang = to_lang, }); + /// See [bots: ✓] + public static Task Messages_EditChatCreator(this Client client, InputPeer peer, InputUserBase user_id, InputCheckPasswordSRP password) + => client.Invoke(new Messages_EditChatCreator + { + peer = peer, + user_id = user_id, + password = password, + }); + + /// See [bots: ✓] + public static Task Messages_GetFutureChatCreatorAfterLeave(this Client client, InputPeer peer) + => client.Invoke(new Messages_GetFutureChatCreatorAfterLeave + { + peer = peer, + }); + + /// See [bots: ✓] + public static Task Messages_EditChatParticipantRank(this Client client, InputPeer peer, InputPeer participant, string rank) + => client.Invoke(new Messages_EditChatParticipantRank + { + peer = peer, + participant = participant, + rank = rank, + }); + + /// See [bots: ✓] + public static Task Messages_DeclineUrlAuth(this Client client, string url) + => client.Invoke(new Messages_DeclineUrlAuth + { + url = url, + }); + + /// See [bots: ✓] + public static Task Messages_CheckUrlAuthMatchCode(this Client client, string url, string match_code) + => client.Invoke(new Messages_CheckUrlAuthMatchCode + { + url = url, + match_code = match_code, + }); + /// Returns a current state of updates. See [bots: ✓] public static Task Updates_GetState(this Client client) => client.Invoke(new Updates_GetState @@ -5393,9 +5437,10 @@ namespace TL /// The ID of the user whose admin rights should be modified /// The admin rights /// Indicates the role (rank) of the admin in the group: just an arbitrary string - public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank) + public static Task Channels_EditAdmin(this Client client, InputChannelBase channel, InputUserBase user_id, ChatAdminRights admin_rights, string rank = null) => client.Invoke(new Channels_EditAdmin { + flags = (Channels_EditAdmin.Flags)(rank != null ? 0x1 : 0), channel = channel, user_id = user_id, admin_rights = admin_rights, @@ -5609,18 +5654,6 @@ namespace TL group = group, }); - /// Transfer channel ownership See Possible codes: 400,403 (details) - /// Channel - /// New channel owner - /// 2FA password of account - public static Task Channels_EditCreator(this Client client, InputChannelBase channel, InputUserBase user_id, InputCheckPasswordSRP password) - => client.Invoke(new Channels_EditCreator - { - channel = channel, - user_id = user_id, - password = password, - }); - /// Edit location of geogroup, see here » for more info on geogroups. See Possible codes: 400 (details) /// Geogroup /// New geolocation @@ -5914,13 +5947,6 @@ namespace TL tab = tab, }); - /// See Possible codes: 400 (details) - public static Task Channels_GetFutureCreatorAfterLeave(this Client client, InputChannelBase channel) - => client.Invoke(new Channels_GetFutureCreatorAfterLeave - { - channel = channel, - }); - /// Sends a custom request; for bots only See [bots: ✓ users: ✗] Possible codes: 400 (details) /// The method name /// JSON-serialized method parameters @@ -11058,7 +11084,7 @@ namespace TL.Methods } } - [TLDef(0x198FB446)] + [TLDef(0x894CC99C)] public sealed partial class Messages_RequestUrlAuth : IMethod { public Flags flags; @@ -11066,15 +11092,17 @@ namespace TL.Methods [IfFlag(1)] public int msg_id; [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; + [IfFlag(3)] public string in_app_origin; [Flags] public enum Flags : uint { has_peer = 0x2, has_url = 0x4, + has_in_app_origin = 0x8, } } - [TLDef(0xB12C7125)] + [TLDef(0x67A3F0DE)] public sealed partial class Messages_AcceptUrlAuth : IMethod { public Flags flags; @@ -11082,6 +11110,7 @@ namespace TL.Methods [IfFlag(1)] public int msg_id; [IfFlag(1)] public int button_id; [IfFlag(2)] public string url; + [IfFlag(4)] public string match_code; [Flags] public enum Flags : uint { @@ -11089,6 +11118,7 @@ namespace TL.Methods has_peer = 0x2, has_url = 0x4, share_phone_number = 0x8, + has_match_code = 0x10, } } @@ -11452,11 +11482,18 @@ namespace TL.Methods } } - [TLDef(0xB11EAFA2)] + [TLDef(0xB2081A35)] public sealed partial class Messages_ToggleNoForwards : IMethod { + public Flags flags; public InputPeer peer; public bool enabled; + [IfFlag(0)] public int request_msg_id; + + [Flags] public enum Flags : uint + { + has_request_msg_id = 0x1, + } } [TLDef(0xCCFDDF96)] @@ -12411,6 +12448,41 @@ namespace TL.Methods } } + [TLDef(0xF743B857)] + public sealed partial class Messages_EditChatCreator : IMethod + { + public InputPeer peer; + public InputUserBase user_id; + public InputCheckPasswordSRP password; + } + + [TLDef(0x3B7D0EA6)] + public sealed partial class Messages_GetFutureChatCreatorAfterLeave : IMethod + { + public InputPeer peer; + } + + [TLDef(0xA00F32B0)] + public sealed partial class Messages_EditChatParticipantRank : IMethod + { + public InputPeer peer; + public InputPeer participant; + public string rank; + } + + [TLDef(0x35436BBC)] + public sealed partial class Messages_DeclineUrlAuth : IMethod + { + public string url; + } + + [TLDef(0xC9A47B0B)] + public sealed partial class Messages_CheckUrlAuthMatchCode : IMethod + { + public string url; + public string match_code; + } + [TLDef(0xEDD4882A)] public sealed partial class Updates_GetState : IMethod { } @@ -12795,13 +12867,19 @@ namespace TL.Methods } } - [TLDef(0xD33C8902)] + [TLDef(0x9A98AD68)] public sealed partial class Channels_EditAdmin : IMethod { + public Flags flags; public InputChannelBase channel; public InputUserBase user_id; public ChatAdminRights admin_rights; - public string rank; + [IfFlag(0)] public string rank; + + [Flags] public enum Flags : uint + { + has_rank = 0x1, + } } [TLDef(0x566DECD0)] @@ -12974,14 +13052,6 @@ namespace TL.Methods public InputChannelBase group; } - [TLDef(0x8F38CD1F)] - public sealed partial class Channels_EditCreator : IMethod - { - public InputChannelBase channel; - public InputUserBase user_id; - public InputCheckPasswordSRP password; - } - [TLDef(0x58E63F6D)] public sealed partial class Channels_EditLocation : IMethod { @@ -13219,12 +13289,6 @@ namespace TL.Methods public ProfileTab tab; } - [TLDef(0xA00918AF)] - public sealed partial class Channels_GetFutureCreatorAfterLeave : IMethod - { - public InputChannelBase channel; - } - [TLDef(0xAA2769ED)] public sealed partial class Bots_SendCustomRequest : IMethod { diff --git a/src/TL.Table.cs b/src/TL.Table.cs index 58c89c4..a26fd62 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 = 222; // fetched 02/06/2026 19:18:24 + public const int Version = 223; // fetched 03/02/2026 11:38:17 internal const int SecretChats = 144; internal const int MTProto2 = 73; internal const uint VectorCtor = 0x1CB5C415; @@ -145,15 +145,15 @@ namespace TL [0x17D493D5] = typeof(ChannelForbidden), [0x2633421B] = typeof(ChatFull), [0xE4E0B29D] = typeof(ChannelFull), - [0xC02D4007] = typeof(ChatParticipant), - [0xE46BCEE4] = typeof(ChatParticipantCreator), - [0xA0933F5B] = typeof(ChatParticipantAdmin), + [0x38E79FDE] = typeof(ChatParticipant), + [0xE1F867B8] = typeof(ChatParticipantCreator), + [0x0360D5D2] = typeof(ChatParticipantAdmin), [0x8763D3E1] = typeof(ChatParticipantsForbidden), [0x3CBC93F8] = typeof(ChatParticipants), [0x37C1011C] = null,//ChatPhotoEmpty [0x1C6E1C11] = typeof(ChatPhoto), [0x90A6CA84] = typeof(MessageEmpty), - [0x9CB490E9] = typeof(Message), + [0x3AE56482] = typeof(Message), [0x7A800E0A] = typeof(MessageService), [0x3DED6320] = null,//MessageMediaEmpty [0x695150D7] = typeof(MessageMediaPhoto), @@ -236,6 +236,8 @@ namespace TL [0x73ADA76B] = typeof(MessageActionStarGiftPurchaseOfferDeclined), [0xB07ED085] = typeof(MessageActionNewCreatorPending), [0xE188503B] = typeof(MessageActionChangeCreator), + [0xBF7D6572] = typeof(MessageActionNoForwardsToggle), + [0x3E2793BA] = typeof(MessageActionNoForwardsRequest), [0xD58A08C6] = typeof(Dialog), [0x71BD134C] = typeof(DialogFolder), [0x2331B22D] = typeof(PhotoEmpty), @@ -453,6 +455,7 @@ namespace TL [0xDC58F31E] = typeof(UpdateStarGiftAuctionUserState), [0xFB9C547A] = typeof(UpdateEmojiGameInfo), [0xAC072444] = typeof(UpdateStarGiftCraftFail), + [0xBD8367B9] = typeof(UpdateChatParticipantRank), [0xA56C2A3E] = typeof(Updates_State), [0x5D75A138] = typeof(Updates_DifferenceEmpty), [0x00F49CA0] = typeof(Updates_Difference), @@ -641,6 +644,7 @@ namespace TL [0x32CA960F] = typeof(MessageEntitySpoiler), [0xC8CF05F8] = typeof(MessageEntityCustomEmoji), [0xF1CCAAAC] = typeof(MessageEntityBlockquote), + [0x904AC7C7] = typeof(MessageEntityFormattedDate), [0xEE8C1E86] = null,//InputChannelEmpty [0xF35AEC28] = typeof(InputChannel), [0x5B934F9D] = typeof(InputChannelFromMessage), @@ -651,11 +655,11 @@ namespace TL [0x2064674E] = typeof(Updates_ChannelDifference), [0x94D42EE7] = null,//ChannelMessagesFilterEmpty [0xCD77D957] = typeof(ChannelMessagesFilter), - [0xCB397619] = typeof(ChannelParticipant), - [0x4F607BEF] = typeof(ChannelParticipantSelf), + [0x1BD54456] = typeof(ChannelParticipant), + [0xA9478A1A] = typeof(ChannelParticipantSelf), [0x2FE601D3] = typeof(ChannelParticipantCreator), [0x34C3BB53] = typeof(ChannelParticipantAdmin), - [0x6DF8014E] = typeof(ChannelParticipantBanned), + [0xD5F0AD91] = typeof(ChannelParticipantBanned), [0x1B03F006] = typeof(ChannelParticipantLeft), [0xDE3F3C79] = typeof(ChannelParticipantsRecent), [0xB4608969] = typeof(ChannelParticipantsAdmins), @@ -889,6 +893,7 @@ namespace TL [0x60A79C79] = typeof(ChannelAdminLogEventActionToggleSignatureProfiles), [0x64642DB3] = typeof(ChannelAdminLogEventActionParticipantSubExtend), [0xC517F77E] = typeof(ChannelAdminLogEventActionToggleAutotranslation), + [0x5806B4EC] = typeof(ChannelAdminLogEventActionParticipantEditRank), [0x1FAD68CD] = typeof(ChannelAdminLogEvent), [0xED8AF74D] = typeof(Channels_AdminLogResults), [0xEA107AE4] = typeof(ChannelAdminLogEventsFilter), @@ -1002,7 +1007,7 @@ namespace TL [0xFBD2C296] = typeof(InputFolderPeer), [0xE9BAA668] = typeof(FolderPeer), [0xE844EBFF] = typeof(Messages_SearchCounter), - [0x32FABF1A] = typeof(UrlAuthResultRequest), + [0xF8F8EB1E] = typeof(UrlAuthResultRequest), [0x623A8FA0] = typeof(UrlAuthResultAccepted), [0xA9D6DB1F] = null,//UrlAuthResultDefault [0xBFB5AD8B] = null,//ChannelLocationEmpty diff --git a/src/WTelegramClient.csproj b/src/WTelegramClient.csproj index aef2b5c..bd1d6c3 100644 --- a/src/WTelegramClient.csproj +++ b/src/WTelegramClient.csproj @@ -13,8 +13,8 @@ WTelegramClient Wizou 0.0.0 - layer.222 - Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 222 + layer.223 + Telegram Client API (MTProto) library written 100% in C# and .NET Standard | Latest API layer: 223 Release Notes: $(ReleaseNotes) From 6611e8675b8072e8f81e85e1318d22a3c2eb36c7 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Sat, 7 Mar 2026 17:30:15 +0100 Subject: [PATCH 335/336] fixed KeyboardButtonUrlAuth --- src/TL.Schema.cs | 23 ++++++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/src/TL.Schema.cs b/src/TL.Schema.cs index 6f8ea40..fde6d62 100644 --- a/src/TL.Schema.cs +++ b/src/TL.Schema.cs @@ -8654,15 +8654,32 @@ namespace TL { } /// Button to request a user to authorize via URL using Seamless Telegram Login. When the user clicks on such a button, Messages_RequestUrlAuth should be called, providing the button_id and the ID of the container message. The returned object will contain more details about the authorization request (request_write_access if the bot would like to send messages to the user along with the username of the bot which will be used for user authorization). Finally, the user can choose to call Messages_AcceptUrlAuth to get a with the URL to open instead of the url of this constructor, or a , in which case the url of this constructor must be opened, instead. If the user refuses the authorization request but still wants to open the link, the url of this constructor must be used. See - [TLDef(0xF51006F9, inheritAt = 0)] - public sealed partial class KeyboardButtonUrlAuth : KeyboardButton + [TLDef(0xF51006F9)] + public sealed partial class KeyboardButtonUrlAuth : KeyboardButtonBase { + /// Extra bits of information, use flags.HasFlag(...) to test for those + public Flags flags; + [IfFlag(10)] public KeyboardButtonStyle style; + /// Button label + public string text; /// New text of the button in forwarded messages. - public string fwd_text; + [IfFlag(0)] public string fwd_text; /// An HTTP URL to be opened with user authorization data added to the query string when the button is pressed. If the user refuses to provide authorization data, the original URL without information about the user will be opened. The data added is the same as described in Receiving authorization data.

NOTE: Services must always check the hash of the received data to verify the authentication and the integrity of the data as described in Checking authorization.
public string url; /// ID of the button to pass to Messages_RequestUrlAuth public int button_id; + + [Flags] public enum Flags : uint + { + /// Field has a value + has_fwd_text = 0x1, + /// Field has a value + has_style = 0x400, + } + + public override KeyboardButtonStyle Style => style; + /// Button label + public override string Text => text; } /// Button to request a user to Messages_AcceptUrlAuth via URL using Seamless Telegram Login. See [TLDef(0x68013E72)] From 24dbbcf66ba6be26720684dc00415e8a754c9b81 Mon Sep 17 00:00:00 2001 From: Wizou <11647984+wiz0u@users.noreply.github.com> Date: Wed, 1 Apr 2026 05:31:24 +0200 Subject: [PATCH 336/336] Html/Markdown conversions: - Support for MessageEntityFormattedDate - Removed premium optional arg (always true now) - Stopped supporting non-standard markdown "emoji?id=". Correct syntax is "tg://emoji?id=" --- EXAMPLES.md | 2 +- src/Services.cs | 60 ++++++++++++++++++++++++++++++++++--------------- 2 files changed, 43 insertions(+), 19 deletions(-) diff --git a/EXAMPLES.md b/EXAMPLES.md index ac2daf1..d00c4b5 100644 --- a/EXAMPLES.md +++ b/EXAMPLES.md @@ -365,7 +365,7 @@ await Task.Delay(5000); ```csharp // • Sending a message with custom emojies in Markdown to ourself: var text = "Vicksy says Hi! ![👋](tg://emoji?id=5190875290439525089)"; -var entities = client.MarkdownToEntities(ref text, premium: true); +var entities = client.MarkdownToEntities(ref text); await client.SendMessageAsync(InputPeer.Self, text, entities: entities); // also available in HTML: 👋 diff --git a/src/Services.cs b/src/Services.cs index 7d452f2..ebf7733 100644 --- a/src/Services.cs +++ b/src/Services.cs @@ -131,10 +131,9 @@ namespace TL /// Converts a Markdown text into the (plain text + entities) format used by Telegram messages /// not used anymore, you can pass null /// [in] The Markdown text
[out] The same (plain) text, stripped of all Markdown notation - /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) + public static MessageEntity[] MarkdownToEntities(this Client _, ref string text, IReadOnlyDictionary users = null) { var entities = new List(); MessageEntityBlockquote lastBlockQuote = null; @@ -217,12 +216,18 @@ namespace TL else if (c == ')') break; } textUrl.url = sb.ToString(offset + 2, offset2 - offset - 3); + sb.Remove(offset, offset2 - offset); if (textUrl.url.StartsWith("tg://user?id=") && long.TryParse(textUrl.url[13..], out var id) && users?.GetValueOrDefault(id)?.access_hash is long hash) entities[lastIndex] = new InputMessageEntityMentionName { offset = textUrl.offset, length = textUrl.length, user_id = new InputUser(id, hash) }; - else if ((textUrl.url.StartsWith("tg://emoji?id=") || textUrl.url.StartsWith("emoji?id=")) && long.TryParse(textUrl.url[(textUrl.url.IndexOf('=') + 1)..], out id)) - if (premium) entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; - else entities.RemoveAt(lastIndex); - sb.Remove(offset, offset2 - offset); + else if (textUrl.url.StartsWith("tg://emoji?id=") && long.TryParse(textUrl.url[14..], out id)) + entities[lastIndex] = new MessageEntityCustomEmoji { offset = textUrl.offset, length = textUrl.length, document_id = id }; + else if (textUrl.url.StartsWith("tg://time?unix=") && textUrl.url.IndexOf("&format=", 15) is { } idxFormat) + entities[lastIndex] = new MessageEntityFormattedDate + { + offset = textUrl.offset, length = textUrl.length, + date = new DateTime((long.Parse(idxFormat < 0 ? textUrl.url[15..] : textUrl.url[15..idxFormat]) + 62135596800L) * 10000000, DateTimeKind.Utc), + flags = idxFormat < 0 ? 0 : HtmlText.DateFlags(textUrl.url[(idxFormat + 8)..]) + }; break; } } @@ -264,9 +269,8 @@ namespace TL /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf /// The plain text, typically obtained from /// The array of formatting entities, typically obtained from - /// Convert premium entities (might lead to non-standard markdown) /// The message text with MarkdownV2 formattings - public static string EntitiesToMarkdown(this Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToMarkdown(this Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string md)>(); @@ -301,8 +305,9 @@ namespace TL else if (nextEntity is InputMessageEntityMentionName imemn) closing.md = $"](tg://user?id={imemn.user_id.UserId ?? client.UserId})"; else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) closing.md = $"](tg://emoji?id={mecu.document_id})"; - else continue; + closing.md = $"](tg://emoji?id={mecu.document_id})"; + else if (nextEntity is MessageEntityFormattedDate mefd) + closing.md = $"](tg://time?unix={((DateTimeOffset)mefd.date).ToUnixTimeSeconds()}{(mefd.flags == 0 ? null : $"&format={HtmlText.DateFormat(mefd.flags)}")})"; } else if (nextEntity is MessageEntityBlockquote mebq) { inBlockQuote = true; if (lastCh is not '\n' and not '\0') md = "\n>"; @@ -343,6 +348,7 @@ namespace TL [typeof(MessageEntitySpoiler)] = "||", [typeof(MessageEntityCustomEmoji)] = "![", [typeof(MessageEntityBlockquote)] = ">", + [typeof(MessageEntityFormattedDate)] = "![", }; /// Insert backslashes in front of Markdown reserved characters @@ -372,10 +378,9 @@ namespace TL /// Converts an HTML-formatted text into the (plain text + entities) format used by Telegram messages /// not used anymore, you can pass null /// [in] The HTML-formatted text
[out] The same (plain) text, stripped of all HTML tags - /// Generate premium entities if any /// Dictionary used for tg://user?id= notation /// The array of formatting entities that you can pass (along with the plain text) to SendMessageAsync or SendMediaAsync - public static MessageEntity[] HtmlToEntities(this Client _, ref string text, bool premium = false, IReadOnlyDictionary users = null) + public static MessageEntity[] HtmlToEntities(this Client _, ref string text, IReadOnlyDictionary users = null) { var entities = new List(); var sb = new StringBuilder(text); @@ -419,6 +424,7 @@ namespace TL case "code": ProcessEntity(); break; case "pre": ProcessEntity(); break; case "tg-emoji" when closing: ProcessEntity(); break; + case "tg-time" when closing: ProcessEntity(); break; case "blockquote": ProcessEntity(); break; case "blockquote expandable": entities.Add(new MessageEntityBlockquote { offset = offset, length = -1, flags = MessageEntityBlockquote.Flags.collapsed }); @@ -448,8 +454,15 @@ namespace TL if (entities.LastOrDefault(e => e.length == -1) is MessageEntityPre prevEntity) prevEntity.language = tag[21..^1]; } - else if (premium && (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='"))) - entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[(tag.IndexOf('=') + 2)..^1]) }); + else if (tag.StartsWith("tg-emoji emoji-id=\"") || tag.StartsWith("tg-emoji emoji-id='")) + entities.Add(new MessageEntityCustomEmoji { offset = offset, length = -1, document_id = long.Parse(tag[19..^1]) }); + else if ((tag.StartsWith("tg-time unix=\"") || tag.StartsWith("tg-time unix='")) && (end = tag.IndexOf(tag[13], 14)) > 0) + entities.Add(new MessageEntityFormattedDate + { + offset = offset, length = -1, + date = new DateTime((long.Parse(tag[14..end]) + 62135596800L) * 10000000, DateTimeKind.Utc), + flags = string.Compare(tag, end + 1, " format=", 0, 8) == 0 ? DateFlags(tag[(end + 10)..^1]) : 0 + }); break; } @@ -486,9 +499,8 @@ namespace TL /// Client, used only for getting current user ID in case of InputMessageEntityMentionName+InputUserSelf /// The plain text, typically obtained from /// The array of formatting entities, typically obtained from - /// Convert premium entities /// The message text with HTML formatting tags - public static string EntitiesToHtml(this Client client, string message, MessageEntity[] entities, bool premium = false) + public static string EntitiesToHtml(this Client client, string message, MessageEntity[] entities) { if (entities == null || entities.Length == 0) return Escape(message); var closings = new List<(int offset, string tag)>(); @@ -519,8 +531,7 @@ namespace TL tag = $""; } else if (nextEntity is MessageEntityCustomEmoji mecu) - if (premium) tag = $""; - else continue; + tag = $""; else if (nextEntity is MessageEntityPre mep && !string.IsNullOrEmpty(mep.language)) { closing.Item2 = ""; @@ -528,6 +539,8 @@ namespace TL } else if (nextEntity is MessageEntityBlockquote { flags: MessageEntityBlockquote.Flags.collapsed }) tag = "
"; + else if (nextEntity is MessageEntityFormattedDate mefd) + tag = $""; else tag = $"<{tag}>"; int index = ~closings.BinarySearch(closing, Comparer<(int, string)>.Create((x, y) => x.Item1.CompareTo(y.Item1) | 1)); @@ -559,6 +572,7 @@ namespace TL [typeof(MessageEntitySpoiler)] = "tg-spoiler", [typeof(MessageEntityCustomEmoji)] = "tg-emoji", [typeof(MessageEntityBlockquote)] = "blockquote", + [typeof(MessageEntityFormattedDate)] = "tg-time", }; /// Replace special HTML characters with their &xx; equivalent @@ -566,5 +580,15 @@ namespace TL /// The HTML-safe text, ready to be used in HtmlToEntities without problems public static string Escape(string text) => text?.Replace("&", "&").Replace("<", "<").Replace(">", ">"); + + internal static string DateFormat(MessageEntityFormattedDate.Flags flags) => flags.HasFlag(MessageEntityFormattedDate.Flags.relative) ? "r" : + ((flags & MessageEntityFormattedDate.Flags.day_of_week) != 0 ? "w" : "") + + ((flags & MessageEntityFormattedDate.Flags.short_date) != 0 ? "d" : "") + + ((flags & MessageEntityFormattedDate.Flags.long_date) != 0 ? "D" : "") + + ((flags & MessageEntityFormattedDate.Flags.short_time) != 0 ? "t" : "") + + ((flags & MessageEntityFormattedDate.Flags.long_time) != 0 ? "T" : ""); + + internal static MessageEntityFormattedDate.Flags DateFlags(string format) + => (MessageEntityFormattedDate.Flags)format.Sum(c => 1 << "rtTdDw".IndexOf(c)); } }